Plausible plates and shaky macros: numbers from a text model

Ask any modern model to describe a metabolically optimal plate and it will happily return a meal plan, a justification and a neat breakdown of calorie shares between protein, fat and carbohydrate. Some people even run the same structured prompt across several models and compare the outputs like lab results. The answers look precise. The question is what that precision is worth.
This article is for developers building food, fitness or health-adjacent features, and for anyone curious about using a model as a nutrition assistant. It explains how a language model arrives at numbers, which parts of a nutrition answer are reasonably reliable and which are not, how to ground figures in real data, and where a human professional is not optional. It is general information about software design, not dietary or medical advice.
Frequently asked questions
Where does an LLM get calorie numbers from?
From patterns in its training text, which includes food labels, recipe sites, nutrition databases and articles. It does not look anything up at answer time unless you give it a tool or data. The number is a prediction of what text usually says, not a measurement.
Are model calorie estimates accurate?
For common, standardised foods they are often in a reasonable range. For mixed dishes, portion sizes, regional recipes and branded products they vary widely. Even the same model can give different figures for the same question on different runs.
How does a database lookup differ from a model estimate?
A food composition database stores measured or calculated values per defined portion, with a source. A model estimate is a fluent guess. The sensible design is to let the model parse the meal and let the database supply numbers.
Can a model estimate calories from a food photo?
Multimodal models can recognise many dishes, but portion size and hidden ingredients such as oil are hard to judge from an image, so estimates carry large error. The free endpoint on this site is text only and cannot read images.
Why do different models give different macro splits?
They were trained on different text, tuned differently, and sample randomly. A request for an optimal plate also has no single right answer; it depends on goals, health status and assumptions the prompt rarely states.
Is it safe to give users diet advice from a model?
General, well-established information with clear caveats is lower risk. Personalised targets, medical conditions, eating disorders, pregnancy, children and medication interactions call for qualified professionals. Design your feature to route those cases away from the model.
Does lowering temperature make numbers more reliable?
It makes them more repeatable, not more correct. A deterministic wrong number is still wrong. Grounding in a reference dataset is what improves correctness.
Which is better for nutrition apps, a large commercial model or a small open one?
Large commercial models usually recall more facts and reason better about mixed meals. Neither should be the source of truth for numbers. With database grounding, a smaller model is often sufficient for parsing and phrasing.
- How a text model produces a number
- Which parts of a nutrition answer are reliable
- Grounding: let the model parse, let data decide
- Why the same question gives different answers
- Photos, labels and the limits of text-only models
- Safety boundaries for health-adjacent features
- Prototyping a nutrition assistant for free
How a text model produces a number
When a model writes a medium banana has about 105 kcal, it is completing text in the most likely way given everything it has read. For a food that appears on thousands of labels with consistent values, the most likely completion is usually close to the truth. For a homemade stew with unstated quantities, there is no consistent source text, so the model blends patterns and produces something plausible.
The problem is that both kinds of answer look identical. A model does not automatically signal that one number is well anchored and the other is invented to fit. Users read the decimal places and assume a measurement happened.
Arithmetic is a separate weakness
Summing several items, converting grams to portions and computing percentage shares are all steps where language models make slips, especially smaller ones. Even if each item's number is right, the total can be off. Do the arithmetic in code.
Rounding hides uncertainty
A reply that says 30 percent protein sounds confident. The honest version would be a range. If you display model-derived numbers at all, show ranges or rounded values and say they are estimates.
Which parts of a nutrition answer are reliable
Not everything in a model's nutrition answer is equally shaky. Splitting the answer into types of claim helps you decide what to trust, what to ground and what to remove.
Structured prompts make comparison easier, not truer
A fixed prompt that forces a description, a justification and a calorie share table is great for comparing models side by side. It does not make any of them a reference. Treat such comparisons as tests of style and consistency.
Units and serving definitions
Many numeric errors are really unit errors: per 100 grams versus per serving, raw versus cooked weight, fluid ounces versus grams. Ask the model to state the unit explicitly and normalise everything in code. A single conversion slip can make a dish look twice as heavy in energy as it is.
- General principles widely repeated in reputable sources, such as vegetables being low in energy density: usually fine.
- Values for single, common, unprocessed foods per standard portion: often close, still worth grounding.
- Values for composite dishes, restaurant meals and branded products: unreliable without data.
- Portion size inferred from vague descriptions: very unreliable.
- Personal targets for a specific person: outside what a model should decide.

Grounding: let the model parse, let data decide
The robust architecture splits the job. The model turns free text such as two eggs scrambled with a bit of butter and a slice of toast into structured items with estimated quantities. Your code looks up each item in a food composition dataset and computes totals. The model then writes the friendly explanation around numbers it did not invent.
This plays to each component's strengths. Language models are good at understanding messy descriptions and at phrasing. Databases are good at numbers. Code is good at arithmetic. The example below shows the parsing half against the free endpoint, with a tiny inline table standing in for a real dataset.
Constrain the vocabulary
Asking the model to choose foods only from your dataset's names prevents it from inventing items you cannot look up. Unknown foods should go to a fallback path, such as asking the user to pick from a list, rather than being guessed.
Ask for quantities, then confirm them
Quantity is where most error lives. Show the parsed grams to the user and let them adjust before computing totals. A five-second confirmation improves accuracy more than any prompt tweak.
import json
from openai import OpenAI
client = OpenAI(base_url="https://api.apikeyanthropicfree.com/v1", api_key="free")
# Stand-in for a real food composition dataset (kcal per 100 g)
KCAL_PER_100G = {"egg": 143, "butter": 717, "wholemeal bread": 247}
meal = "two eggs scrambled with a little butter and one slice of wholemeal toast"
prompt = (
"Convert the meal into JSON: a list of objects with 'food' (one of: "
+ ", ".join(KCAL_PER_100G) + ") and 'grams' (your best estimate). JSON only.\n" + meal
)
r = client.chat.completions.create(
model="free-ai",
messages=[{"role": "user", "content": prompt}],
temperature=0,
)
raw = r.choices[0].message.content.strip().strip("`").removeprefix("json").strip()
items = json.loads(raw)
total = 0
for it in items:
kcal = KCAL_PER_100G[it["food"]] * it["grams"] / 100
total += kcal
print(f"{it['food']:16s} {it['grams']:>5} g {kcal:6.0f} kcal")
print(f"estimated total: {round(total, -1):.0f} kcal (portion sizes are estimates)")
Why the same question gives different answers
Run an identical nutrition prompt several times and figures shift. Part of this is sampling randomness; part is that the prompt leaves assumptions open, so the model fills them differently each time: activity level, body size, cooking method, portion size. Different models fill them differently again.
For an app, variability is a product problem. A user who sees a meal rated at one value on Monday and another on Tuesday stops trusting every number. Grounding solves most of this, because the database returns the same value for the same input.
State assumptions explicitly
If you do use model-generated guidance, make the model list the assumptions it used, and pass known user preferences explicitly. Visible assumptions let users spot when the answer does not apply to them.
Cache stable parses
Common meal descriptions recur. Caching the parsed structure for a given text gives consistent results and saves requests, which matters on rate-limited endpoints.
Show sources next to numbers
When a figure comes from your dataset, show where it came from in a tooltip or footnote. Users trust numbers more when they can see a source, and a visible source makes disputes easy to settle. It also reminds your team which values were measured and which were estimated.

Photos, labels and the limits of text-only models
Many people want to snap a plate and get calories. That requires a model that accepts images, and even then portion estimation from a single photo is hard: depth, plate size, hidden sauces and oil all matter. Some apps that guess calories from food photos are deliberately framed as games, which is an honest way to present a noisy estimate.
The keyless endpoint on this site is text only. If your pipeline starts from images, see how to handle images with a text-only API: use a separate recognition step or barcode lookup, then pass structured text to the language model. Barcode data from packaged food is far more reliable than any visual estimate.
Commercial multimodal models win here
Recognising dishes from images is an area where large commercial multimodal models are clearly ahead of small text-only ones. If photo input is essential, budget for a capable vision model and still ground the numbers in data.
Safety boundaries for health-adjacent features
Nutrition touches health, and some users are vulnerable. A responsible feature sets boundaries in code, not only in prompts. Detect and redirect requests involving medical conditions, very low calorie targets, eating disorder signals, pregnancy, infants and medication. For those, show a short, kind message encouraging a qualified professional.
Keep advice general and evidence-based, avoid diagnosing, and never present a model's output as personalised medical guidance. Write these rules into your product requirements so they survive prompt changes and model swaps.
Fewer refusals is not the goal here
The free-ai model refuses less than many commercial assistants, which suits creative and technical work. In a health-adjacent app that is exactly why your own guardrails matter: the model will often answer when a careful product should redirect.
Log what users ask
Reviewing anonymised question categories shows whether people use the feature as intended. If many ask about medical diets, your boundaries or onboarding need work.

Prototyping a nutrition assistant for free
The parsing and phrasing layers are a good fit for a free OpenAI-compatible endpoint while you design the product. The API at https://api.apikeyanthropicfree.com/v1 needs no key and serves free-ai, an independent open-weight model of about 35B parameters. This site is not affiliated with Anthropic, and the model is not Claude.
Within the per-IP limits of one request per second, bursts of three and a daily ceiling of 10,000 requests, you can parse a large test set of meal descriptions and measure how often the structure is valid. If you later need stronger parsing for unusual cuisines, compare against a commercial model on the same test set. For generating many pieces of food content, the patterns in generating and checking daily content also apply.
Measure parse validity, not eloquence
Track the share of outputs that are valid JSON, use only allowed food names and give plausible gram values. Those metrics predict real-world reliability far better than how convincing the explanations sound.
Send a test prompt from the chat box on the home page: no key, no account and no card, only the published per-IP limits.