Skip to content

fix: surface unknown pricing instead of misleading $0.0000 - #175

Open
alexdim wants to merge 2 commits into
dirac-run:masterfrom
alexdim:fix/fu10-cost-unknown-pricing
Open

fix: surface unknown pricing instead of misleading $0.0000#175
alexdim wants to merge 2 commits into
dirac-run:masterfrom
alexdim:fix/fu10-cost-unknown-pricing

Conversation

@alexdim

@alexdim alexdim commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

What

  • isFreeModel: true only when inputPrice === 0 && outputPrice === 0
  • getCostLabel: n/a | FREE | $X.XXXX (paid with no usage → $0.0000)
  • Regression: paid model + totalCost === 0$0.0000, not FREE
  • Cost calc returns undefined when pricing unknown (not 0)

Why

hasPricing() means prices exist, not free. Paid models started at totalCost === 0 and were labeled FREE until the first billed response.

Notes / Caveats

  • Addresses CHANGES_REQUESTED on this PR
  • Pre-existing biome Thumbnails indent in TaskHeader.tsx (also on master) left alone
  • Pre-existing root tsc error in src/shared/storage/types.ts on master (delta 0)

Verification

  • tsc delta vs master: 0 new errors (1 pre-existing on both)
  • biome: no new errors on touched files
  • mocha src/utils/cost.test.ts: 21 passing
  • vitest getCostLabel.test.ts: 5 passing

User test

  1. Paid model (e.g. Claude) before first response → $0.0000, not FREE
  2. Explicit free model (inputPrice/outputPrice 0) → FREE
  3. Unknown-pricing custom model → n/a
  4. After billed usage on paid model → $X.XXXX

Alexandros Salapatas

@alexdim
alexdim force-pushed the fix/fu10-cost-unknown-pricing branch from 4ed89f1 to cd2bb15 Compare August 10, 2026 23:35

@dirac-run dirac-run left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hasPricing() only means that at least one price is known; it does not mean the model is free. Since totalCost starts at zero, this labels ordinary paid models as FREE until their first billed response. Please render a neutral $0.0000 state for known nonzero pricing and reserve FREE for explicitly zero-priced models. A regression test for a paid model with totalCost === 0 would cover this.

Alexandros Salapatas added 2 commits August 12, 2026 14:21
calculateApiCostInternal silently returned 0 when inputPrice/outputPrice
were missing, making unknown pricing indistinguishable from genuinely
free models. This caused the UI to show a misleading $0.0000 for custom
OpenAI-compatible endpoints, uncached LiteLLM, Dify, and other unpriced
providers.

Return undefined when no pricing data is present; keep returning 0 for
explicitly-zero prices (genuinely free local models). Remove hardcoded
inputPrice/outputPrice: 0 from openAiModelInfoSaneDefaults and
liteLlmModelInfoSaneDefaults so unknown models fall through to undefined.

Export hasPricing to @shared/api so the webview can use it. TaskHeader
now renders three states: $X.XX (charged), FREE (explicitly free model),
n/a (unknown pricing). HistoryViewItem shows — instead of $0.0000.

FU-10 · private/review/RCA-COST-000.md
hasPricing means prices exist, not free. Paid models with
totalCost 0 were labeled FREE until first bill.

- isFreeModel: inputPrice===0 && outputPrice===0
- getCostLabel: n/a | FREE | $X.XXXX ($0.0000 unpaid)
- regression: paid + totalCost 0 → $0.0000
@alexdim
alexdim force-pushed the fix/fu10-cost-unknown-pricing branch from cd2bb15 to b87cf07 Compare August 12, 2026 11:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants