Everyday life
Everyday life · AI-assisted
Nutrition Analysis API
Calories, macros and 24 nutrients of any meal, from words in any language or a photo. USDA data.
Base URLhttps://nutrition-analysis-calories-macros-from-text.p.rapidapi.com/v1/nutritionopenapi.json
- Free plan
- 20 credits a day
- Paid plans
- from $4.99 a month
- One credit
- Meal: 10 credits (photo 15) for up to 5 foods, +2 per extra food. Search, food, barcode: 1.
- Endpoints
- 6, on
/v1/nutrition
Example call
curl -X POST "https://nutrition-analysis-calories-macros-from-text.p.rapidapi.com/v1/nutrition/analyze" \
-H "X-RapidAPI-Key: YOUR_API_KEY" \
-H "X-RapidAPI-Host: nutrition-analysis-calories-macros-from-text.p.rapidapi.com" \
-H "Content-Type: application/json" \
-d '{
"text": "2 eggs fried in butter, a slice of toast and a glass of orange juice"
}'
import requests
url = "https://nutrition-analysis-calories-macros-from-text.p.rapidapi.com/v1/nutrition/analyze"
payload = {
"text": "2 eggs fried in butter, a slice of toast and a glass of orange juice"
}
headers = {
"X-RapidAPI-Key": "YOUR_API_KEY",
"X-RapidAPI-Host": "nutrition-analysis-calories-macros-from-text.p.rapidapi.com",
}
r = requests.post(url, json=payload, headers=headers)
print(r.json())
const res = await fetch("https://nutrition-analysis-calories-macros-from-text.p.rapidapi.com/v1/nutrition/analyze", {
method: "POST",
headers: {
"X-RapidAPI-Key": "YOUR_API_KEY",
"X-RapidAPI-Host": "nutrition-analysis-calories-macros-from-text.p.rapidapi.com",
"Content-Type": "application/json",
},
body: JSON.stringify({
"text": "2 eggs fried in butter, a slice of toast and a glass of orange juice"
}),
});
console.log(await res.json());
{
"language": "en",
"items": [
{
"input": "2 eggs fried in butter",
"name": "egg, fried in butter",
"quantity": 2.0,
"unit": "egg",
"grams": 110.0,
"grams_source": "portion",
"portion": { "label": "1 egg", "grams": 55.0 },
"match": {
"fdc_id": 2707159,
"description": "Egg, whole, fried with butter",
"dataset": "fndds",
"category": "Eggs and omelets"
},
"nutrients": {
"calories_kcal": 200.0,
"protein_g": 12.8,
"fat_g": 16.1,
"saturated_fat_g": 6.6,
"carbs_g": 0.99,
"fiber_g": 0.0,
"sugar_g": 0.24,
"cholesterol_mg": 438.0,
"sodium_mg": 289.0,
"calcium_mg": 50.6,
"iron_mg": 1.7,
"vitamin_d_ug": 2.6,
"vitamin_b12_ug": 0.84,
"...": "..."
}
},
{
"input": "a slice of toast",
"name": "bread, toasted",
"quantity": 1.0,
"unit": "slice",
"grams": 25.0,
"grams_source": "portion",
"portion": { "label": "1 medium or regular slice", "grams": 25.0 },
"match": { "fdc_id": 2707599, "description": "Bread, white, toasted", "dataset": "fndds", "category": "Yeast breads" },
"nutrients": { "calories_kcal": 73.2, "protein_g": 2.6, "fat_g": 0.98, "carbs_g": 13.5, "...": "..." }
},
{
"input": "a glass of orange juice",
"name": "orange juice",
"quantity": 1.0,
"unit": "glass",
"grams": 248.0,
"grams_source": "estimated",
"match": { "fdc_id": 2709186, "description": "Orange juice, 100%, NFS", "dataset": "fndds", "category": "Citrus juice" },
"nutrients": { "calories_kcal": 117.0, "protein_g": 1.9, "carbs_g": 25.3, "vitamin_c_mg": 71.2, "...": "..." }
}
],
"unmatched": [],
"totals": {
"calories_kcal": 390.0,
"protein_g": 17.3,
"fat_g": 17.9,
"carbs_g": 39.8,
"fiber_g": 1.4,
"sugar_g": 22.0,
"sodium_mg": 418.0,
"vitamin_c_mg": 71.2,
"...": "..."
},
"incomplete": [],
"macros": { "protein_pct": 17.8, "carbs_pct": 40.9, "fat_pct": 41.4 },
"total_grams": 383.0,
"source": "USDA FoodData Central (public domain)",
"note": "Estimates for information only, not medical or dietary advice. Nutrient values come from USDA FoodData Central; quantities given without a weight are estimated."
}
Analyze Meal Text: POST /v1/nutrition/analyze. A real call and its real response, with long values shortened.
What the Nutrition Analysis API returns
Food logging without a food picker. Your users write the meal the way they would say it, in their own language: "2 eggs and a slice of toast with butter", "200 g de riz et un yaourt", "zwei Brötchen mit Nutella". Or they snap a photo. The API returns each food, its grams, its calories, macros and micronutrients, and the totals of the meal. Every value comes from USDA FoodData Central, never from the AI's imagination. From $0.006 a meal and $0.0006 a lookup.
- Any language, plain words
- Weights (g, kg, oz, lb), volumes (ml, cups, spoons), slices, pieces, glasses, cans, "a", "two", "half"
- Meal photos
- Foods and portions estimated by vision, with an optional hint ("about 300 g of curry")
- 24 nutrients per food
- Calories, protein, carbs, fat (saturated, mono, poly), fiber, sugar, cholesterol, sodium, potassium, calcium, iron, magnesium, zinc, vitamins A, C, D, B12, folate, water, alcohol, caffeine
- Meal totals and calorie split
- % of calories from protein, carbs, fat and alcohol
- Traceable
- Each food is linked to its USDA entry (FDC id), with how its grams were found: stated, USDA household portion, or estimated
- Food search, no AI
- 13,000 USDA foods (Foundation, SR Legacy, FNDDS) with nutrients per 100 g and household portions (1 large egg, 1 slice, 1 cup)
- Barcodes
- Packaged foods from Open Food Facts: nutrients per 100 g and per serving, Nutri-Score, NOVA group, allergens, ingredients
Endpoints
Host nutrition-analysis-calories-macros-from-text.p.rapidapi.com, header X-RapidAPI-Key. Parameters and examples for each one are in the API reference.
Meal Analysis
A meal in words or a photo, to calories, macros and micronutrients.
-
POST
/v1/nutrition/analyzeCalories, macros and micronutrients of a meal described in words -
POST
/v1/nutrition/analyze/photoCalories and macros of a meal photo, from its URL -
POST
/v1/nutrition/analyze/photo/uploadCalories and macros of an uploaded meal photo
Food Database
USDA foods: search, nutrients per 100 g and household portions. No AI.
-
GET
/v1/nutrition/foods/searchSearch USDA foods by name: nutrients per 100 g and portions -
GET
/v1/nutrition/foods/{fdc_id}One USDA food by FDC id, for 100 g or any amount
Barcode
Packaged food by barcode, from Open Food Facts. No AI.
Use cases
- Food diaries and calorie counters. Let users type or say their meal instead of searching a database food by food
- Fitness and coaching apps. Daily protein, carbs and fat from the meals clients send in chat
- Chatbots and voice assistants. "what did I eat today?" turned into numbers, in the user's language
- Recipe and meal-kit sites. Nutrition of a dish from its ingredient list
- Grocery and scan apps. Nutri-Score, allergens and nutrition from a barcode
Tutorial
Everyday life
Pricing
Meal: 10 credits (photo 15) for up to 5 foods, +2 per extra food. Search, food, barcode: 1. Failed calls are never billed.
| Plan | Price | Credits included | Above the quota |
|---|---|---|---|
| BASIC | Free | 20 / day | resets every day |
| PRO | $4.99/mo | 8,000 / month | $0.007 per credit |
| ULTRA | $14.99/mo | 25,000 / month | $0.007 per credit |
| MEGA | $49.99/mo | 80,000 / month | $0.007 per credit |
Subscribe on RapidAPI (opens in a new tab)
No code: the Apify actor
The Calorie & Nutrition Calculator - Meals, Photos & Barcodes actor runs the same engine on a list of inputs and exports a table (JSON, CSV, Excel, Google Sheets). It is billed per result; free-plan users get 5 meals or photos and 20 barcodes per run. Publication on Apify is in progress.
| Event | Charged for | Price |
|---|---|---|
meal-analyzed | Each meal text analysed (5 foods) | $0.0055 |
photo-analyzed | Each meal photo analysed (5 foods) | $0.008 |
extra-food | Each food beyond 5 in a meal | $0.0008 |
barcode-product | Each barcode found | $0.001 |
Questions about the Nutrition Analysis API
Is the AI making up the calories?
unmatched instead of being guessed.How accurate is it?
Which languages work?
/foods/search) is in English, USDA's language.

