Food AI API
One request: a JPEG of a meal. One response: the dishes Food AI recognizes, with serving sizes and nutrition. This page documents exactly what the demo sends and receives.
Keys, plans, usage and billing are on the developer portal at dev.caloriemama.ai. Nothing there is duplicated here.
Request
curl -X POST \
"https://api-2445582032290.production.gw.apicast.io/v1/foodrecognition?user_key=YOUR_KEY" \
-F "media=@plate.jpg"
| Method | POST, multipart/form-data with one image file field. The field name is not significant. |
|---|---|
| Auth | user_key query parameter, issued on the developer portal. |
| Image | JPEG. Longest side at most 544 pixels; larger images are rejected with HTTP 400 and the message Image size too big. Crop to 544x544 px please. Resize on the client before sending, as the demo does. |
| Language | Names come back in English (en_US). |
Response
A sample photo of enchiladas, trimmed to the first group. The full answer for this photo has seven groups.
{
"is_food": true,
"lang": "en_US",
"imagecache_id": "…",
"_timing": { "foodai_totaltime": 0.045, "foodai_classificationtime": 0.041 },
"results": [
{
"group": "Enchilada",
"items": [
{
"name": "Enchiladas",
"food_id": "427d09b46a1b1395",
"group": "Enchilada",
"score": 105,
"servingSizes": [
{ "unit": "1 enchilada", "servingWeight": 0.142 },
{ "unit": "100 g", "servingWeight": 0.1 },
{ "unit": "1 oz", "servingWeight": 0.0283495 }
],
"nutrition": {
"calories": 2042.25,
"protein": 0.0775,
"totalFat": 0.1268,
"totalCarbs": 0.1549
}
}
]
}
]
}
| Field | Meaning |
|---|---|
| is_food | Whether the photo appears to contain food at all. |
| results[] | Groups of related dishes, best first. A photo with several foods returns several groups. |
| results[].group | The group name, for example Enchilada or Noodle Soup. |
| items[] | Candidate dishes within the group, best first. |
| items[].name | Dish name in English. |
| items[].food_id | Stable identifier for the dish. |
| items[].score | Confidence. Higher is more likely. It is not a percentage and values above 100 occur; compare scores within one response. |
| items[].servingSizes[] | Serving options. servingWeight is in kilograms. |
| items[].nutrition | Per kilogram of food. calories in kcal/kg; protein, totalFat and totalCarbs as a fraction of weight. Multiply by a servingWeight to get one serving. |
| _timing | Server-side timings in seconds, for diagnostics. |
| imagecache_id | Identifier of the processed image on the service. |
Worked example: enchiladas at 2042 kcal/kg, one enchilada at 0.142 kg, gives 290 kcal per enchilada.
Errors
| Status | Body |
|---|---|
| 400 | {"error":{"code":400,"errorDetail":"…"}}. The message says what to fix, for example the image is too large. |
| 401 / 403 | The key is missing, wrong or over its plan. Check the developer portal. |
Changelog
- September 2026
- This site was rebuilt. No change to the API. Earlier changes are on the developer portal.
Calorie Mama