系列「每天一个高质量 API」第 17 篇。搜蚁智选(souyi.net.cn)是一个面向 AI Agent 的 API 发现与统一调用平台。今天聊 Open Food Facts 食品条码(free-food-openfoodfacts)。
扫一个条形码,拿到产品名、品牌、配料、过敏原与 Nutri-Score——全球最大的开放食品数据库。
这个 API 能做什么
/api/v0/product/{barcode}.json 用国际条形码查单品:status=1 表示找到;product 内含 product_name、brands、categories、allergens、nutriscore_grade(a–e)、quantity、nutriments。数据由全球志愿者众包维护,覆盖 300 万+ 商品。
为什么 AI Agent 需要它
- 健康饮食 Agent:用户拍条码 → 报出热量、糖分、添加剂。
- 过敏原拦截:
allergens字段可直接做硬性过滤,比让模型读配料表可靠。 - 电商 / 比价:条码是跨平台通用的商品主键。
怎么用
方式一:直连上游(免费、无需 Key)
curl "https://world.openfoodfacts.org/api/v0/product/3017620422003.json"
方式二:经搜蚁智选一键调用(带 Key,统一计费 / 限流 / 可观测)
curl -X POST https://souyi.net.cn/api/v1/ai/request \
-H "X-API-Key: YOUR_AIMALL_KEY" \
-H "Content-Type: application/json" \
-d '{"asset_id":"free-food-openfoodfacts","call_data":{}}'
这些免费 API 的上游本身免密;经搜蚁智选代理后,多个数据源可以聚合到同一个 Agent 工作流里,统一走 X-API-Key + 统一计费、限流与可观测,省去每个上游单独接一遍。
返回示例
{
"code": "3017620422003",
"status": 1,
"status_verbose": "product found",
"product": {
"product_name": "Testglas",
"brands": "Nutella, Ferrero",
"quantity": "400 g e",
"nutriscore_grade": "e",
"allergens": "milk, nuts, soybeans",
"categories": "Confectionary based spreads, Produits à tartiner sucrés, ..."
}
}
价格
免费。数据以 ODbL 授权,商用请保留 Open Food Facts 署名。上游限速 100 req/min。
怎么拿到 Key
注册 souyi.net.cn → 控制台一键生成 X-API-Key → 即可调用平台全部 API(含本系列 22 个)。
小结
众包数据的短板是字段偶尔不整齐(上面 product_name 就被志愿者改成了 Testglas),但 brands / allergens / nutriscore_grade 这些结构化字段足够稳,做健康类 Agent 完全够用。
更多免费 API 见 系列目录。