The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
test(pricing): cover gpt-5.6 cache-cost plumbing and bedrock_mantle responses billing
mateo-berri3e3a35dabf78
diff --git a/tests/test_litellm/litellm_core_utils/llm_cost_calc/test_llm_cost_calc_utils.py b/tests/test_litellm/litellm_core_utils/llm_cost_calc/test_llm_cost_calc_utils.pyindex 3454f160cfa..ee5b618e9ea 100644--- a/tests/test_litellm/litellm_core_utils/llm_cost_calc/test_llm_cost_calc_utils.py+++ b/tests/test_litellm/litellm_core_utils/llm_cost_calc/test_llm_cost_calc_utils.py@@ -709,6 +709,49 @@ def test_generic_cost_per_token_gpt56_flex_above_272k(assert completion_cost == pytest.approx(standard_long_completion_cost / 2)+ "service_tier,prompt_tokens,input_rate,cache_write_rate,cache_read_rate",+ [+ (None, 100000, 2e-6, 2.5e-6, 2e-7),+ ("flex", 100000, 1e-6, 1.25e-6, 1e-7),+ ("priority", 100000, 4e-6, 5e-6, 4e-7),+ (None, 300000, 4e-6, 5e-6, 4e-7),+ ("flex", 300000, 2e-6, 2.5e-6, 2e-7),+ ],+)+def test_generic_cost_per_token_gpt56_terra_cache_costs_by_tier_and_context(+ service_tier, prompt_tokens, input_rate, cache_write_rate, cache_read_rate+):+ os.environ["LITELLM_LOCAL_MODEL_COST_MAP"] = "True"+ litellm.model_cost = litellm.get_model_cost_map(url="")++ cached_tokens = 50000+ cache_write_tokens = 40000+ text_tokens = prompt_tokens - cached_tokens - cache_write_tokens+ usage = Usage(+ prompt_tokens=prompt_tokens,+ completion_tokens=100,+ total_tokens=prompt_tokens + 100,+ prompt_tokens_details=PromptTokensDetailsWrapper(+ cached_tokens=cached_tokens, cache_write_tokens=cache_write_tokens+ ),+ )++ prompt_cost, _ = generic_cost_per_token(+ model="gpt-5.6-terra",+ usage=usage,+ custom_llm_provider="openai",+ service_tier=service_tier,+ )++ expected_prompt_cost = (+ text_tokens * input_rate+ + cached_tokens * cache_read_rate+ + cache_write_tokens * cache_write_rate+ )+ assert prompt_cost == pytest.approx(expected_prompt_cost)++@pytest.mark.parametrize("model,input_cost,output_cost,cache_read_cost",[diff --git a/tests/test_litellm/llms/bedrock_mantle/test_bedrock_mantle_responses_transformation.py b/tests/test_litellm/llms/bedrock_mantle/test_bedrock_mantle_responses_transformation.pyindex e808023debe..bea979aec64 100644--- a/tests/test_litellm/llms/bedrock_mantle/test_bedrock_mantle_responses_transformation.py+++ b/tests/test_litellm/llms/bedrock_mantle/test_bedrock_mantle_responses_transformation.py@@ -1534,6 +1534,39 @@ class TestBedrockMantleResponsesPricing:assert info["output_cost_per_token"] == pytest.approx(output_cost)assert info["max_input_tokens"] == 272000+ @pytest.mark.parametrize(+ "model, input_cost, output_cost",+ [+ ("openai.gpt-5.6-sol", 5.5e-06, 3.3e-05),+ ("openai.gpt-5.6-terra", 2.2e-06, 1.32e-05),+ ("openai.gpt-5.6-luna", 2.2e-07, 1.32e-06),+ ],+ )+ def test_gpt_5_6_responses_call_cost(self, local_cost_map, model, input_cost, output_cost):+ from litellm.types.llms.openai import ResponseAPIUsage, ResponsesAPIResponse++ input_tokens = 100000+ output_tokens = 10000+ response = ResponsesAPIResponse(+ id="resp-1",+ created_at=1700000000,+ model=model,+ output=[],+ usage=ResponseAPIUsage(+ input_tokens=input_tokens,+ output_tokens=output_tokens,+ total_tokens=input_tokens + output_tokens,+ ),+ )++ cost = litellm.completion_cost(+ completion_response=response,+ model=f"bedrock_mantle/{model}",+ custom_llm_provider="bedrock_mantle",+ )++ assert cost == pytest.approx(input_tokens * input_cost + output_tokens * output_cost)+def test_models_registered(self, local_cost_map):assert "bedrock_mantle/openai.gpt-5.5" in litellm.bedrock_mantle_modelsassert "bedrock_mantle/openai.gpt-5.4" in litellm.bedrock_mantle_models