fix(usage): never record a placeholder $0 over a resolved model price (#201924) ## Problem A turn's recorded cost could be `$0` for a model that has a real price. The aggregate cost owner (`src/utils/usage-format.ts`, `estimateUnpricedAggregateUsageCost`) returned the transport's summed `usage.cost.total` whenever the pricing owner resolved a price. When the transport billed from a placeholder (a manifest zero or a live-discovery zero), that sum is an all-zero adapter default. `hasRecordedUsageCost` already treats it as not price evidence, but this line still returned it. The line came from #111175, which intended to keep authored free prices at `$0`. That case does not need it: estimating with an authored zero price already gives `$0`. The same owner also refused every tiered price for run totals. Codex runtime turns carry no transport cost, so tiered OpenAI models (GPT-6.x) on Codex recorded no cost at all. ## Fix At the single owner: - An all-zero transport cost no longer outranks the resolved price. Authored `cost: 0` and provider-billed zero still record `$0`. - A tiered run total is priced when its summed prompt stays below the second tier. Every call was then in the first tier, so the estimate is exact. This is the rule the transcript rollup already uses. Above that boundary, the estimate stays omitted. - The worker inference diagnostic path had the same "transport zero wins" shape (`usage.cost?.total ?? estimate`). It now uses a recorded cost only when it is real price evidence. `docs/cli/agent.md` describes the new behavior. ## Evidence **Contract guard (committed):** `completed-usage.pricing-contract.test.ts` prices every enabled bundled manifest row, plus a hosted-only live-listed ID per provider, from a hosted v3 catalog newer than the build. For each one, it checks that the recorded turn cost with an all-zero transport cost equals the hosted price, and that the runtime row the transport bills from carries it. It also checks that an authored zero records `$0`. The guard fails on main with all 352 rows recording `0` and passes on this branch. **Real hosted v3 catalog (2266 priced keys, 46 providers), with recorded turn cost from an all-zero transport cost:** | | wrong $0 | exact | unknown | |---|---|---|---| | main | 2020 | 0 | 246 | | this PR | 0 | 1996 | 270 | Unknown on this PR: 246 `vercel-ai-gateway` rows that the pricing owner never receives (a separate cause, listed below) and 24 tiered rows whose second tier starts below the 100k-token probe. **Real-key Gateway E2E** (isolated builds of main and this branch, loopback candidate catalog newer than both builds, stored session `estimatedCostUsd`): | model | runtime | main | this PR | |---|---|---|---| | google/gemini-4-neon | openclaw | $0.052161 | $0.050169 | | google/gemini-4-argon | openclaw | $0.02341 | $0.02338 | | openai/gpt-5-mini | codex | $0.006244 | $0.006156 | | openai/gpt-6.2-sol (tiered) | codex | none | $0.050399 | | openai/gpt-6.2-astra (tiered) | codex | none | $0.200996 | | anthropic/claude-haiku-4-5 | openclaw | $0.024673 | $0.015589 | | moonshot/kimi-k2.6 | openclaw | $0.014720 | $0.013159 | | tencent-tokenhub/hy4-flash (live-listed, TLS mock) | openclaw | $2.105e-6 | $2.105e-6 | | google/gemini-4-argon with authored `cost: 0` | openclaw | $0 | $0 | Each branch value matches catalog price × tokens. Through the Gateway, main already prices most transports, because `withResolvedPricing` gives the transport the owner's price. So main differs only where the transport has no real price: Codex tiered models here, and every release without that runtime step (2026.11.5 and 2026.10.33 recorded `$0` for these Gemini models). A Groq run failed on both arms because the provider rejected the API key. ## Not in this PR - `openclaw agent --local` captures the remote catalog snapshot before it is prepared (`src/agents/prepared-model-runtime.plugin-generation.ts:170`; the Gateway prepares it at boot in `src/gateway/server-kernel.ts:151`). Local runs therefore price without the hosted catalog. The owner never receives the hosted data, so this is a different bug. - A manifest provider with no static models is dropped (`packages/model-catalog-core/src/model-catalog-normalize.ts:512`), so `vercel-ai-gateway` hosted rows are never admitted and record no price (not `$0`). ## Size Production +17/−6 across two files. The rest is tests and one doc line. <!-- openclaw-publication:1cd20444-5317-8ce4-86e3-75ee5e4ba932 --> Co-authored-by: Ayaan Zaidi <hi@obviy.us>
Current
·
C2
·2026-11
fix(usage): never record a placeholder $0 over a resolved model price…
Find Your Interest
- Get $400 off the first Vaonis Vespera Pro model ahead of Black Friday — only eight left in stock
- fix: let models listing none reasoning run on native Codex (#198387)
- fix: let the hosted model catalog publish again with the 2026.10.33 e…
- fix(talk): reduce transcription catalog refresh work (#201702)
- fix: keep the channel message id on oversized chat history messages (…
- feat(talk): report which speech-to-text path talk.catalog uses
- Introducing the Amazon SageMaker JumpStart Model Leaderboard
- How Airbnb uses cost per task to operate coding agents on Amazon Bedrock
- Microsoft (MSFT) Stock: New AI Model Takes Aim at Anthropic and OpenAI on Price
- fix(openai): new ChatGPT subscription models missing until an OpenCla…
Current
·
C2
·2026-11






