Repository navigation
fix(pricing): correct xai/grok-4.5 cached input price to $0.30/1M - #36090
AndrewAvery7 wants to merge 1 commit into
Conversation
xAI publishes grok-4.5 at $2.00 input / $0.30 cached / $6.00 output for short context, and $4.00 / $0.60 / $12.00 above the 200k long-context threshold (https://docs.x.ai/developers/pricing). The cached figures were recorded as $0.50 and $1.00 — 0.25x the input rate rather than the published numbers, a 67% overcharge on cached tokens. The cited source was the models page, which carries no cached column at all; the rates live on the pricing page, so the source is updated to match. Uncached rates were already correct and are unchanged. grok-4.3 in the same table is transcribed correctly ($0.20 / $0.40), which is what makes this a transcription error on one row rather than a misread column. Applied to both the map and its backup.
Greptile SummaryThe PR corrects cached-input pricing for the two xAI grok-4.5 model aliases and updates their pricing source. It also adds regression assertions covering cached and uncached rates.
Confidence Score: 4/5The pricing correction appears safe to merge after removing the newly added inline comments required by repository guidance. The canonical and backup pricing maps remain synchronized and the regression test verifies both corrected cached-price bands; the only accepted concern is a non-blocking repository-style violation in the test. Files Needing Attention: tests/test_litellm/llms/xai/test_xai_cost_calculator.py
|
| Filename | Overview |
|---|---|
| model_prices_and_context_window.json | Correctly updates both grok-4.5 cached-token price tiers and their authoritative source in the canonical pricing map. |
| litellm/model_prices_and_context_window_backup.json | Mirrors the canonical grok-4.5 pricing corrections in the packaged backup map. |
| tests/test_litellm/llms/xai/test_xai_cost_calculator.py | Adds focused pricing assertions, but two newly added inline comments conflict with repository guidance. |
Reviews (1): Last reviewed commit: "fix(pricing): correct xai/grok-4.5 cache..." | Re-trigger Greptile
| # Uncached rates were already correct; asserted here so a future | ||
| # edit cannot fix one column by breaking another. |
There was a problem hiding this comment.
These explanatory comments conflict with the repository guideline prohibiting new code comments unless explicitly requested, adding prose that maintainers require contributors to omit.
| # Uncached rates were already correct; asserted here so a future | |
| # edit cannot fix one column by breaking another. |
Context Used: CLAUDE.md (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
Superseded by rolling registry audit #37902, which reverified and absorbed the provider-documented metadata changes at field level |
Problem
xai/grok-4.5andxai/grok-4.5-latestovercharge cached tokens by 67%.xAI's pricing table lists, per 1M tokens:
The map had
cache_read_input_token_cost: 5e-07($0.50) andcache_read_input_token_cost_above_200k_tokens: 1e-06($1.00) — both exactly 0.25× the input rate, rather than the published figures.Why I'm confident this is a transcription error and not my misreading the columns
grok-4.3in the adjacent row is already correct here (2e-07/4e-07= $0.20 / $0.40), and it comes from the same table with the same column layout. Same columns, right answer — so the layout reading is confirmed by the file itself.2e-06/6e-06short,4e-06/1.2e-05long. Only the two cached fields diverge."source": "https://docs.x.ai/docs/models", which lists context windows and capabilities and has no cached-price column at all. The cached values appear to have been inferred as 0.25× input rather than read. This PR repointssourceat/developers/pricing, where the figures actually live.Changes
Four values across two model keys, applied to both
model_prices_and_context_window.jsonandlitellm/model_prices_and_context_window_backup.json:Uncached rates are untouched.
Test
Adds
test_grok_4_5_cached_input_matches_published_pricingto the existingtests/test_litellm/llms/xai/test_xai_cost_calculator.py. It pins both cached bands to the published figures, and also asserts the four uncached rates so a later edit cannot correct one column by breaking another. The assertion fails against the previous values.Scope
Deliberately one problem. I also noticed
deepseek-v4-*carriesmax_output_tokens: 8192against DeepSeek's published 384K — but #31018, #32107 and #32417 already propose that fix, so it is not bundled here.