Skip to content

Price gpt-5.2/5.4/5.5 and Gemini at their real rates via llm-prices - #28

Closed
Mattbusel wants to merge 1 commit into
RutaTang:mainfrom
tensorust-ai:deps/llm-prices-current-rates
Closed

Mattbusel wants to merge 1 commit into
RutaTang:mainfrom
tensorust-ai:deps/llm-prices-current-rates

Conversation

@Mattbusel

Copy link
Copy Markdown

The usage ledger undercounts the newest OpenAI models and leaves Gemini unpriced. A prefix table that ends at gpt-5 is the wrong shape for a model line that ships a new point release every few months: every one of them silently inherits the oldest price.

The bug. builtin_price in src/app/usage.rs matches PRICES by model-id start, and the OpenAI rows stop at gpt-5-nano, gpt-5-mini and gpt-5 ($1.25 in / $10 out). So:

model billed as actual (OpenAI pricing page) undercount
gpt-5.2 $1.25 / $10 $1.75 / $14 1.4x
gpt-5.4 $1.25 / $10 $2.50 / $15 2x in, 1.5x out
gpt-5.5 $1.25 / $10 $5.00 / $30 4x in, 3x out

There are no Gemini rows at all, so gemini-2.5-pro, gemini-2.5-flash and the 3.x models show as unpriced.

The fix. builtin_price now asks llm-prices first (llm_prices::lookup), which resolves dated snapshots, models/ and openai/ style prefixes, and keeps separate rows for each point release, each with its source URL and the date it was checked. A row without an input and output rate is skipped, and a missing cache rate falls back to the input rate, as Clew's own form already does. Clew's existing table stays as the fallback, so every id it priced before still resolves (including anthropic/claude-3.5-haiku:beta), the reader's [prices] overrides still win via price_of, and the 1.25x cache-write multiplier is unchanged.

llm-prices has no dependencies of its own (its optional features are off), so this adds one small crate to the build.

Tests. a_model_is_priced_by_its_family keeps every existing assertion and adds gpt-5.5 (5 / 0.5 / 30), openai/gpt-5.4, gpt-5.2, a check that plain gpt-5 is still $1.25, and Gemini 2.5 Pro and Flash. cargo test --bin clew usage:: passes and cargo fmt --check is clean.

Disclosure: I'm Matthew Busel and I maintain llm-prices. Happy to drop the dependency and just extend the table instead if you would rather own the rows; the point is that gpt-5.x and Gemini are currently mispriced.

The prefix table ended its OpenAI rows at gpt-5, so every gpt-5.x point
release was billed at gpt-5's rate (gpt-5.5 at a quarter of its input
price), and Gemini had no rows. builtin_price now reads llm-prices first
and keeps Clew's table as the fallback.

Copy link
Copy Markdown
Owner

Thanks for the PR and for the clear disclosure about maintaining llm-prices. We've decided not to add it as a dependency, so I'm closing this. The gpt-5.x and Gemini pricing gap you pointed out is noted.


Generated by Claude Code

@RutaTang RutaTang closed this Nov 21, 2026
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