fix(pricing): correct gpt-5.6 prices for openai, bedrock, and flex long context - #35270
Merged
mateo-berri merged 5 commits intoJul 31, 2026
Merged
Conversation
…to OpenAI's latest article (#35258) Adjust the price of gpt-5.6-terra to 80% of its original rate (2/12), and gpt-5.6-luna to 20% of its original rate (0.2/1.2). References: https://openai.com/index/advancing-the-price-performance-frontier-with-gpt-5-6/ https://developers.openai.com/api/docs/pricing
mubashir1osmani
marked this pull request as ready for review
July 30, 2026 20:13
Contributor
Greptile SummaryUpdates GPT-5.6 pricing and carries new long-context Flex rates through cost calculation.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| model_prices_and_context_window.json | Updates GPT-5.6 OpenAI and Bedrock Mantle rates and defines Flex rates above the 272k-token threshold. |
| litellm/model_prices_and_context_window_backup.json | Mirrors the GPT-5.6 pricing updates from the primary cost map. |
| litellm/types/utils.py | Extends model-info and custom-pricing types with cache and token pricing fields for long-context Flex requests. |
| litellm/utils.py | Preserves the newly supported pricing fields when constructing model metadata from the cost map. |
| model_prices_and_context_window.schema.json | Adds numeric schema definitions for the new long-context Flex pricing fields. |
| tests/test_litellm/litellm_core_utils/llm_cost_calc/test_llm_cost_calc_utils.py | Updates GPT-5.6 expected rates and verifies Flex pricing for prompts above 272k tokens. |
| tests/test_litellm/llms/bedrock_mantle/test_bedrock_mantle_responses_transformation.py | Updates Bedrock Mantle GPT-5.6 pricing expectations. |
| tests/test_litellm/test_utils.py | Extends model-cost validation coverage to the newly exposed pricing fields. |
Reviews (3): Last reviewed commit: "fix(pricing): regenerate model prices sc..." | Re-trigger Greptile
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Contributor
PR overviewAll previously flagged issues have been addressed. No open security concerns remain on this pull request. Security reviewNo open security issues remain on this pull request. Fixed/addressed: 1 · PR risk: 0/10 |
mubashir1osmani
marked this pull request as draft
July 30, 2026 20:18
…OpenAI's cut AWS rolled out the 2026-07-30 GPT-5.6 price cut the same day, but the bedrock_mantle entries still carried values derived from the pre-cut OpenAI base, so Terra billed 1.25x and Luna 5x over the published rate. Re-derive both from the AWS Bedrock pricing page, which prices in-region inference at parity with OpenAI's data residency tier (1.1x base). Sol was not cut and is unchanged. Also drop tests/test_litellm/test_gpt_5_6_model_metadata.py; its Azure and openai pricing assertions are covered by test_llm_cost_calc_utils.py.
…context rate OpenAI publishes a long-context column on the Flex tier, at half the standard long-context rate. We had no field for it, so a >272k flex request fell through to the standard long-context price and billed 2x: Terra $4/$18 instead of $2/$9, Luna $0.40/$1.80 instead of $0.20/$0.90, Sol $10/$45 instead of $5/$22.50. Adding the values to the cost map alone does nothing, because get_model_info builds ModelInfoBase from an explicit kwargs list and silently drops any key not named there. Declare the four *_above_272k_tokens_flex fields and wire them through, then add the values for sol, terra, luna, and the gpt-5.6 alias. That same gap was already swallowing cache_creation_input_token_cost_flex, _priority, and _above_272k_tokens, which were present in the cost map but never reached the calculator; they are wired through here too. Fast mode (ex-Priority) publishes no long-context column, so nothing is added there rather than deriving a rate by analogy.
mateo-berri
marked this pull request as ready for review
July 31, 2026 04:17
Contributor
mateo-berri
enabled auto-merge
July 31, 2026 04:35
mateo-berri
disabled auto-merge
July 31, 2026 04:35
This was referenced Jul 31, 2026
This was referenced Jul 31, 2026
6 tasks
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TLDR
Problem this solves:
How it solves it:
Relevant issues
Linear ticket
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
@greptileaito re-request a review after pushing changes)Delays in PR merge?
If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).
Screenshots / Proof of Fix
Pending; see the QA runbook below for the commands to run against a live proxy
Type
🐛 Bug Fix
Changes
Three separate problems, all in GPT-5.6 pricing.
The openai entries came first. Every cost field on
gpt-5.6-terraandgpt-5.6-lunanow matches https://developers.openai.com/api/docs/pricing across the Standard, Batch, Flex, and Fast (ex-Priority) tiers and both context columns. Terra is $2.00 in / $12.00 out, Luna is $0.20 in / $1.20 out per 1M, with cache writes at 1.25x input and cache reads at 0.1x.gpt-5.6-solwas not cut and its base prices are unchanged.The
bedrock_mantleentries were stale. They had been derived from the pre-cut base at a 1.375x (Terra) and 5.5x (Luna) uplift and never re-derived, so Terra billed $2.75/$16.50 and Luna billed $1.10/$6.60 against AWS's published $2.20/$13.20 and $0.22/$1.32; a 1.25x overcharge on Terra and 5x on Luna. AWS states in-region inference is priced at parity with OpenAI's data residency tier, so all three now sit at a consistent 1.1x over base. Sol already did, which is why it needed no change and corroborates the multiplier.The flex long-context gap is the subtlest of the three. OpenAI publishes a long-context column on the Flex tier at half the standard long-context rate, but there was no field for it, so a >272k flex request fell back to the standard long-context price and billed double: Terra $4/$18 instead of $2/$9, Luna $0.40/$1.80 instead of $0.20/$0.90, Sol $10/$45 instead of $5/$22.50. Adding the numbers to the cost map is not enough on its own;
get_model_infobuildsModelInfoBasefrom an explicit kwargs list and silently drops any key not named there, so the four*_above_272k_tokens_flexfields are declared and wired through as well. Worth knowing for anyone adding pricing fields in future: a JSON-only change can look correct and do nothing.Wiring that up surfaced a pre-existing instance of the same bug.
cache_creation_input_token_cost_flex,cache_creation_input_token_cost_priority, andcache_creation_input_token_cost_above_272k_tokenswere all present in the cost map but never reached the calculator; they are wired through here too.Fast mode (ex-Priority) publishes no long-context column at all, so nothing is added there rather than deriving a rate by analogy from the 2x short-context relationship.
Azure is deliberately left at its pre-cut $2.50/$15.00 and $1.00/$6.00. Azure's pricing page lists the GPT-5.6 series but renders every figure as a placeholder dash because rates load per region and currency, so whether Microsoft passed the cut through is unconfirmed. Holding the old value risks overcharging; guessing the new one risks undercharging and diverging from the actual bill. Worth a follow-up from someone who can read the live page with a region selected.
tests/test_litellm/test_gpt_5_6_model_metadata.pyis removed; its openai and Azure pricing assertions duplicatetest_llm_cost_calc_utils.py, which still covers the Azure global and us/eu regional 1.1x rows.One number to eyeball before merging: the AWS table labels its cache-write column "30m cache write".
cache_creation_input_token_costholds a single value and $2.75 / $0.275 is the 30-minute figure, consistent with the 1.25x-input convention used elsewhere.QA runbook
Set
LITELLM_LOCAL_MODEL_COST_MAP=Trueon the proxy before checking any of this. With it unset or false, litellm fetches the cost map over the network at import and ignores the local JSON, so a spot check reads the old prices and this branch looks like it changed nothing.LITELLM_LOCAL_MODEL_COST_MAP=True python litellm/proxy/proxy_cli.py --config litellm/proxy/dev_config.yaml --detailed_debug --reload --use_v2_migration_resolver 2>&1 | tee litellm.logcurl -s http://localhost:4000/v1/chat/completions -H "Authorization: Bearer sk-1234" -H "Content-Type: application/json" -d "{\"model\": \"gpt-5.6-terra\", \"service_tier\": \"flex\", \"messages\": [{\"role\": \"user\", \"content\": \"$(python3 -c 'print("word "*300000)')\"}]}" | jq '{model, usage}'curl -s "http://localhost:4000/spend/logs?request_id=<id>" -H "Authorization: Bearer sk-1234" | jq '.[0] | {model, spend, prompt_tokens, completion_tokens}'service_tiergpt-5.6-solstill bills $5/$30 per 1M, unchanged by this PR/v1/responsescall to abedrock_mantle/openai.gpt-5.6-lunadeploymentbedrock_mantle/openai.gpt-5.6-solis unchanged at $5.50/$33.00Final Attestation