Estimate calories and macros from a food photo
analyze_foodUses one prepaid credit with a Bearer API key, or costs 0.01 USDC per successful analysis on Base. Buy card credits at https://kcalsnap.com/developers/credits/. Submit JPEG, PNG, or static WebP base64 (2 MB, max 2048px per side; optional data URL prefix is accepted). Returns foods, estimated grams, kcal, protein, carbs, fat and USDA/AI provenance. x402 payment goes in params._meta["x402/payment"]. Keep the same idempotency_key and payment on retry. Images go to our model provider; KcalSnap stores result text for 24 hours. Portion estimates are uncertain.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"image_base64": "<image_base64>",
"mime_type": "<mime_type>",
"idempotency_key": "<idempotency_key>"
},
"name": "analyze_food"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| note | No | Optional meal context that a photo cannot show, such as cooking oil, milk type, sauces, preparation method, or hidden ingredients (up to 280 Unicode characters). Only pass real user-provided details; never invent context. | |
| language | No | en | |
| mime_type | Yes | ||
| image_base64 | Yes | ||
| idempotency_key | Yes | ||
| known_total_grams | No | Optional measured weight of all edible food detected in the image, excluding the plate and inedible parts. At most two decimals. Component proportions remain photo estimates. Omit if only part of the meal was weighed. |