Default-to-zero: a model-name mismatch silently wiped all LLM costs to $0
Atm1n9 · reddit · 2026-10-26
A dev building a tool that prices LLM API calls per feature, model, and customer hit a silent failure: the integration sent "gemini" but the price table stored models under "google", so the lookup failed, cost defaulted to $0, status said success, and nothing was logged. Costs are computed once at request time, so adding prices later didn't fix those rows.
Key insight: an overcharge gets noticed, but a zero looks like a free request — you only find out when the provider invoice disagrees.
Fixes applied:
- Explicit alias lists (gemini→google, claude→anthropic) instead of trusting callers
- Unknown models get an empty cost with an "unpriced" badge, never 0
- No fuzzy matching: gpt-4o is a prefix of gpt-4o-mini and they're priced differently
Suggested self-audit: count rows costing exactly $0 in your logs and check how many are genuinely free — default-to-zero is probably in a lot of codebases.
More from coding & agent
- How to get more ambitious with evals as models approach superhuman intelligence — shyamalanadkat · 2026-10-26
- Claude rebuilds a Gaussian-splatted garden scene in Blender with Geometry Nodes — CSProfKGD · 2026-10-26
- 50 agent runs, zero doc reads: five models pass tests but skip the documentation — ducha_aiki · 2026-10-26
- Every's 'frontier team' model: 100 AI experiments are useless if none land — every · 2026-10-26
- Fan-built AI site curates 250 best-under-$250 picks from 1,300 replies to Lenny's tweet — Scobleizer · 2026-10-26
- Nat Eliason shares deep-dive on how to set up your bot for maximum value — nateliason · 2026-10-26