fix(model_prices): add bedrock_mantle gpt-5.5/5.4 272K tiers, align sol with AWS invoice - #38615
Conversation
…ol with AWS invoice AWS bills a Bedrock GPT-5.5 or GPT-5.4 prompt past 272K tokens under the long-context usage types for the whole prompt, at 2x input, 2x cache read, and 1.5x output, and the cost map only had the flat rates, so a 300K prompt was logged at half of what the invoice charges. The map's promo rates for gpt-5.6-sol are 20% under the $5.50 input, $33.00 output, $0.55 cache read, and $6.88 cache write per million the invoice bills. Adds the *_above_272k_tokens fields to gpt-5.5 and gpt-5.4, moves sol's base and tier rates to the invoiced ones, replaces the test that pinned the flat behaviour with one that pins the invoiced numbers, and updates the sol pins in the mantle transformation tests
Greptile SummaryThe PR aligns Bedrock Mantle GPT-5 pricing with observed AWS invoice rates.
Confidence Score: 5/5The PR appears safe to merge with the pricing maps synchronized and the revised base and long-context behavior covered by tests. The metadata keys match the generic threshold-pricing contract, both runtime map copies agree, and no concrete changed-code failure remains.
|
| Filename | Overview |
|---|---|
| model_prices_and_context_window.json | Updates the canonical Bedrock Mantle GPT-5.4, GPT-5.5, and GPT-5.6 Sol pricing entries consistently with the intended invoice rates. |
| litellm/model_prices_and_context_window_backup.json | Mirrors the canonical pricing changes in the bundled runtime fallback map without divergence. |
| tests/test_litellm/litellm_core_utils/llm_cost_calc/test_llm_cost_calc_utils.py | Replaces the obsolete flat-rate expectation with base-boundary and long-context cost assertions and adds Sol cache-write rate coverage. |
| tests/test_litellm/llms/bedrock_mantle/test_bedrock_mantle_responses_transformation.py | Updates Bedrock Mantle model-info and end-to-end response cost expectations for the revised Sol rates. |
Reviews (1): Last reviewed commit: "fix(model_prices): add bedrock_mantle gp..." | Re-trigger Greptile
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
bugbot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 837bcba. Configure here.
3a52ae0
into
litellm_internal_staging
TLDR
Problem this solves:
How it solves it:
*_above_272k_tokensinput, output, and cache-read rates to gpt-5.5 and gpt-5.4User Flow
Before: a platform team reconciling gateway spend against its AWS bill finds Bedrock GPT-5.5 long prompts logged at half of what AWS charges, and Sol at 20% under
"model": "mantle-55"(abedrock_mantle/openai.gpt-5.5deployment) and a 300K-token inputusage.input_tokens: 301016, and the response headers sayx-litellm-response-cost-input: 1.655588, $5.50 per million for the whole promptmantle-54(bedrock_mantle/openai.gpt-5.4) comes back withx-litellm-response-cost-input: 0.827794, $2.75 per millionmantle-sol(bedrock_mantle/openai.gpt-5.6-sol) with 16 input and 5 output tokens returnsx-litellm-response-cost-input: 7.04e-05andx-litellm-response-cost-output: 0.00011, $4.40 and $22.00 per millioninput_tokens_long_ctx_standardat $11.00 per million (gpt-5.5) and $5.50 (gpt-5.4), and Sol at $5.50 input and $33.00 output, so the gateway under-reports the gpt-5.5 prompt by $1.66 and every Sol call by 20%After: the same calls come back priced at what the AWS invoice charges
"model": "mantle-55"and the 300K-token inputusage.input_tokens: 301015, and nowx-litellm-response-cost-input: 3.311165, $11.00 per million for the whole promptmantle-54comes back withx-litellm-response-cost-input: 1.6555825, $5.50 per millionmantle-solreturnsx-litellm-response-cost-input: 8.8e-05andx-litellm-response-cost-output: 0.000165, $5.50 and $33.00 per millionRelevant issues
Linear ticket
Resolves LIT-6356
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
uv run pytest tests/test_litellm/<your_test_file>.py -v. Leave the suites (make test-unit-*,make test-unit) to CI: it finishes in ~15 minutes where a laptop takes an hour or more@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
Shared setup: each leg is its own DB-less proxy booted with 2 uvicorn workers (
python litellm/proxy/proxy_cli.py --config lit6356_config.yaml --port <port> --num_workers 2) from a worktree at that leg's commit, withLITELLM_LOCAL_MODEL_COST_MAP=TrueandAWS_BEARER_TOKEN_BEDROCKfor the Bedrock CI account, on this config. The streaming case that closes each side ran on a separate DB-backed proxy (real Postgres, same config, 2 workers): base on port 43917, head on port 41873The 300K bodies carry the same plain-text filler prompt on every endpoint (it asks for the single word "pong"), prefixed with a per-leg nonce so Bedrock's prompt cache stays cold: every call below reports
cached 0.responses_*.jsonputs it in the Responsesinputstring,chat_54.jsonin a chatmessageslist, andmessages_54.jsonin an Anthropicmessageslist withmax_tokens: 64. Each step runscurl -s -D hdr.txt -o out.json -w "http %{http_code}\n" <route> -H 'Authorization: Bearer sk-1234' -H 'Content-Type: application/json' --data-binary @<body>and then printsgrep -i 'x-litellm-response-cost' hdr.txtand theusageobject fromout.jsonWhat AWS bills the same account, from Cost Explorer for 2026-08-24 to 08-26: gpt-5.5
input_tokens_long_ctx_standard$11.00 per million andoutput_tokens_long_ctx_standard$49.50, gpt-5.4 $5.50 and $24.75, solinput_tokens_standard$5.50, output $33.00, cache read $0.55, cache write 30m $6.88Before (98c5233)
gpt-5.5, 300K prompt, POST /v1/responses
curl ... http://localhost:42685/v1/responses --data-binary @lit6356_qa_before_responses_55.jsongpt-5.4, 300K prompt, POST /v1/responses
curl ... http://localhost:42685/v1/responses --data-binary @lit6356_qa_before_responses_54.jsongpt-5.4, 300K prompt, POST /v1/chat/completions
curl ... http://localhost:42685/v1/chat/completions --data-binary @lit6356_qa_before_chat_54.jsongpt-5.4, 300K prompt, POST /v1/messages
curl ... http://localhost:42685/v1/messages --data-binary @lit6356_qa_before_messages_54.jsongpt-5.6-sol, short prompt, POST /v1/responses
curl ... http://localhost:42685/v1/responses -d '{"model":"mantle-sol","input":"Reply with exactly the word pong and nothing else."}'gpt-5.4, 300K prompt, POST /v1/chat/completions with
stream: true, then GET /spend/logscurl -N ... http://localhost:43917/v1/chat/completions --data-binary @lit6356_risk_base_stream_chat_54.json(the chat_54 body plus"stream": trueand"stream_options": {"include_usage": true})curl -s "http://localhost:43917/spend/logs?request_id=<the row's resp_... id, from http://localhost:43917/ui/?page=logs>" -H 'Authorization: Bearer sk-1234'After (837bcba)
gpt-5.5, 300K prompt, POST /v1/responses
curl ... http://localhost:42414/v1/responses --data-binary @lit6356_qa_after_responses_55.jsongpt-5.4, 300K prompt, POST /v1/responses
curl ... http://localhost:42414/v1/responses --data-binary @lit6356_qa_after_responses_54.jsongpt-5.4, 300K prompt, POST /v1/chat/completions
curl ... http://localhost:42414/v1/chat/completions --data-binary @lit6356_qa_after_chat_54.jsongpt-5.4, 300K prompt, POST /v1/messages
curl ... http://localhost:42414/v1/messages --data-binary @lit6356_qa_after_messages_54.jsongpt-5.6-sol, short prompt, POST /v1/responses
curl ... http://localhost:42414/v1/responses -d '{"model":"mantle-sol","input":"Reply with exactly the word pong and nothing else."}'gpt-5.4, 300K prompt, POST /v1/chat/completions with
stream: true, then GET /spend/logscurl -N ... http://localhost:41873/v1/chat/completions --data-binary @lit6356_risk_head_stream_chat_54.json(the chat_54 body plus"stream": trueand"stream_options": {"include_usage": true})curl -s "http://localhost:41873/spend/logs?request_id=<the row's resp_... id, from http://localhost:41873/ui/?page=logs>" -H 'Authorization: Bearer sk-1234'Observations from the run:
/v1/messagesusage omitscache_read_input_tokens; this PR leaves it alonecached 0request_idis theresp_id on both legsType
🐛 Bug Fix
Caveats (if any)
Medium
us.openai.gpt-5.6-solandglobal.openai.gpt-5.6-solkeep the promo rates, no invoice data for themLow
make checkgates none of these files; ruff on the two test files reports only pre-existing findingsFinal Attestation
The tests check the right things, including the edge cases, and regressions in the respective real-world customer use-cases are not possible after this PR
837bcba passes /live-pr-risk