Skip to content

fix(xai): correct grok-4.5 cached-input pricing - #36413

Closed
AndrewAvery7 wants to merge 1 commit into
BerriAI:litellm_internal_stagingfrom
AndrewAvery7:fix/grok-4-5-cache-pricing
Closed

AndrewAvery7 wants to merge 1 commit into
BerriAI:litellm_internal_stagingfrom
AndrewAvery7:fix/grok-4-5-cache-pricing

Conversation

@AndrewAvery7

Copy link
Copy Markdown

What changed

xai/grok-4.5 and xai/grok-4.5-latest have stale cached-input prices:

field before after
cache_read_input_token_cost (base tier, <200k tokens) 5e-07 ($0.50/1M) 3e-07 ($0.30/1M)
cache_read_input_token_cost_above_200k_tokens (long-context tier, ≥200k tokens) 1e-06 ($1.00/1M) 6e-07 ($0.60/1M)

Base input_cost_per_token / output_cost_per_token (and their _above_200k_tokens counterparts) were already correct and are untouched.

Sources checked 2026-08-10

All three currently agree on $0.30 / $0.60 for cached input.

How this was found

Cross-checking a hand-verified pricing catalog (input/output/cache rates confirmed independently against vendor docs) against this feed. Every other field on these two entries matched; only the cached-input rates had drifted.

cache_read_input_token_cost was 5e-07 ($0.50/1M) and
cache_read_input_token_cost_above_200k_tokens was 1e-06 ($1.00/1M).
xAI's current pricing page lists $0.30/1M and $0.60/1M respectively
for these two tiers; base input/output pricing was already correct.

Verified 2026-08-10 against:
- https://docs.x.ai/developers/pricing
- https://docs.x.ai/developers/models/grok-4.5
- https://docs.x.ai/docs/models (this entry's own `source` field)

All three currently agree on $0.30 / $0.60.
@CLAassistant

CLAassistant commented Aug 10, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@greptile-apps

greptile-apps Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Corrects cached-input token prices for the base and long-context tiers of both Grok 4.5 aliases.

  • Lowers base cached-input pricing from $0.50 to $0.30 per million tokens.
  • Lowers above-200k cached-input pricing from $1.00 to $0.60 per million tokens.
  • Leaves the bundled fallback cost map unchanged, causing environment-dependent pricing.

Confidence Score: 4/5

The fallback cost map must be synchronized before merging because supported local and remote-failure paths still apply the stale Grok 4.5 cached-input prices.

The primary catalog has the corrected prices, but fallback loading uses an unchanged bundled catalog and therefore records inflated cached-input spend for both aliases under supported configurations.

Files Needing Attention: model_prices_and_context_window.json and litellm/model_prices_and_context_window_backup.json

Important Files Changed

Filename Overview
model_prices_and_context_window.json The primary Grok 4.5 prices are corrected, but the corresponding bundled fallback entries remain stale.

Reviews (1): Last reviewed commit: "fix(xai): correct grok-4.5 cached-input ..." | Re-trigger Greptile

Comment on lines +40195 to +40196
"cache_read_input_token_cost": 3e-07,
"cache_read_input_token_cost_above_200k_tokens": 6e-07,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Fallback pricing remains stale

If LiteLLM uses LITELLM_LOCAL_MODEL_COST_MAP=True or falls back after a remote cost-map fetch or validation failure, the bundled map still charges cached input for both Grok 4.5 aliases at $0.50/$1.00 per million tokens instead of the corrected $0.30/$0.60, inflating recorded spend and budget consumption.

Knowledge Base Used: Cost Tracking and Budget Enforcement

@codecov

codecov Bot commented Aug 10, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@devin-ai-integration

Copy link
Copy Markdown
Contributor

The base branch already contains this change (verified against the official provider docs); registry consolidation is tracked in the rolling PR #38990. Closing as superseded.

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