test(pricing): cover gpt-5.6 cache-cost plumbing and bedrock_mantle responses billing - #35324
Merged
mateo-berri merged 1 commit intoJul 31, 2026
Merged
Conversation
Contributor
Greptile SummaryAdds focused regression coverage for GPT-5.6 billing:
Confidence Score: 5/5The PR appears safe to merge; the added tests exercise the intended pricing paths without changing production behavior The cache test reaches tier-specific and long-context cache pricing selection, while the Bedrock Mantle test uses the same provider-prefixed model and Responses API usage conversion used by production cost calculation
|
| Filename | Overview |
|---|---|
| tests/test_litellm/litellm_core_utils/llm_cost_calc/test_llm_cost_calc_utils.py | Adds exact cache-cost assertions across service-tier and context-size combinations using the calculator's expected OpenAI token accounting shape |
| tests/test_litellm/llms/bedrock_mantle/test_bedrock_mantle_responses_transformation.py | Adds Responses API completion-cost coverage for all registered Bedrock Mantle GPT-5.6 variants |
Reviews (1): Last reviewed commit: "test(pricing): cover gpt-5.6 cache-cost ..." | Re-trigger Greptile
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
tin-berri
approved these changes
Jul 31, 2026
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:
get_model_infothere (cache_creation_input_token_cost_flex/_priority, and the*_above_272k_tokens_flexcache variants) had no billing test; re-dropping them from the explicit kwargs list passed the whole suite/v1/responsescall against abedrock_mantlegpt-5.6 deployment end to end through the cost calculatorHow it solves it:
test_generic_cost_per_token_gpt56_terra_cache_costs_by_tier_and_contextbills a request with cache-read and cache-write tokens across five (service tier, context size) combinations and asserts the exact prompt cost. Mutation-verified: reverting the cache wiring inlitellm/utils.pyfails the flex, priority, and flex-long-context rowstest_gpt_5_6_responses_call_costruns aResponsesAPIResponsefor all three bedrock_mantle gpt-5.6 models throughlitellm.completion_costand asserts the exact spend at the corrected ratesThe standard above-272k cache-write row passes even without the explicit wiring because
_get_model_info_helperhas a regex passthrough for keys ending in_above_<n>k_tokens; tier-suffixed keys do not match it, which is exactly why the explicit wiring needs its own coverage.The remaining wired-but-untested fields (
cache_*_above_272k_tokens_priority) have no data in the cost map because OpenAI publishes no long-context column for the Fast tier, so there is no billing behavior to lock down.Relevant issues
Follow-up to #35270
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
@greptileaito re-request a review after pushing changes)Type
🧪 Tests
Changes
Test-only; no runtime code changes.