Skip to content

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]

test(cost): rekey vertex gemini, add bedrock mantle gpt and claude-opus-5-5, drop suite-only price fields (#46962)

devin-ai-integration[bot]33b73207e348
diff --git a/tests/integration/cost_calculation/cases/azure.py b/tests/integration/cost_calculation/cases/azure.py
index 3df038d1e0e..1360f65b802 100644
--- a/tests/integration/cost_calculation/cases/azure.py
+++ b/tests/integration/cost_calculation/cases/azure.py
@@ -23,8 +23,18 @@ from integration.cost_calculation.bridge_cost_parity.case import BridgeCostParit
from integration.cost_calculation.stream_parity.case import StreamParityTestCase, sse_frames
-def _response_for_model(response: JsonResponse, model: str) -> JsonResponse:
- return response.model_copy(update={"body": {**response.body, "model": model}})
+def _response_for_model(
+ response: JsonResponse, model: str, *, service_tier: str | None = None
+) -> JsonResponse:
+ return response.model_copy(
+ update={
+ "body": {
+ **response.body,
+ "model": model,
+ **({"service_tier": service_tier} if service_tier is not None else {}),
+ }
+ }
+ )
def _stream_for_model(response: SseResponse, model: str) -> SseResponse:
@@ -3618,10 +3628,12 @@ AZURE_GPT_6_LUNA_STREAM: Final = CostTrackingTestCase(
),
)
-AZURE_GPT_6_LUNA_SERVICE_TIER_FLEX: Final = CostTrackingTestCase(
- name="azure-gpt-6-luna-service_tier_flex",
+
+
+AZURE_GPT_6_ASTRA_INPUT_TEXT: Final = CostTrackingTestCase(
+ name="azure-gpt-6-astra-input_text",
covers="quota_management.spend_tracking.cost_matrix.logs_cost",
- model="azure/gpt-6-luna",
+ model="azure/gpt-6-astra",
request={
"model": "$MODEL",
"messages": [
@@ -3639,13 +3651,12 @@ AZURE_GPT_6_LUNA_SERVICE_TIER_FLEX: Final = CostTrackingTestCase(
"content": [
{
"type": "text",
- "text": "895f84528ea4 summarize the attached material in one line and name the city weather",
+ "text": "41ccdf63f9d7 summarize the attached material in one line and name the city weather",
}
],
},
],
"stream": False,
- "service_tier": "flex",
"allowed_openai_params": [],
},
response=JsonResponse(
@@ -3659,7 +3670,7 @@ AZURE_GPT_6_LUNA_SERVICE_TIER_FLEX: Final = CostTrackingTestCase(
"logprobs": None,
"message": {
"annotations": [],
- "content": "scripted answer 895f84528ea4",
+ "content": "scripted answer 41ccdf63f9d7",
"refusal": None,
"role": "assistant",
},
@@ -3667,11 +3678,11 @@ AZURE_GPT_6_LUNA_SERVICE_TIER_FLEX: Final = CostTrackingTestCase(
],
"created": 1791852029,
"id": "chatcmpl-$REQUEST_ID",
- "model": "gpt-6-luna-2026-09-22",
+ "model": "gpt-6-astra-2026-09-03",
"object": "chat.completion",
"prompt_filter_results": _GPT_6_PROMPT_FILTER_RESULTS,
"routing": {"serving_pipereplica": "d20260922011332-060efdec-prefill-r0-dp0-prefill"},
- "service_tier": "flex",
+ "service_tier": "default",
"system_fingerprint": None,
"usage": {
"completion_tokens": 412,
@@ -3698,14 +3709,14 @@ AZURE_GPT_6_LUNA_SERVICE_TIER_FLEX: Final = CostTrackingTestCase(
},
),
expected=ExactExpected(
- spend=0.0002535, input_cost=0.0001196, output_cost=0.0001339, prompt_tokens=1840, completion_tokens=412
+ spend=0.04875, input_cost=0.023, output_cost=0.02575, prompt_tokens=1840, completion_tokens=412
),
)
-AZURE_GPT_6_LUNA_SERVICE_TIER_PRIORITY: Final = CostTrackingTestCase(
- name="azure-gpt-6-luna-service_tier_priority",
- covers="quota_management.spend_tracking.cost_matrix.logs_cost",
- model="azure/gpt-6-luna",
+AZURE_GPT_6_ASTRA_STREAM: Final = CostTrackingTestCase(
+ name="azure-gpt-6-astra-stream",
+ covers="quota_management.spend_tracking.scripted_wire.logs_cost",
+ model="azure/gpt-6-astra",
request={
"model": "$MODEL",
"messages": [
@@ -3723,73 +3734,119 @@ AZURE_GPT_6_LUNA_SERVICE_TIER_PRIORITY: Final = CostTrackingTestCase(
"content": [
{
"type": "text",
- "text": "705c026752fc summarize the attached material in one line and name the city weather",
+ "text": "480ff10f91fb summarize the attached material in one line and name the city weather",
}
],
},
],
- "stream": False,
- "service_tier": "priority",
+ "stream": True,
+ "stream_options": {"include_usage": True},
"allowed_openai_params": [],
},
- response=JsonResponse(
- content_type="application/json",
- body={
- "choices": [
- {
- "content_filter_results": _GPT_6_CONTENT_FILTER_RESULTS,
- "finish_reason": "stop",
- "index": 0,
- "logprobs": None,
- "message": {
- "annotations": [],
- "content": "scripted answer 705c026752fc",
- "refusal": None,
- "role": "assistant",
+ response=SseResponse(
+ content_type="text/event-stream",
+ frames=sse_frames(
+ {
+ "choices": [],
+ "created": 0,
+ "id": "",
+ "model": "",
+ "object": "",
+ "prompt_filter_results": _GPT_6_PROMPT_FILTER_RESULTS,
+ },
+ {
+ "choices": [
+ {
+ "content_filter_results": {},
+ "delta": {"content": "", "refusal": None, "role": "assistant"},
+ "finish_reason": None,
+ "index": 0,
+ "logprobs": None,
+ }
+ ],
+ "created": 1791852023,
+ "id": "chatcmpl-$REQUEST_ID",
+ "model": "gpt-6-astra-2026-09-03",
+ "object": "chat.completion.chunk",
+ "service_tier": "default",
+ "system_fingerprint": None,
+ "usage": None,
+ },
+ {
+ "choices": [
+ {
+ "content_filter_results": {"protected_material_text": {"detected": False, "filtered": False}},
+ "delta": {"content": "scripted answer 480ff10f91fb"},
+ "finish_reason": None,
+ "index": 0,
+ "logprobs": None,
+ }
+ ],
+ "created": 1791852023,
+ "id": "chatcmpl-$REQUEST_ID",
+ "model": "gpt-6-astra-2026-09-03",
+ "object": "chat.completion.chunk",
+ "service_tier": "default",
+ "system_fingerprint": None,
+ "usage": None,
+ },
+ {
+ "choices": [
+ {"content_filter_results": {}, "delta": {}, "finish_reason": "stop", "index": 0, "logprobs": None}
+ ],
+ "created": 1791852023,
+ "id": "chatcmpl-$REQUEST_ID",
+ "model": "gpt-6-astra-2026-09-03",
+ "object": "chat.completion.chunk",
+ "service_tier": "default",
+ "system_fingerprint": None,
+ "usage": None,
+ },
+ {
+ "choices": [],
+ "created": 1791852023,
+ "id": "chatcmpl-$REQUEST_ID",
+ "model": "gpt-6-astra-2026-09-03",
+ "object": "chat.completion.chunk",
+ "service_tier": "default",
+ "system_fingerprint": None,
+ "routing": {"serving_pipereplica": "d20260925225746-6787865d-prefill-r11-dp0-prefill"},
+ "usage": {
+ "completion_tokens": 412,
+ "completion_tokens_details": {
+ "accepted_prediction_tokens": 0,
+ "audio_tokens": 0,
+ "reasoning_tokens": 0,
+ "rejected_prediction_tokens": 0,
},
- }
- ],
- "created": 1791852029,
- "id": "chatcmpl-$REQUEST_ID",
- "model": "gpt-6-luna-2026-09-22",
- "object": "chat.completion",
- "prompt_filter_results": _GPT_6_PROMPT_FILTER_RESULTS,
- "routing": {"serving_pipereplica": "d20260922011332-060efdec-prefill-r0-dp0-prefill"},
- "service_tier": "default",
- "system_fingerprint": None,
- "usage": {
- "completion_tokens": 412,
- "completion_tokens_details": {
- "accepted_prediction_tokens": 0,
- "audio_tokens": 0,
- "reasoning_tokens": 0,
- "rejected_prediction_tokens": 0,
- },
- "latency_checkpoint": {
- "engine_tbt_ms": 4,
- "engine_ttft_ms": 131,
- "engine_ttlt_ms": 157,
- "pre_inference_ms": 55,
- "service_tbt_ms": 5,
- "service_ttft_ms": 1034,
- "service_ttlt_ms": 1058,
- "user_visible_ttft_ms": 979,
+ "latency_checkpoint": {
+ "engine_tbt_ms": 4,
+ "engine_ttft_ms": 131,
+ "engine_ttlt_ms": 157,
+ "pre_inference_ms": 55,
+ "service_tbt_ms": 5,
+ "service_ttft_ms": 1034,
+ "service_ttlt_ms": 1058,
+ "user_visible_ttft_ms": 979,
+ },
+ "prompt_tokens": 1840,
+ "prompt_tokens_details": {"audio_tokens": 0, "cache_write_tokens": 0, "cached_tokens": 0},
+ "total_tokens": 2252,
},
- "prompt_tokens": 1840,
- "prompt_tokens_details": {"audio_tokens": 0, "cache_write_tokens": 0, "cached_tokens": 0},
- "total_tokens": 2252,
},
- },
+ ),
),
expected=ExactExpected(
- spend=0.000507, input_cost=0.0002392, output_cost=0.0002678, prompt_tokens=1840, completion_tokens=412
+ spend=0.04875, input_cost=0.023, output_cost=0.02575, prompt_tokens=1840, completion_tokens=412
),
)
-AZURE_GPT_6_ASTRA_INPUT_TEXT: Final = CostTrackingTestCase(
- name="azure-gpt-6-astra-input_text",
+
+
+AZURE_GPT_6_1_SOL_INPUT_TEXT: Final = CostTrackingTestCase(
+ name="azure-gpt-6.1-sol-input_text",
covers="quota_management.spend_tracking.cost_matrix.logs_cost",
- model="azure/gpt-6-astra",
+ model="azure/gpt-6.1-sol",
request={
"model": "$MODEL",
"messages": [
@@ -3807,7 +3864,7 @@ AZURE_GPT_6_ASTRA_INPUT_TEXT: Final = CostTrackingTestCase(
"content": [
{
"type": "text",
- "text": "41ccdf63f9d7 summarize the attached material in one line and name the city weather",
+ "text": "89ad6904966e summarize the attached material in one line and name the city weather",
}
],
},
@@ -3826,7 +3883,7 @@ AZURE_GPT_6_ASTRA_INPUT_TEXT: Final = CostTrackingTestCase(
"logprobs": None,
"message": {
"annotations": [],
- "content": "scripted answer 41ccdf63f9d7",
+ "content": "scripted answer 89ad6904966e",
"refusal": None,
"role": "assistant",
},
@@ -3834,7 +3891,7 @@ AZURE_GPT_6_ASTRA_INPUT_TEXT: Final = CostTrackingTestCase(
],
"created": 1791852029,
"id": "chatcmpl-$REQUEST_ID",
- "model": "gpt-6-astra-2026-09-03",
+ "model": "gpt-6.1-sol-2026-09-29",
"object": "chat.completion",
"prompt_filter_results": _GPT_6_PROMPT_FILTER_RESULTS,
"routing": {"serving_pipereplica": "d20260922011332-060efdec-prefill-r0-dp0-prefill"},
@@ -3865,14 +3922,14 @@ AZURE_GPT_6_ASTRA_INPUT_TEXT: Final = CostTrackingTestCase(
},
),
expected=ExactExpected(
- spend=0.04875, input_cost=0.023, output_cost=0.02575, prompt_tokens=1840, completion_tokens=412
+ spend=0.00936, input_cost=0.004416, output_cost=0.004944, prompt_tokens=1840, completion_tokens=412
),
)
-AZURE_GPT_6_ASTRA_STREAM: Final = CostTrackingTestCase(
- name="azure-gpt-6-astra-stream",
+AZURE_GPT_6_1_SOL_STREAM: Final = CostTrackingTestCase(
+ name="azure-gpt-6.1-sol-stream",
covers="quota_management.spend_tracking.scripted_wire.logs_cost",
- model="azure/gpt-6-astra",
+ model="azure/gpt-6.1-sol",
request={
"model": "$MODEL",
"messages": [
@@ -3890,7 +3947,7 @@ AZURE_GPT_6_ASTRA_STREAM: Final = CostTrackingTestCase(
"content": [
{
"type": "text",
- "text": "480ff10f91fb summarize the attached material in one line and name the city weather",
+ "text": "493cd994b1de summarize the attached material in one line and name the city weather",
}
],
},
@@ -3922,7 +3979,7 @@ AZURE_GPT_6_ASTRA_STREAM: Final = CostTrackingTestCase(
],
"created": 1791852023,
"id": "chatcmpl-$REQUEST_ID",
- "model": "gpt-6-astra-2026-09-03",
+ "model": "gpt-6.1-sol-2026-09-29",
"object": "chat.completion.chunk",
"service_tier": "default",
"system_fingerprint": None,
@@ -3932,7 +3989,7 @@ AZURE_GPT_6_ASTRA_STREAM: Final = CostTrackingTestCase(
"choices": [
{
"content_filter_results": {"protected_material_text": {"detected": False, "filtered": False}},
- "delta": {"content": "scripted answer 480ff10f91fb"},
+ "delta": {"content": "scripted answer 493cd994b1de"},
"finish_reason": None,
"index": 0,
"logprobs": None,
@@ -3940,7 +3997,7 @@ AZURE_GPT_6_ASTRA_STREAM: Final = CostTrackingTestCase(
],
"created": 1791852023,
"id": "chatcmpl-$REQUEST_ID",
- "model": "gpt-6-astra-2026-09-03",
+ "model": "gpt-6.1-sol-2026-09-29",
"object": "chat.completion.chunk",
"service_tier": "default",
"system_fingerprint": None,
@@ -3952,7 +4009,7 @@ AZURE_GPT_6_ASTRA_STREAM: Final = CostTrackingTestCase(
],
"created": 1791852023,
"id": "chatcmpl-$REQUEST_ID",
- "model": "gpt-6-astra-2026-09-03",
+ "model": "gpt-6.1-sol-2026-09-29",
"object": "chat.completion.chunk",
"service_tier": "default",
"system_fingerprint": None,
@@ -3962,7 +4019,7 @@ AZURE_GPT_6_ASTRA_STREAM: Final = CostTrackingTestCase(
"choices": [],
"created": 1791852023,
"id": "chatcmpl-$REQUEST_ID",
- "model": "gpt-6-astra-2026-09-03",
+ "model": "gpt-6.1-sol-2026-09-29",
"object": "chat.completion.chunk",
"service_tier": "default",
"system_fingerprint": None,
@@ -3993,14 +4050,16 @@ AZURE_GPT_6_ASTRA_STREAM: Final = CostTrackingTestCase(
),
),
expected=ExactExpected(
- spend=0.04875, input_cost=0.023, output_cost=0.02575, prompt_tokens=1840, completion_tokens=412
+ spend=0.00936, input_cost=0.004416, output_cost=0.004944, prompt_tokens=1840, completion_tokens=412
),
)
-AZURE_GPT_6_ASTRA_SERVICE_TIER_FLEX: Final = CostTrackingTestCase(
- name="azure-gpt-6-astra-service_tier_flex",
+
+
+AZURE_GPT_6_SOL_REASONING: Final = CostTrackingTestCase(
+ name="azure/gpt-6-sol-reasoning",
covers="quota_management.spend_tracking.cost_matrix.logs_cost",
- model="azure/gpt-6-astra",
+ model="azure/gpt-6-sol",
request={
"model": "$MODEL",
"messages": [
@@ -4018,14 +4077,14 @@ AZURE_GPT_6_ASTRA_SERVICE_TIER_FLEX: Final = CostTrackingTestCase(
"content": [
{
"type": "text",
- "text": "6ff9027e3f7f summarize the attached material in one line and name the city weather",
+ "text": "5c0e79234ed5 summarize the attached material in one line and name the city weather",
}
],
},
],
"stream": False,
- "service_tier": "flex",
- "allowed_openai_params": [],
+ "reasoning_effort": "medium",
+ "allowed_openai_params": ["reasoning_effort"],
},
response=JsonResponse(
content_type="application/json",
@@ -4038,53 +4097,53 @@ AZURE_GPT_6_ASTRA_SERVICE_TIER_FLEX: Final = CostTrackingTestCase(
"logprobs": None,
"message": {
"annotations": [],
- "content": "scripted answer 6ff9027e3f7f",
+ "content": "scripted answer 5c0e79234ed5",
"refusal": None,
"role": "assistant",
},
}
],
- "created": 1791852029,
+ "created": 1791855585,
"id": "chatcmpl-$REQUEST_ID",
- "model": "gpt-6-astra-2026-09-03",
+ "model": "gpt-6-sol-2026-09-22",
"object": "chat.completion",
"prompt_filter_results": _GPT_6_PROMPT_FILTER_RESULTS,
- "routing": {"serving_pipereplica": "d20260922011332-060efdec-prefill-r0-dp0-prefill"},
- "service_tier": "flex",
+ "routing": {"serving_pipereplica": "d20260925225746-6787865d-prefill-r15-dp0-prefill"},
+ "service_tier": "default",
"system_fingerprint": None,
"usage": {
- "completion_tokens": 412,
+ "completion_tokens": 4040,
"completion_tokens_details": {
"accepted_prediction_tokens": 0,
"audio_tokens": 0,
- "reasoning_tokens": 0,
+ "reasoning_tokens": 3480,
"rejected_prediction_tokens": 0,
},
"latency_checkpoint": {
- "engine_tbt_ms": 4,
- "engine_ttft_ms": 131,
- "engine_ttlt_ms": 157,
- "pre_inference_ms": 55,
- "service_tbt_ms": 5,
- "service_ttft_ms": 1034,
- "service_ttlt_ms": 1058,
- "user_visible_ttft_ms": 979,
+ "engine_tbt_ms": 6,
+ "engine_ttft_ms": 152,
+ "engine_ttlt_ms": 305,
+ "pre_inference_ms": 102,
+ "service_tbt_ms": 9,
+ "service_ttft_ms": 389,
+ "service_ttlt_ms": 608,
+ "user_visible_ttft_ms": 288,
},
- "prompt_tokens": 1840,
+ "prompt_tokens": 1240,
"prompt_tokens_details": {"audio_tokens": 0, "cache_write_tokens": 0, "cached_tokens": 0},
- "total_tokens": 2252,
+ "total_tokens": 5280,
},
},
),
expected=ExactExpected(
- spend=0.024375, input_cost=0.0115, output_cost=0.012875, prompt_tokens=1840, completion_tokens=412
+ spend=0.049312, input_cost=0.002852, output_cost=0.04646, prompt_tokens=1240, completion_tokens=4040
),
)
-AZURE_GPT_6_ASTRA_SERVICE_TIER_PRIORITY: Final = CostTrackingTestCase(
- name="azure-gpt-6-astra-service_tier_priority",
- covers="quota_management.spend_tracking.cost_matrix.logs_cost",
- model="azure/gpt-6-astra",
+AZURE_GPT_6_SOL_STREAM_NO_USAGE: Final = CostTrackingTestCase(
+ name="azure/gpt-6-sol-stream_no_usage",
+ covers="quota_management.spend_tracking.scripted_wire.logs_cost",
+ model="azure/gpt-6-sol",
request={
"model": "$MODEL",
"messages": [
@@ -4102,559 +4161,12 @@ AZURE_GPT_6_ASTRA_SERVICE_TIER_PRIORITY: Final = CostTrackingTestCase(
"content": [
{
"type": "text",
- "text": "9a0c038a2ad8 summarize the attached material in one line and name the city weather",
+ "text": "29fbe99c40db summarize the attached material in one line and name the city weather",
}
],
},
],
- "stream": False,
- "service_tier": "priority",
- "allowed_openai_params": [],
- },
- response=JsonResponse(
- content_type="application/json",
- body={
- "choices": [
- {
- "content_filter_results": _GPT_6_CONTENT_FILTER_RESULTS,
- "finish_reason": "stop",
- "index": 0,
- "logprobs": None,
- "message": {
- "annotations": [],
- "content": "scripted answer 9a0c038a2ad8",
- "refusal": None,
- "role": "assistant",
- },
- }
- ],
- "created": 1791852029,
- "id": "chatcmpl-$REQUEST_ID",
- "model": "gpt-6-astra-2026-09-03",
- "object": "chat.completion",
- "prompt_filter_results": _GPT_6_PROMPT_FILTER_RESULTS,
- "routing": {"serving_pipereplica": "d20260922011332-060efdec-prefill-r0-dp0-prefill"},
- "service_tier": "default",
- "system_fingerprint": None,
- "usage": {
- "completion_tokens": 412,
- "completion_tokens_details": {
- "accepted_prediction_tokens": 0,
- "audio_tokens": 0,
- "reasoning_tokens": 0,
- "rejected_prediction_tokens": 0,
- },
- "latency_checkpoint": {
- "engine_tbt_ms": 4,
- "engine_ttft_ms": 131,
- "engine_ttlt_ms": 157,
- "pre_inference_ms": 55,
- "service_tbt_ms": 5,
- "service_ttft_ms": 1034,
- "service_ttlt_ms": 1058,
- "user_visible_ttft_ms": 979,
- },
- "prompt_tokens": 1840,
- "prompt_tokens_details": {"audio_tokens": 0, "cache_write_tokens": 0, "cached_tokens": 0},
- "total_tokens": 2252,
- },
- },
- ),
- expected=ExactExpected(
- spend=0.04875, input_cost=0.023, output_cost=0.02575, prompt_tokens=1840, completion_tokens=412
- ),
-)
-
-AZURE_GPT_6_1_SOL_INPUT_TEXT: Final = CostTrackingTestCase(
- name="azure-gpt-6.1-sol-input_text",
- covers="quota_management.spend_tracking.cost_matrix.logs_cost",
- model="azure/gpt-6.1-sol",
- request={
- "model": "$MODEL",
- "messages": [
- {
- "role": "system",
- "content": [
- {
- "type": "text",
- "text": "You are a deterministic pricing-harness assistant. Keep answers to a single short line.",
- }
- ],
- },
- {
- "role": "user",
- "content": [
- {
- "type": "text",
- "text": "89ad6904966e summarize the attached material in one line and name the city weather",
- }
- ],
- },
- ],
- "stream": False,
- "allowed_openai_params": [],
- },
- response=JsonResponse(
- content_type="application/json",
- body={
- "choices": [
- {
- "content_filter_results": _GPT_6_CONTENT_FILTER_RESULTS,
- "finish_reason": "stop",
- "index": 0,
- "logprobs": None,
- "message": {
- "annotations": [],
- "content": "scripted answer 89ad6904966e",
- "refusal": None,
- "role": "assistant",
- },
- }
- ],
- "created": 1791852029,
- "id": "chatcmpl-$REQUEST_ID",
- "model": "gpt-6.1-sol-2026-09-29",
- "object": "chat.completion",
- "prompt_filter_results": _GPT_6_PROMPT_FILTER_RESULTS,
- "routing": {"serving_pipereplica": "d20260922011332-060efdec-prefill-r0-dp0-prefill"},
- "service_tier": "default",
- "system_fingerprint": None,
- "usage": {
- "completion_tokens": 412,
- "completion_tokens_details": {
- "accepted_prediction_tokens": 0,
- "audio_tokens": 0,
- "reasoning_tokens": 0,
- "rejected_prediction_tokens": 0,
- },
- "latency_checkpoint": {
- "engine_tbt_ms": 4,
- "engine_ttft_ms": 131,
- "engine_ttlt_ms": 157,
- "pre_inference_ms": 55,
- "service_tbt_ms": 5,
- "service_ttft_ms": 1034,
- "service_ttlt_ms": 1058,
- "user_visible_ttft_ms": 979,
- },
- "prompt_tokens": 1840,
- "prompt_tokens_details": {"audio_tokens": 0, "cache_write_tokens": 0, "cached_tokens": 0},
- "total_tokens": 2252,
- },
- },
- ),
- expected=ExactExpected(
- spend=0.00936, input_cost=0.004416, output_cost=0.004944, prompt_tokens=1840, completion_tokens=412
- ),
-)
-
-AZURE_GPT_6_1_SOL_STREAM: Final = CostTrackingTestCase(
- name="azure-gpt-6.1-sol-stream",
- covers="quota_management.spend_tracking.scripted_wire.logs_cost",
- model="azure/gpt-6.1-sol",
- request={
- "model": "$MODEL",
- "messages": [
- {
- "role": "system",
- "content": [
- {
- "type": "text",
- "text": "You are a deterministic pricing-harness assistant. Keep answers to a single short line.",
- }
- ],
- },
- {
- "role": "user",
- "content": [
- {
- "type": "text",
- "text": "493cd994b1de summarize the attached material in one line and name the city weather",
- }
- ],
- },
- ],
- "stream": True,
- "stream_options": {"include_usage": True},
- "allowed_openai_params": [],
- },
- response=SseResponse(
- content_type="text/event-stream",
- frames=sse_frames(
- {
- "choices": [],
- "created": 0,
- "id": "",
- "model": "",
- "object": "",
- "prompt_filter_results": _GPT_6_PROMPT_FILTER_RESULTS,
- },
- {
- "choices": [
- {
- "content_filter_results": {},
- "delta": {"content": "", "refusal": None, "role": "assistant"},
- "finish_reason": None,
- "index": 0,
- "logprobs": None,
- }
- ],
- "created": 1791852023,
- "id": "chatcmpl-$REQUEST_ID",
- "model": "gpt-6.1-sol-2026-09-29",
- "object": "chat.completion.chunk",
- "service_tier": "default",
- "system_fingerprint": None,
- "usage": None,
- },
- {
- "choices": [
- {
- "content_filter_results": {"protected_material_text": {"detected": False, "filtered": False}},
- "delta": {"content": "scripted answer 493cd994b1de"},
- "finish_reason": None,
- "index": 0,
- "logprobs": None,
- }
- ],
- "created": 1791852023,
- "id": "chatcmpl-$REQUEST_ID",
- "model": "gpt-6.1-sol-2026-09-29",
- "object": "chat.completion.chunk",
- "service_tier": "default",
- "system_fingerprint": None,
- "usage": None,
- },
- {
- "choices": [
- {"content_filter_results": {}, "delta": {}, "finish_reason": "stop", "index": 0, "logprobs": None}
- ],
- "created": 1791852023,
- "id": "chatcmpl-$REQUEST_ID",
- "model": "gpt-6.1-sol-2026-09-29",
- "object": "chat.completion.chunk",
- "service_tier": "default",
- "system_fingerprint": None,
- "usage": None,
- },
- {
- "choices": [],
- "created": 1791852023,
- "id": "chatcmpl-$REQUEST_ID",
- "model": "gpt-6.1-sol-2026-09-29",
- "object": "chat.completion.chunk",
- "service_tier": "default",
- "system_fingerprint": None,
- "routing": {"serving_pipereplica": "d20260925225746-6787865d-prefill-r11-dp0-prefill"},
- "usage": {
- "completion_tokens": 412,
- "completion_tokens_details": {
- "accepted_prediction_tokens": 0,
- "audio_tokens": 0,
- "reasoning_tokens": 0,
- "rejected_prediction_tokens": 0,
- },
- "latency_checkpoint": {
- "engine_tbt_ms": 4,
- "engine_ttft_ms": 131,
- "engine_ttlt_ms": 157,
- "pre_inference_ms": 55,
- "service_tbt_ms": 5,
- "service_ttft_ms": 1034,
- "service_ttlt_ms": 1058,
- "user_visible_ttft_ms": 979,
- },
- "prompt_tokens": 1840,
- "prompt_tokens_details": {"audio_tokens": 0, "cache_write_tokens": 0, "cached_tokens": 0},
- "total_tokens": 2252,
- },
- },
- ),
- ),
- expected=ExactExpected(
- spend=0.00936, input_cost=0.004416, output_cost=0.004944, prompt_tokens=1840, completion_tokens=412
- ),
-)
-
-AZURE_GPT_6_1_SOL_SERVICE_TIER_FLEX: Final = CostTrackingTestCase(
- name="azure-gpt-6.1-sol-service_tier_flex",
- covers="quota_management.spend_tracking.cost_matrix.logs_cost",
- model="azure/gpt-6.1-sol",
- request={
- "model": "$MODEL",
- "messages": [
- {
- "role": "system",
- "content": [
- {
- "type": "text",
- "text": "You are a deterministic pricing-harness assistant. Keep answers to a single short line.",
- }
- ],
- },
- {
- "role": "user",
- "content": [
- {
- "type": "text",
- "text": "960e0935140f summarize the attached material in one line and name the city weather",
- }
- ],
- },
- ],
- "stream": False,
- "service_tier": "flex",
- "allowed_openai_params": [],
- },
- response=JsonResponse(
- content_type="application/json",
- body={
- "choices": [
- {
- "content_filter_results": _GPT_6_CONTENT_FILTER_RESULTS,
- "finish_reason": "stop",
- "index": 0,
- "logprobs": None,
- "message": {
- "annotations": [],
- "content": "scripted answer 960e0935140f",
- "refusal": None,
- "role": "assistant",
- },
- }
- ],
- "created": 1791852029,
- "id": "chatcmpl-$REQUEST_ID",
- "model": "gpt-6.1-sol-2026-09-29",
- "object": "chat.completion",
- "prompt_filter_results": _GPT_6_PROMPT_FILTER_RESULTS,
- "routing": {"serving_pipereplica": "d20260922011332-060efdec-prefill-r0-dp0-prefill"},
- "service_tier": "flex",
- "system_fingerprint": None,
- "usage": {
- "completion_tokens": 412,
- "completion_tokens_details": {
- "accepted_prediction_tokens": 0,
- "audio_tokens": 0,
- "reasoning_tokens": 0,
- "rejected_prediction_tokens": 0,
- },
- "latency_checkpoint": {
- "engine_tbt_ms": 4,
- "engine_ttft_ms": 131,
- "engine_ttlt_ms": 157,
- "pre_inference_ms": 55,
- "service_tbt_ms": 5,
- "service_ttft_ms": 1034,
- "service_ttlt_ms": 1058,
- "user_visible_ttft_ms": 979,
- },
- "prompt_tokens": 1840,
- "prompt_tokens_details": {"audio_tokens": 0, "cache_write_tokens": 0, "cached_tokens": 0},
- "total_tokens": 2252,
- },
- },
- ),
- expected=ExactExpected(
- spend=0.00468, input_cost=0.002208, output_cost=0.002472, prompt_tokens=1840, completion_tokens=412
- ),
-)
-
-AZURE_GPT_6_1_SOL_SERVICE_TIER_PRIORITY: Final = CostTrackingTestCase(
- name="azure-gpt-6.1-sol-service_tier_priority",
- covers="quota_management.spend_tracking.cost_matrix.logs_cost",
- model="azure/gpt-6.1-sol",
- request={
- "model": "$MODEL",
- "messages": [
- {
- "role": "system",
- "content": [
- {
- "type": "text",
- "text": "You are a deterministic pricing-harness assistant. Keep answers to a single short line.",
- }
- ],
- },
- {
- "role": "user",
- "content": [
- {
- "type": "text",
- "text": "6b36e2dc1f33 summarize the attached material in one line and name the city weather",
- }
- ],
- },
- ],
- "stream": False,
- "service_tier": "priority",
- "allowed_openai_params": [],
- },
- response=JsonResponse(
- content_type="application/json",
- body={
- "choices": [
- {
- "content_filter_results": _GPT_6_CONTENT_FILTER_RESULTS,
- "finish_reason": "stop",
- "index": 0,
- "logprobs": None,
- "message": {
- "annotations": [],
- "content": "scripted answer 6b36e2dc1f33",
- "refusal": None,
- "role": "assistant",
- },
- }
- ],
- "created": 1791852029,
- "id": "chatcmpl-$REQUEST_ID",
- "model": "gpt-6.1-sol-2026-09-29",
- "object": "chat.completion",
- "prompt_filter_results": _GPT_6_PROMPT_FILTER_RESULTS,
- "routing": {"serving_pipereplica": "d20260922011332-060efdec-prefill-r0-dp0-prefill"},
- "service_tier": "default",
- "system_fingerprint": None,
- "usage": {
- "completion_tokens": 412,
- "completion_tokens_details": {
- "accepted_prediction_tokens": 0,
- "audio_tokens": 0,
- "reasoning_tokens": 0,
- "rejected_prediction_tokens": 0,
- },
- "latency_checkpoint": {
- "engine_tbt_ms": 4,
- "engine_ttft_ms": 131,
- "engine_ttlt_ms": 157,
- "pre_inference_ms": 55,
- "service_tbt_ms": 5,
- "service_ttft_ms": 1034,
- "service_ttlt_ms": 1058,
- "user_visible_ttft_ms": 979,
- },
- "prompt_tokens": 1840,
- "prompt_tokens_details": {"audio_tokens": 0, "cache_write_tokens": 0, "cached_tokens": 0},
- "total_tokens": 2252,
- },
- },
- ),
- expected=ExactExpected(
- spend=0.00936, input_cost=0.004416, output_cost=0.004944, prompt_tokens=1840, completion_tokens=412
- ),
-)
-
-AZURE_GPT_6_SOL_REASONING: Final = CostTrackingTestCase(
- name="azure/gpt-6-sol-reasoning",
- covers="quota_management.spend_tracking.cost_matrix.logs_cost",
- model="azure/gpt-6-sol",
- request={
- "model": "$MODEL",
- "messages": [
- {
- "role": "system",
- "content": [
- {
- "type": "text",
- "text": "You are a deterministic pricing-harness assistant. Keep answers to a single short line.",
- }
- ],
- },
- {
- "role": "user",
- "content": [
- {
- "type": "text",
- "text": "5c0e79234ed5 summarize the attached material in one line and name the city weather",
- }
- ],
- },
- ],
- "stream": False,
- "reasoning_effort": "medium",
- "allowed_openai_params": ["reasoning_effort"],
- },
- response=JsonResponse(
- content_type="application/json",
- body={
- "choices": [
- {
- "content_filter_results": _GPT_6_CONTENT_FILTER_RESULTS,
- "finish_reason": "stop",
- "index": 0,
- "logprobs": None,
- "message": {
- "annotations": [],
- "content": "scripted answer 5c0e79234ed5",
- "refusal": None,
- "role": "assistant",
- },
- }
- ],
- "created": 1791855585,
- "id": "chatcmpl-$REQUEST_ID",
- "model": "gpt-6-sol-2026-09-22",
- "object": "chat.completion",
- "prompt_filter_results": _GPT_6_PROMPT_FILTER_RESULTS,
- "routing": {"serving_pipereplica": "d20260925225746-6787865d-prefill-r15-dp0-prefill"},
- "service_tier": "default",
- "system_fingerprint": None,
- "usage": {
- "completion_tokens": 4040,
- "completion_tokens_details": {
- "accepted_prediction_tokens": 0,
- "audio_tokens": 0,
- "reasoning_tokens": 3480,
- "rejected_prediction_tokens": 0,
- },
- "latency_checkpoint": {
- "engine_tbt_ms": 6,
- "engine_ttft_ms": 152,
- "engine_ttlt_ms": 305,
- "pre_inference_ms": 102,
- "service_tbt_ms": 9,
- "service_ttft_ms": 389,
- "service_ttlt_ms": 608,
- "user_visible_ttft_ms": 288,
- },
- "prompt_tokens": 1240,
- "prompt_tokens_details": {"audio_tokens": 0, "cache_write_tokens": 0, "cached_tokens": 0},
- "total_tokens": 5280,
- },
- },
- ),
- expected=ExactExpected(
- spend=0.049312, input_cost=0.002852, output_cost=0.04646, prompt_tokens=1240, completion_tokens=4040
- ),
-)
-
-AZURE_GPT_6_SOL_STREAM_NO_USAGE: Final = CostTrackingTestCase(
- name="azure/gpt-6-sol-stream_no_usage",
- covers="quota_management.spend_tracking.scripted_wire.logs_cost",
- model="azure/gpt-6-sol",
- request={
- "model": "$MODEL",
- "messages": [
- {
- "role": "system",
- "content": [
- {
- "type": "text",
- "text": "You are a deterministic pricing-harness assistant. Keep answers to a single short line.",
- }
- ],
- },
- {
- "role": "user",
- "content": [
- {
- "type": "text",
- "text": "29fbe99c40db summarize the attached material in one line and name the city weather",
- }
- ],
- },
- ],
- "stream": True,
+ "stream": True,
"allowed_openai_params": [],
},
response=SseResponse(
@@ -5995,31 +5507,7 @@ AZURE_GPT_6_LUNA_TIERED_AT_272K_BOUNDARY: Final = with_usage(
),
)
-AZURE_GPT_6_LUNA_TIERED_FLEX_ABOVE_272K: Final = with_usage(
- AZURE_GPT_6_LUNA_SERVICE_TIER_FLEX,
- "azure-gpt-6-luna-tiered_flex_above_272k",
- {
- "prompt_tokens": 300000,
- "total_tokens": 300412,
- "prompt_tokens_details": {"audio_tokens": 0, "cache_write_tokens": 0, "cached_tokens": 0},
- },
- ExactExpected(
- spend=0.0392678, input_cost=0.039, output_cost=0.0002678, prompt_tokens=300000, completion_tokens=412
- ),
-)
-AZURE_GPT_6_LUNA_TIERED_PRIORITY_ABOVE_272K: Final = with_usage(
- AZURE_GPT_6_LUNA_SERVICE_TIER_PRIORITY,
- "azure-gpt-6-luna-tiered_priority_above_272k",
- {
- "prompt_tokens": 300000,
- "total_tokens": 300412,
- "prompt_tokens_details": {"audio_tokens": 0, "cache_write_tokens": 0, "cached_tokens": 0},
- },
- ExactExpected(
- spend=0.0785356, input_cost=0.078, output_cost=0.0005356, prompt_tokens=300000, completion_tokens=412
- ),
-)
AZURE_GPT_6_ASTRA_TIERED_INPUT_ABOVE_272K: Final = with_usage(
AZURE_GPT_6_ASTRA_INPUT_TEXT,
@@ -6054,27 +5542,7 @@ AZURE_GPT_6_ASTRA_TIERED_AT_272K_BOUNDARY: Final = with_usage(
ExactExpected(spend=3.42575, input_cost=3.4, output_cost=0.02575, prompt_tokens=272000, completion_tokens=412),
)
-AZURE_GPT_6_ASTRA_TIERED_FLEX_ABOVE_272K: Final = with_usage(
- AZURE_GPT_6_ASTRA_SERVICE_TIER_FLEX,
- "azure-gpt-6-astra-tiered_flex_above_272k",
- {
- "prompt_tokens": 300000,
- "total_tokens": 300412,
- "prompt_tokens_details": {"audio_tokens": 0, "cache_write_tokens": 0, "cached_tokens": 0},
- },
- ExactExpected(spend=3.77575, input_cost=3.75, output_cost=0.02575, prompt_tokens=300000, completion_tokens=412),
-)
-AZURE_GPT_6_ASTRA_TIERED_PRIORITY_ABOVE_272K: Final = with_usage(
- AZURE_GPT_6_ASTRA_SERVICE_TIER_PRIORITY,
- "azure-gpt-6-astra-tiered_priority_above_272k",
- {
- "prompt_tokens": 300000,
- "total_tokens": 300412,
- "prompt_tokens_details": {"audio_tokens": 0, "cache_write_tokens": 0, "cached_tokens": 0},
- },
- ExactExpected(spend=7.5515, input_cost=7.5, output_cost=0.0515, prompt_tokens=300000, completion_tokens=412),
-)
AZURE_GPT_6_1_SOL_TIERED_INPUT_ABOVE_272K: Final = with_usage(
AZURE_GPT_6_1_SOL_INPUT_TEXT,
@@ -6109,27 +5577,7 @@ AZURE_GPT_6_1_SOL_TIERED_AT_272K_BOUNDARY: Final = with_usage(
ExactExpected(spend=0.657744, input_cost=0.6528, output_cost=0.004944, prompt_tokens=272000, completion_tokens=412),
)
-AZURE_GPT_6_1_SOL_TIERED_FLEX_ABOVE_272K: Final = with_usage(
- AZURE_GPT_6_1_SOL_SERVICE_TIER_FLEX,
- "azure-gpt-6.1-sol-tiered_flex_above_272k",
- {
- "prompt_tokens": 300000,
- "total_tokens": 300412,
- "prompt_tokens_details": {"audio_tokens": 0, "cache_write_tokens": 0, "cached_tokens": 0},
- },
- ExactExpected(spend=0.724944, input_cost=0.72, output_cost=0.004944, prompt_tokens=300000, completion_tokens=412),
-)
-AZURE_GPT_6_1_SOL_TIERED_PRIORITY_ABOVE_272K: Final = with_usage(
- AZURE_GPT_6_1_SOL_SERVICE_TIER_PRIORITY,
- "azure-gpt-6.1-sol-tiered_priority_above_272k",
- {
- "prompt_tokens": 300000,
- "total_tokens": 300412,
- "prompt_tokens_details": {"audio_tokens": 0, "cache_write_tokens": 0, "cached_tokens": 0},
- },
- ExactExpected(spend=1.449888, input_cost=1.44, output_cost=0.009888, prompt_tokens=300000, completion_tokens=412),
-)
AZURE_GPT_6_1_SOL_CACHE_WRITE_5M: Final = with_response_usage(
AZURE_GPT_6_1_SOL_CACHE_READ,
@@ -6221,12 +5669,12 @@ AZURE_GPT_5_6_TERRA_STREAM: Final = AZURE_GPT_6_LUNA_STREAM.model_copy(
),
}
)
-AZURE_GPT_5_6_TERRA_SERVICE_TIER_FLEX: Final = AZURE_GPT_6_LUNA_SERVICE_TIER_FLEX.model_copy(
+AZURE_GPT_5_6_TERRA_SERVICE_TIER_FLEX: Final = AZURE_GPT_5_6_SERVICE_TIER_FLEX.model_copy(
update={
"name": "azure-gpt-5.6-terra-service_tier_flex",
"model": "azure/gpt-5.6-terra",
"response": _response_for_model(
- cast(JsonResponse, AZURE_GPT_6_LUNA_SERVICE_TIER_FLEX.response), "gpt-5.6-terra-2026-07-09"
+ cast(JsonResponse, AZURE_GPT_5_6_SERVICE_TIER_FLEX.response), "gpt-5.6-terra-2026-07-09"
),
"expected": ExactExpected(
spend=0.0047432,
@@ -6237,12 +5685,14 @@ AZURE_GPT_5_6_TERRA_SERVICE_TIER_FLEX: Final = AZURE_GPT_6_LUNA_SERVICE_TIER_FLE
),
}
)
-AZURE_GPT_5_6_TERRA_SERVICE_TIER_PRIORITY: Final = AZURE_GPT_6_LUNA_SERVICE_TIER_PRIORITY.model_copy(
+AZURE_GPT_5_6_TERRA_SERVICE_TIER_PRIORITY: Final = AZURE_GPT_5_6_SERVICE_TIER_PRIORITY.model_copy(
update={
"name": "azure-gpt-5.6-terra-service_tier_priority",
"model": "azure/gpt-5.6-terra",
"response": _response_for_model(
- cast(JsonResponse, AZURE_GPT_6_LUNA_SERVICE_TIER_PRIORITY.response), "gpt-5.6-terra-2026-07-09"
+ cast(JsonResponse, AZURE_GPT_5_6_SERVICE_TIER_PRIORITY.response),
+ "gpt-5.6-terra-2026-07-09",
+ service_tier="default",
),
"expected": ExactExpected(
spend=0.0189728,
@@ -6376,18 +5826,12 @@ CASES: Final[tuple[CostTrackingTestCase, ...]] = (
AZURE_GPT_6_LUNA_TIERED_INPUT_ABOVE_272K,
AZURE_GPT_6_LUNA_TIERED_CACHE_READ_ABOVE_272K,
AZURE_GPT_6_LUNA_TIERED_AT_272K_BOUNDARY,
- AZURE_GPT_6_LUNA_TIERED_FLEX_ABOVE_272K,
- AZURE_GPT_6_LUNA_TIERED_PRIORITY_ABOVE_272K,
AZURE_GPT_6_ASTRA_TIERED_INPUT_ABOVE_272K,
AZURE_GPT_6_ASTRA_TIERED_CACHE_READ_ABOVE_272K,
AZURE_GPT_6_ASTRA_TIERED_AT_272K_BOUNDARY,
- AZURE_GPT_6_ASTRA_TIERED_FLEX_ABOVE_272K,
- AZURE_GPT_6_ASTRA_TIERED_PRIORITY_ABOVE_272K,
AZURE_GPT_6_1_SOL_TIERED_INPUT_ABOVE_272K,
AZURE_GPT_6_1_SOL_TIERED_CACHE_READ_ABOVE_272K,
AZURE_GPT_6_1_SOL_TIERED_AT_272K_BOUNDARY,
- AZURE_GPT_6_1_SOL_TIERED_FLEX_ABOVE_272K,
- AZURE_GPT_6_1_SOL_TIERED_PRIORITY_ABOVE_272K,
AZURE_GPT_5_4_MINI_INPUT_TEXT,
AZURE_GPT_5_4_MINI_CACHE_READ,
AZURE_GPT_5_4_MINI_AUDIO_INPUT,
@@ -6436,16 +5880,10 @@ CASES: Final[tuple[CostTrackingTestCase, ...]] = (
AZURE_GPT_6_SOL_SERVICE_TIER_PRIORITY,
AZURE_GPT_6_LUNA_INPUT_TEXT,
AZURE_GPT_6_LUNA_STREAM,
- AZURE_GPT_6_LUNA_SERVICE_TIER_FLEX,
- AZURE_GPT_6_LUNA_SERVICE_TIER_PRIORITY,
AZURE_GPT_6_ASTRA_INPUT_TEXT,
AZURE_GPT_6_ASTRA_STREAM,
- AZURE_GPT_6_ASTRA_SERVICE_TIER_FLEX,
- AZURE_GPT_6_ASTRA_SERVICE_TIER_PRIORITY,
AZURE_GPT_6_1_SOL_INPUT_TEXT,
AZURE_GPT_6_1_SOL_STREAM,
- AZURE_GPT_6_1_SOL_SERVICE_TIER_FLEX,
- AZURE_GPT_6_1_SOL_SERVICE_TIER_PRIORITY,
AZURE_GPT_6_SOL_REASONING,
AZURE_GPT_6_SOL_STREAM_NO_USAGE,
AZURE_GPT_6_LUNA_REASONING,
diff --git a/tests/integration/cost_calculation/cases/bedrock_mantle.py b/tests/integration/cost_calculation/cases/bedrock_mantle.py
index 714c6f2811f..2fa940d66f4 100644
--- a/tests/integration/cost_calculation/cases/bedrock_mantle.py
+++ b/tests/integration/cost_calculation/cases/bedrock_mantle.py
@@ -2,9 +2,23 @@
from __future__ import annotations
+import json
+from collections.abc import Mapping
from typing import Final
from integration.cost_calculation.cases.openai import with_usage
+from integration.cost_calculation.cases.anthropic import (
+ CLAUDE_OPUS_5_5_CACHE_READ,
+ CLAUDE_OPUS_5_5_CACHE_WRITE_1H,
+ CLAUDE_OPUS_5_5_CACHE_WRITE_5M,
+ CLAUDE_OPUS_5_5_INPUT_TEXT,
+ CLAUDE_OPUS_5_5_MESSAGES_INPUT_TEXT,
+ CLAUDE_OPUS_5_5_MESSAGES_STREAM,
+ CLAUDE_OPUS_5_5_STREAM,
+ CLAUDE_OPUS_5_5_THINKING,
+ CLAUDE_OPUS_5_5_TOOL_CALL,
+)
+from integration.cost_calculation.bridge_cost_parity.case import BridgeCostParityTestCase
from integration.cost_calculation.cost_tracking_case import (
CostTrackingTestCase,
Deployment,
@@ -13,6 +27,7 @@ from integration.cost_calculation.cost_tracking_case import (
SseResponse,
)
from integration.cost_calculation.stream_parity.case import StreamParityTestCase, sse_frames
+from pydantic import JsonValue
BEDROCK_MANTLE_OPENAI_GPT_6_SOL_RESPONSES_JSON: Final = CostTrackingTestCase(
@@ -503,6 +518,420 @@ BEDROCK_MANTLE_OPENAI_GPT_6_SOL_TIERED_AT_272K_BOUNDARY: Final = with_usage(
ExactExpected(spend=0.602932, input_cost=0.5984, output_cost=0.004532, prompt_tokens=272000, completion_tokens=412),
)
+_MANTLE_GPT_RESPONSES_REQUEST: Final = {
+ "model": "$MODEL",
+ "input": "cost tracking fixture",
+ "max_output_tokens": 64,
+ "stream": False,
+}
+_MANTLE_GPT_REASONING_REQUEST: Final = {
+ **_MANTLE_GPT_RESPONSES_REQUEST,
+ "max_output_tokens": 128,
+ "reasoning": {"effort": "medium"},
+}
+_MANTLE_GPT_STREAM_REQUEST: Final = {**_MANTLE_GPT_RESPONSES_REQUEST, "stream": True}
+_MANTLE_GPT_CHAT_REQUEST: Final = {
+ "model": "$MODEL",
+ "messages": [{"role": "user", "content": "cost tracking fixture"}],
+ "max_completion_tokens": 64,
+}
+
+
+def _mantle_gpt_usage(
+ input_tokens: int, output_tokens: int, reasoning_tokens: int, cached_tokens: int = 0
+) -> dict[str, JsonValue]:
+ return {
+ "input_tokens": input_tokens,
+ "input_tokens_details": {"cache_write_tokens": 0, "cached_tokens": cached_tokens},
+ "output_tokens": output_tokens,
+ "output_tokens_details": {"reasoning_tokens": reasoning_tokens},
+ "total_tokens": input_tokens + output_tokens,
+ }
+
+
+def _mantle_gpt_json_case(
+ base: CostTrackingTestCase,
+ provider_model: str,
+ shape: str,
+ usage: Mapping[str, JsonValue],
+ expected: ExactExpected,
+ request: Mapping[str, JsonValue],
+) -> CostTrackingTestCase:
+ case: Final = with_usage(base, f"bedrock_mantle-{provider_model}-{shape}", usage, expected)
+ if not isinstance(case.response, JsonResponse):
+ raise TypeError(f"{case.name}: expected a JSON response fixture")
+ response: Final = case.response.model_copy(update={"body": {**case.response.body, "model": provider_model}})
+ return case.model_copy(
+ update={"model": f"bedrock_mantle/{provider_model}", "request": dict(request), "response": response}
+ )
+
+
+def _mantle_gpt_stream_case(
+ provider_model: str, usage: Mapping[str, JsonValue], expected: ExactExpected
+) -> CostTrackingTestCase:
+ base: Final = BEDROCK_MANTLE_OPENAI_GPT_6_SOL_RESPONSES_STREAM
+ if not isinstance(base.response, SseResponse):
+ raise TypeError(f"{base.name}: expected an SSE response fixture")
+ old_usage: Final = json.dumps(_mantle_gpt_usage(1840, 412, 0))
+ new_usage: Final = json.dumps(dict(usage))
+ frames: Final = tuple(
+ frame.replace("openai.gpt-6-sol", provider_model).replace(old_usage, new_usage)
+ for frame in base.response.frames
+ )
+ response: Final = base.response.model_copy(update={"frames": frames})
+ return base.model_copy(
+ update={
+ "name": f"bedrock_mantle-{provider_model}-responses_stream",
+ "model": f"bedrock_mantle/{provider_model}",
+ "request": dict(_MANTLE_GPT_STREAM_REQUEST),
+ "response": response,
+ "expected": expected,
+ }
+ )
+
+
+def _mantle_gpt_cases(
+ provider_model: str,
+ response_reasoning_tokens: int,
+ response_expected: ExactExpected,
+ reasoning_usage: Mapping[str, JsonValue],
+ reasoning_expected: ExactExpected,
+ cache_reasoning_tokens: int,
+ cache_expected: ExactExpected,
+ tiered_input_expected: ExactExpected,
+ tiered_cache_expected: ExactExpected,
+ tiered_boundary_expected: ExactExpected,
+) -> tuple[CostTrackingTestCase, ...]:
+ response_usage: Final = _mantle_gpt_usage(9, 64, response_reasoning_tokens)
+ response_case: Final = _mantle_gpt_json_case(
+ BEDROCK_MANTLE_OPENAI_GPT_6_SOL_RESPONSES_JSON,
+ provider_model,
+ "responses_json",
+ response_usage,
+ response_expected,
+ _MANTLE_GPT_RESPONSES_REQUEST,
+ )
+ stream_case: Final = _mantle_gpt_stream_case(provider_model, response_usage, response_expected)
+ reasoning_case: Final = _mantle_gpt_json_case(
+ BEDROCK_MANTLE_OPENAI_GPT_6_SOL_RESPONSES_REASONING,
+ provider_model,
+ "responses_reasoning",
+ reasoning_usage,
+ reasoning_expected,
+ _MANTLE_GPT_REASONING_REQUEST,
+ )
+ chat_case: Final = _mantle_gpt_json_case(
+ BEDROCK_MANTLE_OPENAI_GPT_6_SOL_CHAT_JSON,
+ provider_model,
+ "chat_json",
+ response_usage,
+ response_expected,
+ _MANTLE_GPT_CHAT_REQUEST,
+ )
+ cache_case: Final = _mantle_gpt_json_case(
+ BEDROCK_MANTLE_OPENAI_GPT_6_SOL_RESPONSES_JSON,
+ provider_model,
+ "responses_cache_read",
+ _mantle_gpt_usage(3144, 16, cache_reasoning_tokens, cached_tokens=3142),
+ cache_expected,
+ {**_MANTLE_GPT_RESPONSES_REQUEST, "max_output_tokens": 16},
+ )
+ tiered_input: Final = _mantle_gpt_json_case(
+ BEDROCK_MANTLE_OPENAI_GPT_6_SOL_RESPONSES_JSON,
+ provider_model,
+ "tiered_input_above_272k",
+ _mantle_gpt_usage(300000, 412, 0),
+ tiered_input_expected,
+ {**_MANTLE_GPT_RESPONSES_REQUEST, "max_output_tokens": 412},
+ )
+ tiered_cache: Final = _mantle_gpt_json_case(
+ BEDROCK_MANTLE_OPENAI_GPT_6_SOL_RESPONSES_JSON,
+ provider_model,
+ "tiered_cache_read_above_272k",
+ _mantle_gpt_usage(300000, 412, 0, cached_tokens=200000),
+ tiered_cache_expected,
+ {**_MANTLE_GPT_RESPONSES_REQUEST, "max_output_tokens": 412},
+ )
+ tiered_boundary: Final = _mantle_gpt_json_case(
+ BEDROCK_MANTLE_OPENAI_GPT_6_SOL_RESPONSES_JSON,
+ provider_model,
+ "tiered_at_272k_boundary",
+ _mantle_gpt_usage(272000, 412, 0),
+ tiered_boundary_expected,
+ {**_MANTLE_GPT_RESPONSES_REQUEST, "max_output_tokens": 412},
+ )
+ return (response_case, stream_case, reasoning_case, chat_case, cache_case, tiered_input, tiered_cache, tiered_boundary)
+
+
+def _mantle_gpt_bridge(case: CostTrackingTestCase) -> BridgeCostParityTestCase:
+ bridged: Final = case.model_copy(
+ update={
+ "name": case.name.removesuffix("responses_json") + "chat_bridged_json",
+ "endpoint": "/v1/chat/completions",
+ "request": dict(_MANTLE_GPT_CHAT_REQUEST),
+ }
+ )
+ return BridgeCostParityTestCase(native=case, bridged=bridged)
+
+
+_MANTLE_GPT_61_SOL_CASES: Final = _mantle_gpt_cases(
+ "openai.gpt-6.1-sol",
+ 48,
+ ExactExpected(spend=0.00079618, input_cost=0.00002178, output_cost=0.0007744, prompt_tokens=9, completion_tokens=64),
+ _mantle_gpt_usage(16, 5, 0),
+ ExactExpected(spend=0.00009922, input_cost=0.00003872, output_cost=0.0000605, prompt_tokens=16, completion_tokens=5),
+ 0,
+ ExactExpected(spend=0.000578622, input_cost=0.000385022, output_cost=0.0001936, prompt_tokens=3144, completion_tokens=16),
+ ExactExpected(spend=1.4594778, input_cost=1.452, output_cost=0.0074778, prompt_tokens=300000, completion_tokens=412),
+ ExactExpected(spend=0.5398778, input_cost=0.5324, output_cost=0.0074778, prompt_tokens=300000, completion_tokens=412),
+ ExactExpected(spend=0.6632252, input_cost=0.65824, output_cost=0.0049852, prompt_tokens=272000, completion_tokens=412),
+)
+_MANTLE_GPT_6_LUNA_CASES: Final = _mantle_gpt_cases(
+ "openai.gpt-6-luna",
+ 64,
+ ExactExpected(spend=0.000043428, input_cost=0.000001188, output_cost=0.00004224, prompt_tokens=9, completion_tokens=64),
+ _mantle_gpt_usage(16, 18, 11),
+ ExactExpected(spend=0.000013992, input_cost=0.000002112, output_cost=0.00001188, prompt_tokens=16, completion_tokens=18),
+ 16,
+ ExactExpected(spend=0.0000522984, input_cost=0.0000417384, output_cost=0.00001056, prompt_tokens=3144, completion_tokens=16),
+ ExactExpected(spend=0.07960788, input_cost=0.0792, output_cost=0.00040788, prompt_tokens=300000, completion_tokens=412),
+ ExactExpected(spend=0.03208788, input_cost=0.03168, output_cost=0.00040788, prompt_tokens=300000, completion_tokens=412),
+ ExactExpected(spend=0.03617592, input_cost=0.035904, output_cost=0.00027192, prompt_tokens=272000, completion_tokens=412),
+)
+_MANTLE_GPT_6_ASTRA_CASES: Final = _mantle_gpt_cases(
+ "openai.gpt-6-astra",
+ 29,
+ ExactExpected(spend=0.0047047, input_cost=0.0001287, output_cost=0.004576, prompt_tokens=9, completion_tokens=64),
+ _mantle_gpt_usage(16, 5, 0),
+ ExactExpected(spend=0.0005863, input_cost=0.0002288, output_cost=0.0003575, prompt_tokens=16, completion_tokens=5),
+ 0,
+ ExactExpected(spend=0.00566566, input_cost=0.00452166, output_cost=0.001144, prompt_tokens=3144, completion_tokens=16),
+ ExactExpected(spend=8.624187, input_cost=8.58, output_cost=0.044187, prompt_tokens=300000, completion_tokens=412),
+ ExactExpected(spend=3.476187, input_cost=3.432, output_cost=0.044187, prompt_tokens=300000, completion_tokens=412),
+ ExactExpected(spend=3.919058, input_cost=3.8896, output_cost=0.029458, prompt_tokens=272000, completion_tokens=412),
+)
+_MANTLE_GPT_56_TERRA_CASES: Final = _mantle_gpt_cases(
+ "openai.gpt-5.6-terra",
+ 33,
+ ExactExpected(spend=0.00121044, input_cost=0.00002772, output_cost=0.00118272, prompt_tokens=9, completion_tokens=64),
+ _mantle_gpt_usage(16, 17, 10),
+ ExactExpected(spend=0.00036344, input_cost=0.00004928, output_cost=0.00031416, prompt_tokens=16, completion_tokens=17),
+ 0,
+ ExactExpected(spend=0.001269576, input_cost=0.000973896, output_cost=0.00029568, prompt_tokens=3144, completion_tokens=16),
+ ExactExpected(spend=1.85942064, input_cost=1.848, output_cost=0.01142064, prompt_tokens=300000, completion_tokens=412),
+ ExactExpected(spend=0.75062064, input_cost=0.7392, output_cost=0.01142064, prompt_tokens=300000, completion_tokens=412),
+ ExactExpected(spend=0.84537376, input_cost=0.83776, output_cost=0.00761376, prompt_tokens=272000, completion_tokens=412),
+)
+
+_MANTLE_CLAUDE_OPUS_MODEL: Final = "bedrock_mantle/anthropic.claude-opus-5-5"
+_ADAPTIVE_USAGE: Final = {
+ "input_tokens": 24,
+ "cache_creation_input_tokens": 0,
+ "cache_read_input_tokens": 0,
+ "cache_creation": {"ephemeral_5m_input_tokens": 0, "ephemeral_1h_input_tokens": 0},
+ "output_tokens": 18,
+ "output_tokens_details": {"thinking_tokens": 6},
+ "service_tier": "standard",
+}
+_ADAPTIVE_EXPECTED: Final = ExactExpected(
+ spend=0.0007524, input_cost=0.0001584, output_cost=0.000594, prompt_tokens=24, completion_tokens=18
+)
+
+BEDROCK_MANTLE_CLAUDE_OPUS_5_5_INPUT_TEXT: Final = with_usage(
+ CLAUDE_OPUS_5_5_INPUT_TEXT,
+ "bedrock_mantle-anthropic.claude-opus-5-5-input_text",
+ _ADAPTIVE_USAGE,
+ _ADAPTIVE_EXPECTED,
+).model_copy(
+ update={
+ "model": _MANTLE_CLAUDE_OPUS_MODEL,
+ "request": {
+ **CLAUDE_OPUS_5_5_INPUT_TEXT.request,
+ "reasoning_effort": "medium",
+ "allowed_openai_params": ["reasoning_effort"],
+ },
+ }
+)
+
+_MANTLE_CLAUDE_STREAM_RESPONSE: Final = SseResponse(
+ content_type="text/event-stream",
+ frames=sse_frames(
+ {
+ "type": "message_start",
+ "message": {
+ "id": "msg_$REQUEST_ID",
+ "type": "message",
+ "role": "assistant",
+ "model": "claude-opus-5-5",
+ "content": [],
+ "stop_reason": None,
+ "stop_sequence": None,
+ "usage": {
+ "input_tokens": 24,
+ "cache_creation_input_tokens": 0,
+ "cache_read_input_tokens": 0,
+ "cache_creation": {"ephemeral_5m_input_tokens": 0, "ephemeral_1h_input_tokens": 0},
+ "output_tokens": 5,
+ "service_tier": "standard",
+ },
+ },
+ },
+ {"type": "content_block_start", "index": 0, "content_block": {"type": "thinking", "thinking": ""}},
+ {"type": "content_block_delta", "index": 0, "delta": {"type": "thinking_delta", "thinking": ""}},
+ {"type": "content_block_stop", "index": 0},
+ {"type": "content_block_start", "index": 1, "content_block": {"type": "text", "text": ""}},
+ {"type": "content_block_delta", "index": 1, "delta": {"type": "text_delta", "text": "4"}},
+ {"type": "content_block_stop", "index": 1},
+ {
+ "type": "message_delta",
+ "delta": {"stop_reason": "end_turn", "stop_sequence": None},
+ "usage": {
+ "input_tokens": 24,
+ "cache_creation_input_tokens": 0,
+ "cache_read_input_tokens": 0,
+ "output_tokens": 18,
+ "output_tokens_details": {"thinking_tokens": 6},
+ },
+ },
+ {"type": "message_stop"},
+ ),
+)
+
+BEDROCK_MANTLE_CLAUDE_OPUS_5_5_STREAM: Final = CLAUDE_OPUS_5_5_STREAM.model_copy(
+ update={
+ "name": "bedrock_mantle-anthropic.claude-opus-5-5-stream",
+ "model": _MANTLE_CLAUDE_OPUS_MODEL,
+ "request": {
+ **CLAUDE_OPUS_5_5_STREAM.request,
+ "reasoning_effort": "medium",
+ "allowed_openai_params": ["reasoning_effort"],
+ },
+ "response": _MANTLE_CLAUDE_STREAM_RESPONSE,
+ "expected": _ADAPTIVE_EXPECTED,
+ }
+)
+
+BEDROCK_MANTLE_CLAUDE_OPUS_5_5_MESSAGES_INPUT_TEXT: Final = with_usage(
+ CLAUDE_OPUS_5_5_MESSAGES_INPUT_TEXT,
+ "bedrock_mantle-anthropic.claude-opus-5-5-messages_input_text",
+ _ADAPTIVE_USAGE,
+ _ADAPTIVE_EXPECTED,
+).model_copy(
+ update={
+ "model": _MANTLE_CLAUDE_OPUS_MODEL,
+ "request": {
+ **CLAUDE_OPUS_5_5_MESSAGES_INPUT_TEXT.request,
+ "thinking": {"type": "adaptive"},
+ "output_config": {"effort": "medium"},
+ },
+ }
+)
+
+BEDROCK_MANTLE_CLAUDE_OPUS_5_5_MESSAGES_STREAM: Final = CLAUDE_OPUS_5_5_MESSAGES_STREAM.model_copy(
+ update={
+ "name": "bedrock_mantle-anthropic.claude-opus-5-5-messages_stream",
+ "model": _MANTLE_CLAUDE_OPUS_MODEL,
+ "request": {
+ **CLAUDE_OPUS_5_5_MESSAGES_STREAM.request,
+ "thinking": {"type": "adaptive"},
+ "output_config": {"effort": "medium"},
+ },
+ "response": _MANTLE_CLAUDE_STREAM_RESPONSE,
+ "expected": _ADAPTIVE_EXPECTED,
+ }
+)
+
+BEDROCK_MANTLE_CLAUDE_OPUS_5_5_CACHE_READ: Final = with_usage(
+ CLAUDE_OPUS_5_5_CACHE_READ,
+ "bedrock_mantle-anthropic.claude-opus-5-5-cache_read",
+ {
+ "input_tokens": 22,
+ "cache_creation_input_tokens": 0,
+ "cache_read_input_tokens": 4203,
+ "cache_creation": {"ephemeral_5m_input_tokens": 0, "ephemeral_1h_input_tokens": 0},
+ "output_tokens": 47,
+ "output_tokens_details": {"thinking_tokens": 35},
+ "service_tier": "standard",
+ },
+ ExactExpected(
+ spend=0.00308319, input_cost=0.00153219, output_cost=0.001551, prompt_tokens=4225, completion_tokens=47
+ ),
+).model_copy(update={"model": _MANTLE_CLAUDE_OPUS_MODEL})
+
+BEDROCK_MANTLE_CLAUDE_OPUS_5_5_CACHE_WRITE_5M: Final = with_usage(
+ CLAUDE_OPUS_5_5_CACHE_WRITE_5M,
+ "bedrock_mantle-anthropic.claude-opus-5-5-cache_write_5m",
+ {
+ "input_tokens": 22,
+ "cache_creation_input_tokens": 4203,
+ "cache_read_input_tokens": 0,
+ "cache_creation": {"ephemeral_5m_input_tokens": 4203, "ephemeral_1h_input_tokens": 0},
+ "output_tokens": 44,
+ "output_tokens_details": {"thinking_tokens": 32},
+ "service_tier": "standard",
+ },
+ ExactExpected(
+ spend=0.03627195, input_cost=0.03481995, output_cost=0.001452, prompt_tokens=4225, completion_tokens=44
+ ),
+).model_copy(update={"model": _MANTLE_CLAUDE_OPUS_MODEL})
+
+BEDROCK_MANTLE_CLAUDE_OPUS_5_5_CACHE_WRITE_1H: Final = with_usage(
+ CLAUDE_OPUS_5_5_CACHE_WRITE_1H,
+ "bedrock_mantle-anthropic.claude-opus-5-5-cache_write_1h",
+ {
+ "input_tokens": 22,
+ "cache_creation_input_tokens": 9003,
+ "cache_read_input_tokens": 0,
+ "cache_creation": {"ephemeral_5m_input_tokens": 0, "ephemeral_1h_input_tokens": 9003},
+ "output_tokens": 12,
+ "output_tokens_details": {"thinking_tokens": 0},
+ "service_tier": "standard",
+ },
+ ExactExpected(
+ spend=0.1193808, input_cost=0.1189848, output_cost=0.000396, prompt_tokens=9025, completion_tokens=12
+ ),
+).model_copy(update={"model": _MANTLE_CLAUDE_OPUS_MODEL})
+
+BEDROCK_MANTLE_CLAUDE_OPUS_5_5_THINKING: Final = with_usage(
+ CLAUDE_OPUS_5_5_THINKING,
+ "bedrock_mantle-anthropic.claude-opus-5-5-thinking",
+ _ADAPTIVE_USAGE,
+ _ADAPTIVE_EXPECTED,
+).model_copy(update={"model": _MANTLE_CLAUDE_OPUS_MODEL})
+
+BEDROCK_MANTLE_CLAUDE_OPUS_5_5_TOOL_CALL: Final = with_usage(
+ CLAUDE_OPUS_5_5_TOOL_CALL,
+ "bedrock_mantle-anthropic.claude-opus-5-5-tool_call",
+ {
+ "input_tokens": 376,
+ "cache_creation_input_tokens": 0,
+ "cache_read_input_tokens": 0,
+ "cache_creation": {"ephemeral_5m_input_tokens": 0, "ephemeral_1h_input_tokens": 0},
+ "output_tokens": 12,
+ "output_tokens_details": {"thinking_tokens": 0},
+ "service_tier": "standard",
+ },
+ ExactExpected(spend=0.0028776, input_cost=0.0024816, output_cost=0.000396, prompt_tokens=376, completion_tokens=12),
+).model_copy(update={"model": _MANTLE_CLAUDE_OPUS_MODEL})
+
+BEDROCK_MANTLE_CLAUDE_OPUS_5_5_CHAT_BRIDGED_JSON: Final = BEDROCK_MANTLE_CLAUDE_OPUS_5_5_INPUT_TEXT.model_copy(
+ update={
+ "name": "bedrock_mantle-anthropic.claude-opus-5-5-chat_bridged_json",
+ "response": BEDROCK_MANTLE_CLAUDE_OPUS_5_5_MESSAGES_INPUT_TEXT.response,
+ }
+)
+
+BRIDGE_COST_PARITY: Final[tuple[BridgeCostParityTestCase, ...]] = (
+ _mantle_gpt_bridge(_MANTLE_GPT_61_SOL_CASES[0]),
+ _mantle_gpt_bridge(_MANTLE_GPT_6_LUNA_CASES[0]),
+ _mantle_gpt_bridge(_MANTLE_GPT_6_ASTRA_CASES[0]),
+ _mantle_gpt_bridge(_MANTLE_GPT_56_TERRA_CASES[0]),
+ BridgeCostParityTestCase(
+ native=BEDROCK_MANTLE_CLAUDE_OPUS_5_5_MESSAGES_INPUT_TEXT,
+ bridged=BEDROCK_MANTLE_CLAUDE_OPUS_5_5_CHAT_BRIDGED_JSON,
+ ),
+)
+
CASES: Final[tuple[CostTrackingTestCase, ...]] = (
BEDROCK_MANTLE_OPENAI_GPT_6_SOL_RESPONSES_JSON,
BEDROCK_MANTLE_OPENAI_GPT_6_SOL_RESPONSES_STREAM,
@@ -512,10 +941,35 @@ CASES: Final[tuple[CostTrackingTestCase, ...]] = (
BEDROCK_MANTLE_OPENAI_GPT_6_SOL_TIERED_INPUT_ABOVE_272K,
BEDROCK_MANTLE_OPENAI_GPT_6_SOL_TIERED_CACHE_READ_ABOVE_272K,
BEDROCK_MANTLE_OPENAI_GPT_6_SOL_TIERED_AT_272K_BOUNDARY,
+ *_MANTLE_GPT_61_SOL_CASES,
+ *_MANTLE_GPT_6_LUNA_CASES,
+ *_MANTLE_GPT_6_ASTRA_CASES,
+ *_MANTLE_GPT_56_TERRA_CASES,
+ BEDROCK_MANTLE_CLAUDE_OPUS_5_5_INPUT_TEXT,
+ BEDROCK_MANTLE_CLAUDE_OPUS_5_5_STREAM,
+ BEDROCK_MANTLE_CLAUDE_OPUS_5_5_MESSAGES_INPUT_TEXT,
+ BEDROCK_MANTLE_CLAUDE_OPUS_5_5_MESSAGES_STREAM,
+ BEDROCK_MANTLE_CLAUDE_OPUS_5_5_CHAT_BRIDGED_JSON,
+ BEDROCK_MANTLE_CLAUDE_OPUS_5_5_CACHE_READ,
+ BEDROCK_MANTLE_CLAUDE_OPUS_5_5_CACHE_WRITE_5M,
+ BEDROCK_MANTLE_CLAUDE_OPUS_5_5_CACHE_WRITE_1H,
+ BEDROCK_MANTLE_CLAUDE_OPUS_5_5_THINKING,
+ BEDROCK_MANTLE_CLAUDE_OPUS_5_5_TOOL_CALL,
)
PARITY: Final[tuple[StreamParityTestCase, ...]] = (
StreamParityTestCase(
plain=BEDROCK_MANTLE_OPENAI_GPT_6_SOL_RESPONSES_JSON, streamed=BEDROCK_MANTLE_OPENAI_GPT_6_SOL_RESPONSES_STREAM
),
+ StreamParityTestCase(plain=_MANTLE_GPT_61_SOL_CASES[0], streamed=_MANTLE_GPT_61_SOL_CASES[1]),
+ StreamParityTestCase(plain=_MANTLE_GPT_6_LUNA_CASES[0], streamed=_MANTLE_GPT_6_LUNA_CASES[1]),
+ StreamParityTestCase(plain=_MANTLE_GPT_6_ASTRA_CASES[0], streamed=_MANTLE_GPT_6_ASTRA_CASES[1]),
+ StreamParityTestCase(plain=_MANTLE_GPT_56_TERRA_CASES[0], streamed=_MANTLE_GPT_56_TERRA_CASES[1]),
+ StreamParityTestCase(
+ plain=BEDROCK_MANTLE_CLAUDE_OPUS_5_5_INPUT_TEXT, streamed=BEDROCK_MANTLE_CLAUDE_OPUS_5_5_STREAM
+ ),
+ StreamParityTestCase(
+ plain=BEDROCK_MANTLE_CLAUDE_OPUS_5_5_MESSAGES_INPUT_TEXT,
+ streamed=BEDROCK_MANTLE_CLAUDE_OPUS_5_5_MESSAGES_STREAM,
+ ),
)
diff --git a/tests/integration/cost_calculation/cases/gemini.py b/tests/integration/cost_calculation/cases/gemini.py
index 220ce2023be..bd64f4aeb11 100644
--- a/tests/integration/cost_calculation/cases/gemini.py
+++ b/tests/integration/cost_calculation/cases/gemini.py
@@ -87,6 +87,7 @@ GEMINI_GEMINI_3_1_PRO_INPUT_TEXT: Final = CostTrackingTestCase(
"candidatesTokenCount": 412,
"totalTokenCount": 2252,
"promptTokensDetails": [{"modality": "TEXT", "tokenCount": 1840}],
+ "serviceTier": "standard",
},
"modelVersion": "gemini-3.1-pro",
},
@@ -141,6 +142,7 @@ GEMINI_GEMINI_3_1_PRO_CACHE_READ: Final = CostTrackingTestCase(
"totalTokenCount": 13308,
"cachedContentTokenCount": 12288,
"promptTokensDetails": [{"modality": "TEXT", "tokenCount": 12928}],
+ "serviceTier": "standard",
},
"modelVersion": "gemini-3.1-pro",
},
@@ -386,6 +388,7 @@ GEMINI_GEMINI_3_1_PRO_REASONING: Final = CostTrackingTestCase(
"thoughtsTokenCount": 3480,
"totalTokenCount": 5280,
"promptTokensDetails": [{"modality": "TEXT", "tokenCount": 1240}],
+ "serviceTier": "standard",
},
"modelVersion": "gemini-3.1-pro",
},
@@ -1600,254 +1603,9 @@ GEMINI_GEMINI_3_8_FLASH_CACHE_READ: Final = CostTrackingTestCase(
),
)
-GEMINI_GEMINI_3_8_FLASH_AUDIO_INPUT: Final = CostTrackingTestCase(
- name="gemini-gemini-3.8-flash-audio_input",
- covers="quota_management.spend_tracking.cost_matrix.logs_cost",
- model="gemini/gemini-3.8-flash",
- request={
- "model": "$MODEL",
- "messages": [
- {
- "role": "system",
- "content": [
- {
- "type": "text",
- "text": "You are a deterministic pricing-harness assistant. Keep answers to a single short line.",
- }
- ],
- },
- {
- "role": "user",
- "content": [
- {
- "type": "text",
- "text": "99e65f16c4b4 summarize the attached material in one line and name the city weather",
- },
- {
- "type": "input_audio",
- "input_audio": {
- "data": "UklGRmQGAABXQVZFZm10IBAAAAABAAEAQB8AAIA+AAACABAAZGF0YUAGAAAAAA8I4A85F+EdpCNYKNkrCy7eLkwuWSwTKZUk/x59GEERgQl4AWb5hPER6kbjVd1t2LLUQdIu0X/RM9M81oTa6t9E5mPtD/UP/SQFEw2fFI0bqSHEJrgqZi27LqouNi1pKlkmJSH0GvUTXgxpBFP8WPS27KflYt8U2ujV/dJp0TjRbNL71NPY1d3b47nqOPIh+jUCOQrwER0ZjB8JJW0plCxoLtou5i2VK/cnKSNOHZUWLw9VB0T/OPdv7yToj+Hi20nX5tPT0SDR09Hm00nX4tuP4STob+8490T/VQcvD5UWTh0pI/cnlSvmLdouaC6ULG0pCSWMHx0Z8BE5CjUCIfo48rnq2+PV3dPY+9Rs0jjRadH90ujVFNpi36fltuxY9FP8aQReDPUT9BolIVkmaSo2Laouuy5mLbgqxCapIY0bnxQTDSQFD/0P9WPtRObq34TaPNYz03/RLtFB0rLUbdhV3UbjEeqE8Wb5eAGBCUERfRj/HpUkEylZLEwu3i4LLtkrWCikI+EdORfgDw8IAADx9yDwx+gf4lzcqNcn1PXRItG00afT7dZr2wHhg+e/7n/2iP6aBnwO7xW6HKsikydOK78t0i6BLs0sxCl8JRYgvBmdEvEK8QLc+u3yYetz5FfePNlI1ZrSRdFW0crSl9Wn2dveDOUL7KLzl/utA6gLShNZGp4g7CUYKgMtly7ILpQtBSstJysiJRxHFcgN3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UQ7uPmdOD32pPWbNOY0SbRGtJr1AnY19yy4mvp0fCr+LwAyAiRENwXcR4eJLcoGiwtLuAuLS4aLLcoHiRxHtwXkRDICLwAq/jR8GvpsuLX3AnYa9Qa0ibRmNFs05PW99p04OPmEO7H9cv93wXIDUcVJRwrIi0nBSuULcguly4DLRgq7CWeIFkaShOoC60Dl/ui8wvsDOXb3qfZl9XK0lbRRdGa0kjVPNlX3nPkYevt8tz68QLxCp0SvBkWIHwlxCnNLIEu0i6/LU4rkyerIroc7xV8DpoGiP5/9r/ug+cB4Wvb7dan07TRItH10SfUqNdc3B/ix+gg8PH3",
- "format": "wav",
- },
- },
- ],
- },
- ],
- "stream": False,
- "modalities": ["text"],
- "allowed_openai_params": ["modalities"],
- },
- response=JsonResponse(
- content_type="application/json",
- body={
- "candidates": [
- {
- "content": {"parts": [{"text": "scripted answer 99e65f16c4b4"}], "role": "model"},
- "finishReason": "STOP",
- "index": 0,
- }
- ],
- "usageMetadata": {
- "promptTokenCount": 1546,
- "candidatesTokenCount": 210,
- "totalTokenCount": 1756,
- "promptTokensDetails": [
- {"modality": "TEXT", "tokenCount": 96},
- {"modality": "AUDIO", "tokenCount": 1450},
- ],
- },
- "modelVersion": "gemini-3.8-flash",
- },
- ),
- expected=ExactExpected(
- spend=0.002128, input_cost=0.001498, output_cost=0.00063, prompt_tokens=1546, completion_tokens=210
- ),
-)
-GEMINI_GEMINI_3_8_FLASH_AUDIO_OUTPUT: Final = CostTrackingTestCase(
- name="gemini-gemini-3.8-flash-audio_output",
- covers="quota_management.spend_tracking.cost_matrix.logs_cost",
- model="gemini/gemini-3.8-flash",
- request={
- "model": "$MODEL",
- "messages": [
- {
- "role": "system",
- "content": [
- {
- "type": "text",
- "text": "You are a deterministic pricing-harness assistant. Keep answers to a single short line.",
- }
- ],
- },
- {
- "role": "user",
- "content": [
- {
- "type": "text",
- "text": "6fc6e4823e02 summarize the attached material in one line and name the city weather",
- }
- ],
- },
- ],
- "stream": False,
- "modalities": ["text", "audio"],
- "audio": {"voice": "alloy", "format": "pcm16"},
- "allowed_openai_params": ["modalities", "audio"],
- },
- response=JsonResponse(
- content_type="application/json",
- body={
- "candidates": [
- {
- "content": {"parts": [{"text": "scripted answer 6fc6e4823e02"}], "role": "model"},
- "finishReason": "STOP",
- "index": 0,
- }
- ],
- "usageMetadata": {
- "promptTokenCount": 220,
- "candidatesTokenCount": 1300,
- "totalTokenCount": 1520,
- "promptTokensDetails": [{"modality": "TEXT", "tokenCount": 220}],
- "candidatesTokensDetails": [
- {"modality": "TEXT", "tokenCount": 180},
- {"modality": "AUDIO", "tokenCount": 1120},
- ],
- },
- "modelVersion": "gemini-3.8-flash",
- },
- ),
- expected=ExactExpected(
- spend=0.00737, input_cost=0.00011, output_cost=0.00726, prompt_tokens=220, completion_tokens=1300
- ),
-)
-GEMINI_GEMINI_3_8_FLASH_IMAGE_INPUT: Final = CostTrackingTestCase(
- name="gemini-gemini-3.8-flash-image_input",
- covers="quota_management.spend_tracking.cost_matrix.logs_cost",
- model="gemini/gemini-3.8-flash",
- request={
- "model": "$MODEL",
- "messages": [
- {
- "role": "system",
- "content": [
- {
- "type": "text",
- "text": "You are a deterministic pricing-harness assistant. Keep answers to a single short line.",
- }
- ],
- },
- {
- "role": "user",
- "content": [
- {
- "type": "text",
- "text": "ca377dd90846 summarize the attached material in one line and name the city weather",
- },
- {
- "type": "image_url",
- "image_url": {
- "url": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAIAAAD8GO2jAAAMK0lEQVR4nAEgDN/zAM0HLNi+b59irEwJwoIG5+NVlKprNC9dCjpeSEL6tCj3YubiguXBZXx4w6lns2cR6zkGp8hgPXHUCeelTYe9wfcEQgJ6rx+pW3+GWJV430PkExZ66Nnc6zd2KDOBGnGnIwBzhiZIL2HGI3lifMEk1EYYPG5NnqGlpcz3LiFAwwS9/Goh5egSF1aINdSX+yErhrSeZWrPBkEWmgtZ9OYpQ58l2dRlT+yNSBn7QNa6ssjgEhx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PpSpDgGRu/k4jMev9x1vlc3EdAIz+WBCWU23SZoIT3WfyVNpXi7azEQkSB7e1K+fS25uGiNScc4/Nn8BVsUqtwtGhM5nncB7tH0F/k0ngZeGmqEGNJw01v2UYpLQoxwqhCz7/X5it8liVJMxk2kQ3iCGYnwDwfHcl7gLJGiAqrjLBOlp17bPGYIGTlFw+TOCLsGS103TZvSbyptAazsca/TY3o5hZLqX7SBvnfL6s/SU7BVyQY4PpZwHLa6PI2w+uFmJZbBsaruCVPW+FL+zSfvPO560ABJLD6nKsReNBwoxShnNi1XPSmX+C7Ij/ik2nfzubk6IFlomrI0bs386ztTMDifWKNO0ZnC+Oau6ZgwE4PwF8AqKtGFd5yqG0aMFq9rvwPb8DZCXmUHN5Uc40cNG5HWNSAK1yFAkCcG2GPV/7JYEi3t9ZA8NBeh9Dmvsjv8jiaeknPCij14x6BmGOFzyVNqRcS8x517fM39S0cC6bzu8wbnh96fwQ9z/JzCEsqxV9KjuES+xv3rYkX+r3JxcK7p78EACPip85gRBoIU7cZgrwLepMArrpA9YvR8Icag3YILzWcgXVoVRTs6Xc2PsiKasZ98y5CBkmP9Ri3lwZ9acgvPJ1fw729yDzDl/0qEeBOf7ZYZ7dreaPeaGHIymfgKAwmwhnjvAGaqLWhgAAAABJRU5ErkJggg==",
- "detail": "high",
- },
- },
- ],
- },
- ],
- "stream": False,
- "allowed_openai_params": [],
- },
- response=JsonResponse(
- content_type="application/json",
- body={
- "candidates": [
- {
- "content": {"parts": [{"text": "scripted answer ca377dd90846"}], "role": "model"},
- "finishReason": "STOP",
- "index": 0,
- }
- ],
- "usageMetadata": {
- "promptTokenCount": 2116,
- "candidatesTokenCount": 240,
- "totalTokenCount": 2356,
- "promptTokensDetails": [
- {"modality": "TEXT", "tokenCount": 310},
- {"modality": "IMAGE", "tokenCount": 1806},
- ],
- },
- "modelVersion": "gemini-3.8-flash",
- },
- ),
- expected=ExactExpected(
- spend=0.0018683, input_cost=0.0011483, output_cost=0.00072, prompt_tokens=2116, completion_tokens=240
- ),
-)
-GEMINI_GEMINI_3_8_FLASH_VIDEO_INPUT: Final = CostTrackingTestCase(
- name="gemini-gemini-3.8-flash-video_input",
- covers="quota_management.spend_tracking.cost_matrix.logs_cost",
- model="gemini/gemini-3.8-flash",
- request={
- "model": "$MODEL",
- "messages": [
- {
- "role": "system",
- "content": [
- {
- "type": "text",
- "text": "You are a deterministic pricing-harness assistant. Keep answers to a single short line.",
- }
- ],
- },
- {
- "role": "user",
- "content": [
- {
- "type": "text",
- "text": "030071a5c80f summarize the attached material in one line and name the city weather",
- },
- {
- "type": "file",
- "file": {
- "file_data": "data:video/mp4;base64,AAAAGGZ0eXBpc29tAAACAGlzb21pc282AAACCG1kYXQNFBsiKTA3PkVMU1phaG92fYSLkpmgp661vMPK0djf5u30+wIJEBceJSwzOkFIT1ZdZGtyeYCHjpWco6qxuL/GzdTb4unw9/4FDBMaISgvNj1ES1JZYGdudXyDipGYn6attLvCydDX3uXs8/oBCA8WHSQrMjlAR05VXGNqcXh/ho2Um6KpsLe+xczT2uHo7/b9BAsSGSAnLjU8Q0pRWF9mbXR7gomQl56lrLO6wcjP1t3k6/L5AAcOFRwjKjE4P0ZNVFtiaXB3foWMk5qhqK+2vcTL0tng5+71/AMKERgfJi00O0JJUFdeZWxzeoGIj5adpKuyucDHztXc4+rx+P8GDRQbIikwNz5FTFNaYWhvdn2Ei5KZoKeutbzDytHY3+bt9PsCCRAXHiUsMzpBSE9WXWRrcnmAh46VnKOqsbi/xs3U2+Lp8Pf+BQwTGiEoLzY9REtSWWBnbnV8g4qRmJ+mrbS7wsnQ197l7PP6AQgPFh0kKzI5QEdOVVxjanF4f4aNlJuiqbC3vsXM09rh6O/2/QQLEhkgJy41PENKUVhfZm10e4KJkJeepayzusHIz9bd5Ovy+QAHDhUcIyoxOD9GTVRbYmlwd36FjJOaoaivtr3Ey9LZ4Ofu9fwDChEYHyYtNDtCSVBXXmVsc3qBiI+WnaSrsrnAx87V3OPq8fj/Bg==",
- "format": "mp4",
- },
- },
- ],
- },
- ],
- "stream": False,
- "allowed_openai_params": [],
- },
- response=JsonResponse(
- content_type="application/json",
- body={
- "candidates": [
- {
- "content": {"parts": [{"text": "scripted answer 030071a5c80f"}], "role": "model"},
- "finishReason": "STOP",
- "index": 0,
- }
- ],
- "usageMetadata": {
- "promptTokenCount": 8060,
- "candidatesTokenCount": 300,
- "totalTokenCount": 8360,
- "promptTokensDetails": [
- {"modality": "TEXT", "tokenCount": 140},
- {"modality": "VIDEO", "tokenCount": 7920},
- ],
- },
- "modelVersion": "gemini-3.8-flash",
- },
- ),
- expected=ExactExpected(
- spend=0.005722, input_cost=0.004822, output_cost=0.0009, prompt_tokens=8060, completion_tokens=300
- ),
-)
GEMINI_GEMINI_3_8_FLASH_REASONING: Final = CostTrackingTestCase(
name="gemini-gemini-3.8-flash-reasoning",
@@ -2316,60 +2074,6 @@ GEMINI_GEMINI_3_8_FLASH_STREAM_NO_USAGE_TOOL_CALL: Final = CostTrackingTestCase(
expected=RecountExpected(recount=RecountRates(input_cost_per_token=5e-07, output_cost_per_token=3e-06)),
)
-GEMINI_GEMINI_3_8_FLASH_STREAM_NO_USAGE_IMAGE_INPUT: Final = CostTrackingTestCase(
- name="gemini-gemini-3.8-flash-stream_no_usage_image_input",
- covers="quota_management.spend_tracking.scripted_wire.logs_cost",
- model="gemini/gemini-3.8-flash",
- request={
- "model": "$MODEL",
- "messages": [
- {
- "role": "system",
- "content": [
- {
- "type": "text",
- "text": "You are a deterministic pricing-harness assistant. Keep answers to a single short line.",
- }
- ],
- },
- {
- "role": "user",
- "content": [
- {
- "type": "text",
- "text": "5fca57bc9ae9 summarize the attached material in one line and name the city weather",
- },
- {
- "type": "image_url",
- "image_url": {
- "url": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAIAAAD8GO2jAAAMK0lEQVR4nAEgDN/zAM0HLNi+b59irEwJwoIG5+NVlKprNC9dCjpeSEL6tCj3YubiguXBZXx4w6lns2cR6zk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2mBQBaVitoQ4y7KzqHnrBWSxLIyznP3v/VNlzgF7qcPaQiDYhyGAgLfihsZE5nQZLcedY4Apm3dhEOyMUpdzNNyViCP6ykfFn35Ss3JDUS7lfZV47bpxeatoe2dNzU5TGxY9GoVYvhKXmP0WjgOpwv91XPF/x1ty0JRgNGVMwnwxk4PpSpDgGRu/k4jMev9x1vlc3EdAIz+WBCWU23SZoIT3WfyVNpXi7azEQkSB7e1K+fS25uGiNScc4/Nn8BVsUqtwtGhM5nncB7tH0F/k0ngZeGmqEGNJw01v2UYpLQoxwqhCz7/X5it8liVJMxk2kQ3iCGYnwDwfHcl7gLJGiAqrjLBOlp17bPGYIGTlFw+TOCLsGS103TZvSbyptAazsca/TY3o5hZLqX7SBvnfL6s/SU7BVyQY4PpZwHLa6PI2w+uFmJZbBsaruCVPW+FL+zSfvPO560ABJLD6nKsReNBwoxShnNi1XPSmX+C7Ij/ik2nfzubk6IFlomrI0bs386ztTMDifWKNO0ZnC+Oau6ZgwE4PwF8AqKtGFd5yqG0aMFq9rvwPb8DZCXmUHN5Uc40cNG5HWNSAK1yFAkCcG2GPV/7JYEi3t9ZA8NBeh9Dmvsjv8jiaeknPCij14x6BmGOFzyVNqRcS8x517fM39S0cC6bzu8wbnh96fwQ9z/JzCEsqxV9KjuES+xv3rYkX+r3JxcK7p78EACPip85gRBoIU7cZgrwLepMArrpA9YvR8Icag3YILzWcgXVoVRTs6Xc2PsiKasZ98y5CBkmP9Ri3lwZ9acgvPJ1fw729yDzDl/0qEeBOf7ZYZ7dreaPeaGHIymfgKAwmwhnjvAGaqLWhgAAAABJRU5ErkJggg==",
- "detail": "high",
- },
- },
- ],
- },
- ],
- "stream": True,
- "stream_options": {"include_usage": True},
- "allowed_openai_params": [],
- },
- response=SseResponse(
- content_type="text/event-stream",
- frames=sse_frames(
- {
- "candidates": [
- {
- "content": {"parts": [{"text": "scripted answer 5fca57bc9ae9"}], "role": "model"},
- "finishReason": "STOP",
- "index": 0,
- }
- ],
- "modelVersion": "gemini-3.8-flash",
- }
- ),
- ),
- expected=RecountExpected(recount=RecountRates(input_cost_per_token=5e-07, output_cost_per_token=3e-06)),
-)
GEMINI_GEMINI_3_8_FLASH_PROMPT_BLOCKED: Final = CostTrackingTestCase(
name="gemini-gemini-3.8-flash-prompt_blocked",
@@ -3641,10 +3345,6 @@ CASES: Final[tuple[CostTrackingTestCase, ...]] = (
GEMINI_GEMINI_3_1_PRO_STREAM_FULL_USAGE,
GEMINI_GEMINI_3_8_FLASH_INPUT_TEXT,
GEMINI_GEMINI_3_8_FLASH_CACHE_READ,
- GEMINI_GEMINI_3_8_FLASH_AUDIO_INPUT,
- GEMINI_GEMINI_3_8_FLASH_AUDIO_OUTPUT,
- GEMINI_GEMINI_3_8_FLASH_IMAGE_INPUT,
- GEMINI_GEMINI_3_8_FLASH_VIDEO_INPUT,
GEMINI_GEMINI_3_8_FLASH_REASONING,
GEMINI_GEMINI_3_8_FLASH_SERVICE_TIER_FLEX,
GEMINI_GEMINI_3_8_FLASH_SERVICE_TIER_PRIORITY,
@@ -3653,7 +3353,6 @@ CASES: Final[tuple[CostTrackingTestCase, ...]] = (
GEMINI_GEMINI_3_8_FLASH_STREAM,
GEMINI_GEMINI_3_8_FLASH_STREAM_NO_USAGE,
GEMINI_GEMINI_3_8_FLASH_STREAM_NO_USAGE_TOOL_CALL,
- GEMINI_GEMINI_3_8_FLASH_STREAM_NO_USAGE_IMAGE_INPUT,
GEMINI_GEMINI_3_8_FLASH_PROMPT_BLOCKED,
GEMINI_GEMINI_3_8_FLASH_STREAM_PROMPT_BLOCKED,
GEMINI_GEMINI_3_8_FLASH_RESPONSE_MODEL_OVERRIDE,
diff --git a/tests/integration/cost_calculation/cases/vertex_ai.py b/tests/integration/cost_calculation/cases/vertex_ai.py
index e19e377ae93..761078ef593 100644
--- a/tests/integration/cost_calculation/cases/vertex_ai.py
+++ b/tests/integration/cost_calculation/cases/vertex_ai.py
@@ -248,7 +248,9 @@ GEMINI_3_1_PRO_INPUT_TEXT: Final = CostTrackingTestCase(
"promptTokenCount": 1840,
"candidatesTokenCount": 412,
"totalTokenCount": 2252,
+ "trafficType": "ON_DEMAND",
"promptTokensDetails": [{"modality": "TEXT", "tokenCount": 1840}],
+ "candidatesTokensDetails": [{"modality": "TEXT", "tokenCount": 412}],
},
"modelVersion": "gemini-3.1-pro",
},
@@ -302,7 +304,9 @@ GEMINI_3_1_PRO_CACHE_READ: Final = CostTrackingTestCase(
"candidatesTokenCount": 380,
"totalTokenCount": 13308,
"cachedContentTokenCount": 12288,
+ "trafficType": "ON_DEMAND",
"promptTokensDetails": [{"modality": "TEXT", "tokenCount": 12928}],
+ "candidatesTokensDetails": [{"modality": "TEXT", "tokenCount": 380}],
},
"modelVersion": "gemini-3.1-pro",
},
@@ -935,7 +939,9 @@ GEMINI_3_1_PRO_STREAM: Final = CostTrackingTestCase(
"promptTokenCount": 1840,
"candidatesTokenCount": 412,
"totalTokenCount": 2252,
+ "trafficType": "ON_DEMAND",
"promptTokensDetails": [{"modality": "TEXT", "tokenCount": 1840}],
+ "candidatesTokensDetails": [{"modality": "TEXT", "tokenCount": 412}],
},
"modelVersion": "gemini-3.1-pro",
},
@@ -1667,9 +1673,9 @@ GEMINI_3_1_PRO_PASSTHROUGH_STREAM_GENERATE_CONTENT_PRICED_VIA_VERTEX_KEY: Final
# gemini-3.8-flash
GEMINI_3_8_FLASH_INPUT_TEXT: Final = CostTrackingTestCase(
- name="gemini-3.8-flash-input_text",
+ name="vertex_ai/gemini-3.8-flash-input_text",
covers="quota_management.spend_tracking.cost_matrix.logs_cost",
- model="gemini-3.8-flash",
+ model="vertex_ai/gemini-3.8-flash",
request={
"model": "$MODEL",
"messages": [
@@ -1720,9 +1726,9 @@ GEMINI_3_8_FLASH_INPUT_TEXT: Final = CostTrackingTestCase(
)
GEMINI_3_8_FLASH_CACHE_READ: Final = CostTrackingTestCase(
- name="gemini-3.8-flash-cache_read",
+ name="vertex_ai/gemini-3.8-flash-cache_read",
covers="quota_management.spend_tracking.cost_matrix.logs_cost",
- model="gemini-3.8-flash",
+ model="vertex_ai/gemini-3.8-flash",
request={
"model": "$MODEL",
"messages": [
@@ -1773,196 +1779,13 @@ GEMINI_3_8_FLASH_CACHE_READ: Final = CostTrackingTestCase(
),
)
-GEMINI_3_8_FLASH_AUDIO_INPUT: Final = CostTrackingTestCase(
- name="gemini-3.8-flash-audio_input",
- covers="quota_management.spend_tracking.cost_matrix.logs_cost",
- model="gemini-3.8-flash",
- request={
- "model": "$MODEL",
- "messages": [
- {
- "role": "system",
- "content": [
- {
- "type": "text",
- "text": "You are a deterministic pricing-harness assistant. Keep answers to a single short line.",
- }
- ],
- },
- {
- "role": "user",
- "content": [
- {
- "type": "text",
- "text": "3e33892c4f9f summarize the attached material in one line and name the city weather",
- },
- {
- "type": "input_audio",
- "input_audio": {
- "data": "UklGRmQGAABXQVZFZm10IBAAAAABAAEAQB8AAIA+AAACABAAZGF0YUAGAAAAAA8I4A85F+EdpCNYKNkrCy7eLkwuWSwTKZUk/x59GEERgQl4AWb5hPER6kbjVd1t2LLUQdIu0X/RM9M81oTa6t9E5mPtD/UP/SQFEw2fFI0bqSHEJrgqZi27LqouNi1pKlkmJSH0GvUTXgxpBFP8WPS27KflYt8U2ujV/dJp0TjRbNL71NPY1d3b47nqOPIh+jUCOQrwER0ZjB8JJW0plCxoLtou5i2VK/cnKSNOHZUWLw9VB0T/OPdv7yToj+Hi20nX5tPT0SDR09Hm00nX4tuP4STob+8490T/VQcvD5UWTh0pI/cnlSvmLdouaC6ULG0pCSWMHx0Z8BE5CjUCIfo48rnq2+PV3dPY+9Rs0jjRadH90ujVFNpi36fltuxY9FP8aQReDPUT9BolIVkmaSo2Laouuy5mLbgqxCapIY0bnxQTDSQFD/0P9WPtRObq34TaPNYz03/RLtFB0rLUbdhV3UbjEeqE8Wb5eAGBCUERfRj/HpUkEylZLEwu3i4LLtkrWCikI+EdORfgDw8IAADx9yDwx+gf4lzcqNcn1PXRItG00afT7dZr2wHh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uf/aI/poGfA7vFbocqyKTJ04rvy3SLoEuzSzEKXwlFiC8GZ0S8QrxAtz67fJh63PkV9482UjVmtJF0VbRytKX1afZ294M5QvsovOX+60DqAtKE1kaniDsJRgqAy2XLsgulC0FKy0nKyIlHEcVyA3fBcv9x/UQ7uPmdOD32pPWbNOY0SbRGtJr1AnY19yy4mvp0fCr+LwAyAiRENwXcR4eJLcoGiwtLuAuLS4aLLcoHiRxHtwXkRDICLwAq/jR8GvpsuLX3AnYa9Qa0ibRmNFs05PW99p04OPmEO7H9cv93wXIDUcVJRwrIi0nBSuULcguly4DLRgq7CWeIFkaShOoC60Dl/ui8wvsDOXb3qfZl9XK0lbRRdGa0kjVPNlX3nPkYevt8tz68QLxCp0SvBkWIHwlxCnNLIEu0i6/LU4rkyerIroc7xV8DpoGiP5/9r/ug+cB4Wvb7dan07TRItH10SfUqNdc3B/ix+gg8PH3",
- "format": "wav",
- },
- },
- ],
- },
- ],
- "stream": False,
- "modalities": ["text"],
- "allowed_openai_params": ["modalities"],
- },
- response=JsonResponse(
- content_type="application/json",
- body={
- "candidates": [
- {
- "content": {"parts": [{"text": "scripted answer 3e33892c4f9f"}], "role": "model"},
- "finishReason": "STOP",
- "index": 0,
- }
- ],
- "usageMetadata": {
- "promptTokenCount": 1546,
- "candidatesTokenCount": 210,
- "totalTokenCount": 1756,
- "promptTokensDetails": [
- {"modality": "TEXT", "tokenCount": 96},
- {"modality": "AUDIO", "tokenCount": 1450},
- ],
- },
- "modelVersion": "gemini-3.8-flash",
- },
- ),
- expected=ExactExpected(
- spend=0.00221312, input_cost=0.00155792, output_cost=0.0006552, prompt_tokens=1546, completion_tokens=210
- ),
-)
-GEMINI_3_8_FLASH_AUDIO_OUTPUT: Final = CostTrackingTestCase(
- name="gemini-3.8-flash-audio_output",
- covers="quota_management.spend_tracking.cost_matrix.logs_cost",
- model="gemini-3.8-flash",
- request={
- "model": "$MODEL",
- "messages": [
- {
- "role": "system",
- "content": [
- {
- "type": "text",
- "text": "You are a deterministic pricing-harness assistant. Keep answers to a single short line.",
- }
- ],
- },
- {
- "role": "user",
- "content": [
- {
- "type": "text",
- "text": "30bf1c0de6fe summarize the attached material in one line and name the city weather",
- }
- ],
- },
- ],
- "stream": False,
- "modalities": ["text", "audio"],
- "audio": {"voice": "alloy", "format": "pcm16"},
- "allowed_openai_params": ["modalities", "audio"],
- },
- response=JsonResponse(
- content_type="application/json",
- body={
- "candidates": [
- {
- "content": {"parts": [{"text": "scripted answer 30bf1c0de6fe"}], "role": "model"},
- "finishReason": "STOP",
- "index": 0,
- }
- ],
- "usageMetadata": {
- "promptTokenCount": 220,
- "candidatesTokenCount": 1300,
- "totalTokenCount": 1520,
- "promptTokensDetails": [{"modality": "TEXT", "tokenCount": 220}],
- "candidatesTokensDetails": [
- {"modality": "TEXT", "tokenCount": 180},
- {"modality": "AUDIO", "tokenCount": 1120},
- ],
- },
- "modelVersion": "gemini-3.8-flash",
- },
- ),
- expected=ExactExpected(
- spend=0.0076648, input_cost=0.0001144, output_cost=0.0075504, prompt_tokens=220, completion_tokens=1300
- ),
-)
-GEMINI_3_8_FLASH_VIDEO_INPUT: Final = CostTrackingTestCase(
- name="gemini-3.8-flash-video_input",
- covers="quota_management.spend_tracking.cost_matrix.logs_cost",
- model="gemini-3.8-flash",
- request={
- "model": "$MODEL",
- "messages": [
- {
- "role": "system",
- "content": [
- {
- "type": "text",
- "text": "You are a deterministic pricing-harness assistant. Keep answers to a single short line.",
- }
- ],
- },
- {
- "role": "user",
- "content": [
- {
- "type": "text",
- "text": "5f5da5957185 summarize the attached material in one line and name the city weather",
- },
- {
- "type": "file",
- "file": {
- "file_data": "data:video/mp4;base64,AAAAGGZ0eXBpc29tAAACAGlzb21pc282AAACCG1kYXQNFBsiKTA3PkVMU1phaG92fYSLkpmgp661vMPK0djf5u30+wIJEBceJSwzOkFIT1ZdZGtyeYCHjpWco6qxuL/GzdTb4unw9/4FDBMaISgvNj1ES1JZYGdudXyDipGYn6attLvCydDX3uXs8/oBCA8WHSQrMjlAR05VXGNqcXh/ho2Um6KpsLe+xczT2uHo7/b9BAsSGSAnLjU8Q0pRWF9mbXR7gomQl56lrLO6wcjP1t3k6/L5AAcOFRwjKjE4P0ZNVFtiaXB3foWMk5qhqK+2vcTL0tng5+71/AMKERgfJi00O0JJUFdeZWxzeoGIj5adpKuyucDHztXc4+rx+P8GDRQbIikwNz5FTFNaYWhvdn2Ei5KZoKeutbzDytHY3+bt9PsCCRAXHiUsMzpBSE9WXWRrcnmAh46VnKOqsbi/xs3U2+Lp8Pf+BQwTGiEoLzY9REtSWWBnbnV8g4qRmJ+mrbS7wsnQ197l7PP6AQgPFh0kKzI5QEdOVVxjanF4f4aNlJuiqbC3vsXM09rh6O/2/QQLEhkgJy41PENKUVhfZm10e4KJkJeepayzusHIz9bd5Ovy+QAHDhUcIyoxOD9GTVRbYmlwd36FjJOaoaivtr3Ey9LZ4Ofu9fwDChEYHyYtNDtCSVBXXmVsc3qBiI+WnaSrsrnAx87V3OPq8fj/Bg==",
- "format": "mp4",
- },
- },
- ],
- },
- ],
- "stream": False,
- "allowed_openai_params": [],
- },
- response=JsonResponse(
- content_type="application/json",
- body={
- "candidates": [
- {
- "content": {"parts": [{"text": "scripted answer 5f5da5957185"}], "role": "model"},
- "finishReason": "STOP",
- "index": 0,
- }
- ],
- "usageMetadata": {
- "promptTokenCount": 8060,
- "candidatesTokenCount": 300,
- "totalTokenCount": 8360,
- "promptTokensDetails": [
- {"modality": "TEXT", "tokenCount": 140},
- {"modality": "VIDEO", "tokenCount": 7920},
- ],
- },
- "modelVersion": "gemini-3.8-flash",
- },
- ),
- expected=ExactExpected(
- spend=0.0059192, input_cost=0.0049832, output_cost=0.000936, prompt_tokens=8060, completion_tokens=300
- ),
-)
GEMINI_3_8_FLASH_SERVICE_TIER_FLEX: Final = CostTrackingTestCase(
- name="gemini-3.8-flash-service_tier_flex",
+ name="vertex_ai/gemini-3.8-flash-service_tier_flex",
covers="quota_management.spend_tracking.cost_matrix.logs_cost",
- model="gemini-3.8-flash",
+ model="vertex_ai/gemini-3.8-flash",
request={
"model": "$MODEL",
"messages": [
@@ -2014,9 +1837,9 @@ GEMINI_3_8_FLASH_SERVICE_TIER_FLEX: Final = CostTrackingTestCase(
)
GEMINI_3_8_FLASH_SERVICE_TIER_PRIORITY: Final = CostTrackingTestCase(
- name="gemini-3.8-flash-service_tier_priority",
+ name="vertex_ai/gemini-3.8-flash-service_tier_priority",
covers="quota_management.spend_tracking.cost_matrix.logs_cost",
- model="gemini-3.8-flash",
+ model="vertex_ai/gemini-3.8-flash",
request={
"model": "$MODEL",
"messages": [
@@ -2068,9 +1891,9 @@ GEMINI_3_8_FLASH_SERVICE_TIER_PRIORITY: Final = CostTrackingTestCase(
)
GEMINI_3_8_FLASH_WEB_SEARCH_PER_PROMPT: Final = CostTrackingTestCase(
- name="gemini-3.8-flash-web_search_per_prompt",
+ name="vertex_ai/gemini-3.8-flash-web_search_per_prompt",
covers="quota_management.spend_tracking.cost_matrix.logs_cost",
- model="gemini-3.8-flash",
+ model="vertex_ai/gemini-3.8-flash",
request={
"model": "$MODEL",
"messages": [
@@ -2118,14 +1941,14 @@ GEMINI_3_8_FLASH_WEB_SEARCH_PER_PROMPT: Final = CostTrackingTestCase(
},
),
expected=ExactExpected(
- spend=0.03724224, input_cost=0.0009568, output_cost=0.00128544, prompt_tokens=1840, completion_tokens=412
+ spend=0.10724224, input_cost=0.0009568, output_cost=0.00128544, prompt_tokens=1840, completion_tokens=412
),
)
GEMINI_3_8_FLASH_GOOGLE_MAPS_GROUNDING: Final = CostTrackingTestCase(
- name="gemini-3.8-flash-google_maps_grounding",
+ name="vertex_ai/gemini-3.8-flash-google_maps_grounding",
covers="quota_management.spend_tracking.cost_matrix.logs_cost",
- model="gemini-3.8-flash",
+ model="vertex_ai/gemini-3.8-flash",
request={
"model": "$MODEL",
"messages": [
@@ -2182,9 +2005,9 @@ GEMINI_3_8_FLASH_GOOGLE_MAPS_GROUNDING: Final = CostTrackingTestCase(
)
GEMINI_3_8_FLASH_FALLBACK_IMAGE_TOKENS_AT_INPUT_RATE: Final = CostTrackingTestCase(
- name="gemini-3.8-flash-fallback_image_tokens_at_input_rate",
+ name="vertex_ai/gemini-3.8-flash-fallback_image_tokens_at_input_rate",
covers="quota_management.spend_tracking.cost_matrix.logs_cost",
- model="gemini-3.8-flash",
+ model="vertex_ai/gemini-3.8-flash",
request={
"model": "$MODEL",
"messages": [
@@ -2245,9 +2068,9 @@ GEMINI_3_8_FLASH_FALLBACK_IMAGE_TOKENS_AT_INPUT_RATE: Final = CostTrackingTestCa
)
GEMINI_3_8_FLASH_STREAM: Final = CostTrackingTestCase(
- name="gemini-3.8-flash-stream",
+ name="vertex_ai/gemini-3.8-flash-stream",
covers="quota_management.spend_tracking.scripted_wire.logs_cost",
- model="gemini-3.8-flash",
+ model="vertex_ai/gemini-3.8-flash",
request={
"model": "$MODEL",
"messages": [
@@ -2305,9 +2128,9 @@ GEMINI_3_8_FLASH_STREAM: Final = CostTrackingTestCase(
)
GEMINI_3_8_FLASH_STREAM_NO_USAGE: Final = CostTrackingTestCase(
- name="gemini-3.8-flash-stream_no_usage",
+ name="vertex_ai/gemini-3.8-flash-stream_no_usage",
covers="quota_management.spend_tracking.scripted_wire.logs_cost",
- model="gemini-3.8-flash",
+ model="vertex_ai/gemini-3.8-flash",
request={
"model": "$MODEL",
"messages": [
@@ -2357,9 +2180,9 @@ GEMINI_3_8_FLASH_STREAM_NO_USAGE: Final = CostTrackingTestCase(
)
GEMINI_3_8_FLASH_STREAM_NO_USAGE_TOOL_CALL: Final = CostTrackingTestCase(
- name="gemini-3.8-flash-stream_no_usage_tool_call",
+ name="vertex_ai/gemini-3.8-flash-stream_no_usage_tool_call",
covers="quota_management.spend_tracking.scripted_wire.logs_cost",
- model="gemini-3.8-flash",
+ model="vertex_ai/gemini-3.8-flash",
request={
"model": "$MODEL",
"messages": [
@@ -2441,9 +2264,9 @@ GEMINI_3_8_FLASH_STREAM_NO_USAGE_TOOL_CALL: Final = CostTrackingTestCase(
)
GEMINI_3_8_FLASH_STREAM_NO_USAGE_IMAGE_INPUT: Final = CostTrackingTestCase(
- name="gemini-3.8-flash-stream_no_usage_image_input",
+ name="vertex_ai/gemini-3.8-flash-stream_no_usage_image_input",
covers="quota_management.spend_tracking.scripted_wire.logs_cost",
- model="gemini-3.8-flash",
+ model="vertex_ai/gemini-3.8-flash",
request={
"model": "$MODEL",
"messages": [
@@ -2500,9 +2323,9 @@ GEMINI_3_8_FLASH_STREAM_NO_USAGE_IMAGE_INPUT: Final = CostTrackingTestCase(
)
GEMINI_3_8_FLASH_PROMPT_BLOCKED: Final = CostTrackingTestCase(
- name="gemini-3.8-flash-prompt_blocked",
+ name="vertex_ai/gemini-3.8-flash-prompt_blocked",
covers="quota_management.spend_tracking.scripted_wire.logs_cost",
- model="gemini-3.8-flash",
+ model="vertex_ai/gemini-3.8-flash",
request={
"model": "$MODEL",
"messages": [
@@ -2550,9 +2373,9 @@ GEMINI_3_8_FLASH_PROMPT_BLOCKED: Final = CostTrackingTestCase(
)
GEMINI_3_8_FLASH_STREAM_PROMPT_BLOCKED: Final = CostTrackingTestCase(
- name="gemini-3.8-flash-stream_prompt_blocked",
+ name="vertex_ai/gemini-3.8-flash-stream_prompt_blocked",
covers="quota_management.spend_tracking.scripted_wire.logs_cost",
- model="gemini-3.8-flash",
+ model="vertex_ai/gemini-3.8-flash",
request={
"model": "$MODEL",
"messages": [
@@ -2607,9 +2430,9 @@ GEMINI_3_8_FLASH_STREAM_PROMPT_BLOCKED: Final = CostTrackingTestCase(
)
GEMINI_3_8_FLASH_RESPONSE_MODEL_OVERRIDE: Final = CostTrackingTestCase(
- name="gemini-3.8-flash-response_model_override",
+ name="vertex_ai/gemini-3.8-flash-response_model_override",
covers="quota_management.spend_tracking.scripted_wire.logs_cost",
- model="gemini-3.8-flash",
+ model="vertex_ai/gemini-3.8-flash",
request={
"model": "$MODEL",
"messages": [
@@ -2660,9 +2483,9 @@ GEMINI_3_8_FLASH_RESPONSE_MODEL_OVERRIDE: Final = CostTrackingTestCase(
)
GEMINI_3_8_FLASH_STREAM_RESPONSE_MODEL_OVERRIDE: Final = CostTrackingTestCase(
- name="gemini-3.8-flash-stream_response_model_override",
+ name="vertex_ai/gemini-3.8-flash-stream_response_model_override",
covers="quota_management.spend_tracking.scripted_wire.logs_cost",
- model="gemini-3.8-flash",
+ model="vertex_ai/gemini-3.8-flash",
request={
"model": "$MODEL",
"messages": [
@@ -2720,9 +2543,9 @@ GEMINI_3_8_FLASH_STREAM_RESPONSE_MODEL_OVERRIDE: Final = CostTrackingTestCase(
)
GEMINI_3_8_FLASH_TOOL_CALL: Final = CostTrackingTestCase(
- name="gemini-3.8-flash-tool_call",
+ name="vertex_ai/gemini-3.8-flash-tool_call",
covers="quota_management.spend_tracking.scripted_wire.logs_cost",
- model="gemini-3.8-flash",
+ model="vertex_ai/gemini-3.8-flash",
request={
"model": "$MODEL",
"messages": [
@@ -2807,9 +2630,9 @@ GEMINI_3_8_FLASH_TOOL_CALL: Final = CostTrackingTestCase(
)
GEMINI_3_8_FLASH_STREAM_TOOL_CALL: Final = CostTrackingTestCase(
- name="gemini-3.8-flash-stream_tool_call",
+ name="vertex_ai/gemini-3.8-flash-stream_tool_call",
covers="quota_management.spend_tracking.scripted_wire.logs_cost",
- model="gemini-3.8-flash",
+ model="vertex_ai/gemini-3.8-flash",
request={
"model": "$MODEL",
"messages": [
@@ -2901,9 +2724,9 @@ GEMINI_3_8_FLASH_STREAM_TOOL_CALL: Final = CostTrackingTestCase(
)
GEMINI_3_8_FLASH_STREAM_FULL_USAGE: Final = CostTrackingTestCase(
- name="gemini-3.8-flash-stream_full_usage",
+ name="vertex_ai/gemini-3.8-flash-stream_full_usage",
covers="quota_management.spend_tracking.scripted_wire.logs_cost",
- model="gemini-3.8-flash",
+ model="vertex_ai/gemini-3.8-flash",
request={
"model": "$MODEL",
"messages": [
@@ -2965,7 +2788,7 @@ GEMINI_3_8_FLASH_STREAM_FULL_USAGE: Final = CostTrackingTestCase(
),
),
expected=ExactExpected(
- spend=0.006992128, input_cost=0.001619488, output_cost=0.00537264, prompt_tokens=8314, completion_tokens=1592
+ spend=0.005775328, input_cost=0.001276288, output_cost=0.00449904, prompt_tokens=8314, completion_tokens=1592
),
)
@@ -3301,26 +3124,182 @@ VERTEX_AI_CLAUDE_FABLE_5_1_TOOL_CALL: Final = _vertex_claude_shape_case(
GEMINI_3_1_PRO_PREVIEW_INPUT_TEXT: Final = _gemini_case(
- GEMINI_3_8_FLASH_INPUT_TEXT, "gemini-3.1-pro-preview-input_text", "gemini-3.1-pro-preview",
+ GEMINI_3_8_FLASH_INPUT_TEXT, "vertex_ai/gemini-3.1-pro-preview-input_text", "vertex_ai/gemini-3.1-pro-preview",
ExactExpected(spend=0.0094864, input_cost=0.004048, output_cost=0.0054384, prompt_tokens=1840, completion_tokens=412)
)
GEMINI_3_1_PRO_PREVIEW_STREAM: Final = _gemini_case(
- GEMINI_3_8_FLASH_STREAM, "gemini-3.1-pro-preview-stream", "gemini-3.1-pro-preview",
+ GEMINI_3_8_FLASH_STREAM, "vertex_ai/gemini-3.1-pro-preview-stream", "vertex_ai/gemini-3.1-pro-preview",
ExactExpected(spend=0.0094864, input_cost=0.004048, output_cost=0.0054384, prompt_tokens=1840, completion_tokens=412)
)
GEMINI_3_1_PRO_PREVIEW_CACHE_READ: Final = _gemini_case(
- GEMINI_3_8_FLASH_CACHE_READ, "gemini-3.1-pro-preview-cache_read", "gemini-3.1-pro-preview",
+ GEMINI_3_8_FLASH_CACHE_READ, "vertex_ai/gemini-3.1-pro-preview-cache_read", "vertex_ai/gemini-3.1-pro-preview",
ExactExpected(spend=0.00912736, input_cost=0.00411136, output_cost=0.005016, prompt_tokens=12928, completion_tokens=380)
)
GEMINI_3_1_PRO_PREVIEW_REASONING: Final = _gemini_case(
- GEMINI_3_1_PRO_REASONING, "gemini-3.1-pro-preview-reasoning", "gemini-3.1-pro-preview",
+ GEMINI_3_1_PRO_REASONING, "vertex_ai/gemini-3.1-pro-preview-reasoning", "vertex_ai/gemini-3.1-pro-preview",
ExactExpected(spend=0.056056, input_cost=0.002728, output_cost=0.053328, prompt_tokens=1240, completion_tokens=4040)
)
GEMINI_3_1_PRO_PREVIEW_TOOL_CALL: Final = _gemini_case(
- GEMINI_3_8_FLASH_TOOL_CALL, "gemini-3.1-pro-preview-tool_call", "gemini-3.1-pro-preview",
+ GEMINI_3_8_FLASH_TOOL_CALL, "vertex_ai/gemini-3.1-pro-preview-tool_call", "vertex_ai/gemini-3.1-pro-preview",
ExactExpected(spend=0.0094864, input_cost=0.004048, output_cost=0.0054384, prompt_tokens=1840, completion_tokens=412)
)
+GEMINI_4_ARGON_INPUT_TEXT: Final = GEMINI_3_8_FLASH_INPUT_TEXT.model_copy(
+ update={
+ "name": "vertex_ai/gemini-4-argon-input_text",
+ "model": "vertex_ai/gemini-4-argon",
+ "response": JsonResponse(
+ content_type="application/json",
+ body={
+ "candidates": [
+ {
+ "content": {"parts": [{"text": "Hello."}], "role": "model"},
+ "finishReason": "STOP",
+ "index": 0,
+ }
+ ],
+ "usageMetadata": {
+ "promptTokenCount": 37,
+ "candidatesTokenCount": 6,
+ "totalTokenCount": 43,
+ "trafficType": "ON_DEMAND",
+ "promptTokensDetails": [{"modality": "TEXT", "tokenCount": 37}],
+ "candidatesTokensDetails": [{"modality": "TEXT", "tokenCount": 6}],
+ },
+ "modelVersion": "gemini-4-argon",
+ },
+ ),
+ "expected": ExactExpected(
+ spend=0.0001608, input_cost=0.0000888, output_cost=0.000072, prompt_tokens=37, completion_tokens=6
+ ),
+ }
+)
+GEMINI_4_ARGON_STREAM: Final = GEMINI_3_8_FLASH_STREAM.model_copy(
+ update={
+ "name": "vertex_ai/gemini-4-argon-stream",
+ "model": "vertex_ai/gemini-4-argon",
+ "response": SseResponse(
+ content_type="text/event-stream",
+ frames=sse_frames(
+ {
+ "candidates": [{"content": {"role": "model", "parts": [{"text": "Hello."}]}}],
+ "usageMetadata": {"trafficType": "ON_DEMAND"},
+ "modelVersion": "gemini-4-argon",
+ },
+ {
+ "candidates": [{"content": {"role": "model", "parts": [{"text": ""}]}, "finishReason": "STOP"}],
+ "usageMetadata": {
+ "promptTokenCount": 37,
+ "candidatesTokenCount": 6,
+ "totalTokenCount": 43,
+ "trafficType": "ON_DEMAND",
+ "promptTokensDetails": [{"modality": "TEXT", "tokenCount": 37}],
+ "candidatesTokensDetails": [{"modality": "TEXT", "tokenCount": 6}],
+ },
+ "modelVersion": "gemini-4-argon",
+ },
+ ),
+ ),
+ "expected": ExactExpected(
+ spend=0.0001608, input_cost=0.0000888, output_cost=0.000072, prompt_tokens=37, completion_tokens=6
+ ),
+ }
+)
+GEMINI_4_ARGON_CACHE_READ: Final = GEMINI_3_8_FLASH_CACHE_READ.model_copy(
+ update={
+ "name": "vertex_ai/gemini-4-argon-cache_read",
+ "model": "vertex_ai/gemini-4-argon",
+ "response": JsonResponse(
+ content_type="application/json",
+ body={
+ "candidates": [
+ {"content": {"parts": [{"text": "Understood."}], "role": "model"}, "finishReason": "STOP"}
+ ],
+ "usageMetadata": {
+ "promptTokenCount": 13532,
+ "candidatesTokenCount": 21,
+ "totalTokenCount": 13553,
+ "cachedContentTokenCount": 11478,
+ "trafficType": "ON_DEMAND",
+ "promptTokensDetails": [{"modality": "TEXT", "tokenCount": 13532}],
+ "cacheTokensDetails": [{"modality": "TEXT", "tokenCount": 11478}],
+ "candidatesTokensDetails": [{"modality": "TEXT", "tokenCount": 21}],
+ },
+ "modelVersion": "gemini-4-argon",
+ },
+ ),
+ "expected": ExactExpected(
+ spend=0.00655896, input_cost=0.00630696, output_cost=0.000252, prompt_tokens=13532, completion_tokens=21
+ ),
+ }
+)
+GEMINI_4_ARGON_REASONING: Final = GEMINI_3_1_PRO_REASONING.model_copy(
+ update={
+ "name": "vertex_ai/gemini-4-argon-reasoning",
+ "model": "vertex_ai/gemini-4-argon",
+ "response": JsonResponse(
+ content_type="application/json",
+ body={
+ "candidates": [
+ {
+ "content": {
+ "parts": [{"text": "Hello.", "thought": True}, {"text": "Hello."}],
+ "role": "model",
+ },
+ "finishReason": "STOP",
+ "index": 0,
+ }
+ ],
+ "usageMetadata": {
+ "promptTokenCount": 37,
+ "candidatesTokenCount": 6,
+ "totalTokenCount": 162,
+ "trafficType": "ON_DEMAND",
+ "promptTokensDetails": [{"modality": "TEXT", "tokenCount": 37}],
+ "candidatesTokensDetails": [{"modality": "TEXT", "tokenCount": 6}],
+ "thoughtsTokenCount": 119,
+ },
+ "modelVersion": "gemini-4-argon",
+ },
+ ),
+ "expected": ExactExpected(
+ spend=0.0015888, input_cost=0.0000888, output_cost=0.0015, prompt_tokens=37, completion_tokens=125
+ ),
+ }
+)
+GEMINI_4_ARGON_TOOL_CALL: Final = GEMINI_3_8_FLASH_TOOL_CALL.model_copy(
+ update={
+ "name": "vertex_ai/gemini-4-argon-tool_call",
+ "model": "vertex_ai/gemini-4-argon",
+ "response": JsonResponse(
+ content_type="application/json",
+ body={
+ "candidates": [
+ {
+ "content": {
+ "parts": [{"functionCall": {"name": "report_weather", "args": {"city": "Paris"}}}],
+ "role": "model",
+ },
+ "finishReason": "STOP",
+ "index": 0,
+ }
+ ],
+ "usageMetadata": {
+ "promptTokenCount": 90,
+ "candidatesTokenCount": 22,
+ "totalTokenCount": 112,
+ "trafficType": "ON_DEMAND",
+ "promptTokensDetails": [{"modality": "TEXT", "tokenCount": 90}],
+ "candidatesTokensDetails": [{"modality": "TEXT", "tokenCount": 22}],
+ },
+ "modelVersion": "gemini-4-argon",
+ },
+ ),
+ "expected": ExactExpected(
+ spend=0.00048, input_cost=0.000216, output_cost=0.000264, prompt_tokens=90, completion_tokens=22
+ ),
+ }
+)
CASES: Final[tuple[CostTrackingTestCase, ...]] = (
GEMINI_3_1_PRO_INPUT_TEXT,
@@ -3348,9 +3327,6 @@ CASES: Final[tuple[CostTrackingTestCase, ...]] = (
GEMINI_3_1_PRO_STREAM_FULL_USAGE,
GEMINI_3_8_FLASH_INPUT_TEXT,
GEMINI_3_8_FLASH_CACHE_READ,
- GEMINI_3_8_FLASH_AUDIO_INPUT,
- GEMINI_3_8_FLASH_AUDIO_OUTPUT,
- GEMINI_3_8_FLASH_VIDEO_INPUT,
GEMINI_3_8_FLASH_SERVICE_TIER_FLEX,
GEMINI_3_8_FLASH_SERVICE_TIER_PRIORITY,
GEMINI_3_8_FLASH_WEB_SEARCH_PER_PROMPT,
@@ -3396,6 +3372,11 @@ CASES: Final[tuple[CostTrackingTestCase, ...]] = (
GEMINI_3_1_PRO_PREVIEW_CACHE_READ,
GEMINI_3_1_PRO_PREVIEW_REASONING,
GEMINI_3_1_PRO_PREVIEW_TOOL_CALL,
+ GEMINI_4_ARGON_INPUT_TEXT,
+ GEMINI_4_ARGON_STREAM,
+ GEMINI_4_ARGON_CACHE_READ,
+ GEMINI_4_ARGON_REASONING,
+ GEMINI_4_ARGON_TOOL_CALL,
)
PARITY: Final[tuple[StreamParityTestCase, ...]] = (
@@ -3417,6 +3398,7 @@ PARITY: Final[tuple[StreamParityTestCase, ...]] = (
StreamParityTestCase(plain=VERTEX_AI_CLAUDE_OPUS_5_5_INPUT_TEXT, streamed=VERTEX_AI_CLAUDE_OPUS_5_5_STREAM),
StreamParityTestCase(plain=VERTEX_AI_CLAUDE_FABLE_5_1_INPUT_TEXT, streamed=VERTEX_AI_CLAUDE_FABLE_5_1_STREAM),
StreamParityTestCase(plain=GEMINI_3_1_PRO_PREVIEW_INPUT_TEXT, streamed=GEMINI_3_1_PRO_PREVIEW_STREAM),
+ StreamParityTestCase(plain=GEMINI_4_ARGON_INPUT_TEXT, streamed=GEMINI_4_ARGON_STREAM),
)
BRIDGE_COST_PARITY: Final[tuple[BridgeCostParityTestCase, ...]] = (
@@ -3425,4 +3407,5 @@ BRIDGE_COST_PARITY: Final[tuple[BridgeCostParityTestCase, ...]] = (
("/v1/responses", "/v1/messages"),
),
*bridge_pairs((GEMINI_3_1_PRO_PREVIEW_INPUT_TEXT,), ("/v1/responses",)),
+ *bridge_pairs((GEMINI_4_ARGON_INPUT_TEXT,), ("/v1/responses",)),
)
diff --git a/tests/integration/cost_calculation/catalog.py b/tests/integration/cost_calculation/catalog.py
index 66eb7497bd7..568a89ad967 100644
--- a/tests/integration/cost_calculation/catalog.py
+++ b/tests/integration/cost_calculation/catalog.py
@@ -60,6 +60,7 @@ REALTIME_CASES: Final[tuple[RealtimeCostCase, ...]] = batch_realtime.REALTIME_CA
BRIDGE_COST_PARITY_CASES: Final[tuple[BridgeCostParityTestCase, ...]] = (
*openai.BRIDGE_COST_PARITY,
*bedrock_converse.BRIDGE_COST_PARITY,
+ *bedrock_mantle.BRIDGE_COST_PARITY,
*azure.BRIDGE_COST_PARITY,
*anthropic.BRIDGE_COST_PARITY,
*gemini.BRIDGE_COST_PARITY,
diff --git a/tests/integration/cost_calculation/cost_map.py b/tests/integration/cost_calculation/cost_map.py
index 686636dacbd..5e2b99a113f 100644
--- a/tests/integration/cost_calculation/cost_map.py
+++ b/tests/integration/cost_calculation/cost_map.py
@@ -492,18 +492,14 @@ COST_MAP_ENTRIES: Final[dict[str, dict[str, JsonValue]]] = {
"cache_read_input_token_cost_flex": 2.5e-08,
"cache_read_input_token_cost_priority": 9e-08,
"google_maps_grounding_cost_per_query": 0.025,
- "input_cost_per_audio_token": 1e-06,
- "input_cost_per_image_token": 5.5e-07,
"input_cost_per_token": 5e-07,
"input_cost_per_token_flex": 2.5e-07,
"input_cost_per_token_priority": 6.25e-07,
- "input_cost_per_video_token": 6e-07,
"litellm_provider": "gemini",
"max_input_tokens": 1048576,
"max_output_tokens": 65536,
"max_tokens": 65536,
"mode": "chat",
- "output_cost_per_audio_token": 6e-06,
"output_cost_per_reasoning_token": 3.5e-06,
"output_cost_per_token": 3e-06,
"output_cost_per_token_flex": 1.5e-06,
@@ -536,7 +532,7 @@ COST_MAP_ENTRIES: Final[dict[str, dict[str, JsonValue]]] = {
"supports_function_calling": True,
"web_search_billing_unit": "per_query",
},
- "gemini-3.1-pro-preview": {
+ "vertex_ai/gemini-3.1-pro-preview": {
"cache_creation_input_token_cost_above_200k_tokens": 2.75e-07,
"cache_read_input_token_cost": 2.2e-07,
"cache_read_input_token_cost_above_200k_tokens": 4.4e-07,
@@ -547,7 +543,7 @@ COST_MAP_ENTRIES: Final[dict[str, dict[str, JsonValue]]] = {
"input_cost_per_token_above_200k_tokens_priority": 7.92e-06,
"input_cost_per_token_flex": 1.1e-06,
"input_cost_per_token_priority": 3.96e-06,
- "litellm_provider": "vertex_ai-language-models",
+ "litellm_provider": "vertex_ai",
"max_input_tokens": 1048576,
"max_output_tokens": 65536,
"max_tokens": 65536,
@@ -558,33 +554,70 @@ COST_MAP_ENTRIES: Final[dict[str, dict[str, JsonValue]]] = {
"output_cost_per_token_above_200k_tokens_priority": 3.564e-05,
"output_cost_per_token_flex": 6.6e-06,
"output_cost_per_token_priority": 2.376e-05,
+ "google_maps_grounding_cost_per_query": 0.0154,
+ "search_context_cost_per_query": {
+ "search_context_size_high": 0.0154,
+ "search_context_size_low": 0.0154,
+ "search_context_size_medium": 0.0154,
+ },
"supports_function_calling": True,
"supports_prompt_caching": True,
"supports_reasoning": True,
},
- "gemini-3.8-flash": {
+ "vertex_ai/gemini-3.8-flash": {
"cache_read_input_token_cost": 5.2e-08,
"cache_read_input_token_cost_flex": 2.6e-08,
"cache_read_input_token_cost_priority": 9.36e-08,
"google_maps_grounding_cost_per_query": 0.025,
- "input_cost_per_audio_token": 1.04e-06,
"input_cost_per_token": 5.2e-07,
"input_cost_per_token_flex": 2.6e-07,
"input_cost_per_token_priority": 6.5e-07,
- "input_cost_per_video_token": 6.2e-07,
- "litellm_provider": "vertex_ai-language-models",
+ "litellm_provider": "vertex_ai",
"max_input_tokens": 1048576,
"max_output_tokens": 65536,
"max_tokens": 65536,
"mode": "chat",
- "output_cost_per_audio_token": 6.24e-06,
"output_cost_per_token": 3.12e-06,
"output_cost_per_reasoning_token": 2.6e-06,
"output_cost_per_token_flex": 1.56e-06,
"output_cost_per_token_priority": 3.9e-06,
- "search_context_cost_per_query": {"search_context_size_medium": 0.035},
+ "search_context_cost_per_query": {
+ "search_context_size_high": 0.035,
+ "search_context_size_low": 0.035,
+ "search_context_size_medium": 0.035,
+ },
"supports_function_calling": True,
- "web_search_billing_unit": "per_prompt",
+ "supports_prompt_caching": True,
+ "supports_reasoning": True,
+ "web_search_billing_unit": "per_query",
+ },
+ "vertex_ai/gemini-4-argon": {
+ "cache_read_input_token_cost": 1.2e-07,
+ "cache_read_input_token_cost_flex": 6e-08,
+ "cache_read_input_token_cost_priority": 2.16e-07,
+ "google_maps_grounding_cost_per_query": 0.0168,
+ "input_cost_per_audio_token": 2.4e-06,
+ "input_cost_per_token": 2.4e-06,
+ "input_cost_per_token_flex": 1.2e-06,
+ "input_cost_per_token_priority": 4.32e-06,
+ "litellm_provider": "vertex_ai",
+ "max_input_tokens": 1048576,
+ "max_output_tokens": 1048576,
+ "max_tokens": 1048576,
+ "mode": "chat",
+ "output_cost_per_reasoning_token": 1.2e-05,
+ "output_cost_per_token": 1.2e-05,
+ "output_cost_per_token_flex": 6e-06,
+ "output_cost_per_token_priority": 2.16e-05,
+ "search_context_cost_per_query": {
+ "search_context_size_high": 0.0168,
+ "search_context_size_low": 0.0168,
+ "search_context_size_medium": 0.0168,
+ },
+ "supports_function_calling": True,
+ "supports_prompt_caching": True,
+ "supports_reasoning": True,
+ "web_search_billing_unit": "per_query",
},
"together_ai/moonshotai/Kimi-K3": {
"input_cost_per_token": 1.15e-06,
@@ -1078,6 +1111,126 @@ COST_MAP_ENTRIES: Final[dict[str, dict[str, JsonValue]]] = {
"supports_reasoning": True,
"supports_prompt_caching": True,
"supported_endpoints": ["/v1/chat/completions", "/v1/responses"],
+ "use_openai_responses_path": True,
+ },
+ "bedrock_mantle/openai.gpt-6.1-sol": {
+ "litellm_provider": "bedrock_mantle",
+ "mode": "responses",
+ "input_cost_per_token": 2.42e-06,
+ "output_cost_per_token": 1.21e-05,
+ "cache_read_input_token_cost": 1.21e-07,
+ "cache_creation_input_token_cost": 3.025e-06,
+ "input_cost_per_token_above_272k_tokens": 4.84e-06,
+ "output_cost_per_token_above_272k_tokens": 1.815e-05,
+ "cache_read_input_token_cost_above_272k_tokens": 2.42e-07,
+ "cache_creation_input_token_cost_above_272k_tokens": 6.05e-06,
+ "input_cost_per_token_ultrafast": 1.452e-05,
+ "output_cost_per_token_ultrafast": 7.26e-05,
+ "cache_read_input_token_cost_ultrafast": 7.26e-07,
+ "cache_creation_input_token_cost_ultrafast": 1.815e-05,
+ "input_cost_per_token_above_272k_tokens_ultrafast": 2.904e-05,
+ "output_cost_per_token_above_272k_tokens_ultrafast": 1.089e-04,
+ "cache_read_input_token_cost_above_272k_tokens_ultrafast": 1.452e-06,
+ "cache_creation_input_token_cost_above_272k_tokens_ultrafast": 3.63e-05,
+ "max_tokens": 131072,
+ "max_input_tokens": 1000000,
+ "max_output_tokens": 131072,
+ "supports_function_calling": True,
+ "supports_none_reasoning_effort": False,
+ "supports_reasoning": True,
+ "supports_prompt_caching": True,
+ "supported_endpoints": ["/v1/chat/completions", "/v1/responses"],
+ "use_openai_responses_path": True,
+ },
+ "bedrock_mantle/openai.gpt-6-luna": {
+ "litellm_provider": "bedrock_mantle",
+ "mode": "responses",
+ "input_cost_per_token": 1.32e-07,
+ "output_cost_per_token": 6.6e-07,
+ "cache_read_input_token_cost": 1.32e-08,
+ "cache_creation_input_token_cost": 1.65e-07,
+ "input_cost_per_token_above_272k_tokens": 2.64e-07,
+ "output_cost_per_token_above_272k_tokens": 9.9e-07,
+ "cache_read_input_token_cost_above_272k_tokens": 2.64e-08,
+ "cache_creation_input_token_cost_above_272k_tokens": 3.3e-07,
+ "max_tokens": 128000,
+ "max_input_tokens": 1050000,
+ "max_output_tokens": 128000,
+ "supports_function_calling": True,
+ "supports_none_reasoning_effort": False,
+ "supports_reasoning": True,
+ "supports_prompt_caching": True,
+ "supported_endpoints": ["/v1/chat/completions", "/v1/responses"],
+ "use_openai_responses_path": True,
+ },
+ "bedrock_mantle/openai.gpt-6-astra": {
+ "litellm_provider": "bedrock_mantle",
+ "mode": "responses",
+ "input_cost_per_token": 1.43e-05,
+ "output_cost_per_token": 7.15e-05,
+ "cache_read_input_token_cost": 1.43e-06,
+ "cache_creation_input_token_cost": 1.7875e-05,
+ "input_cost_per_token_above_272k_tokens": 2.86e-05,
+ "output_cost_per_token_above_272k_tokens": 1.0725e-04,
+ "cache_read_input_token_cost_above_272k_tokens": 2.86e-06,
+ "cache_creation_input_token_cost_above_272k_tokens": 3.575e-05,
+ "input_cost_per_token_ultrafast": 8.58e-05,
+ "output_cost_per_token_ultrafast": 4.29e-04,
+ "cache_read_input_token_cost_ultrafast": 8.58e-06,
+ "cache_creation_input_token_cost_ultrafast": 1.0725e-04,
+ "input_cost_per_token_above_272k_tokens_ultrafast": 1.716e-04,
+ "output_cost_per_token_above_272k_tokens_ultrafast": 6.435e-04,
+ "cache_read_input_token_cost_above_272k_tokens_ultrafast": 1.716e-05,
+ "cache_creation_input_token_cost_above_272k_tokens_ultrafast": 2.145e-04,
+ "max_tokens": 128000,
+ "max_input_tokens": 1050000,
+ "max_output_tokens": 128000,
+ "supports_function_calling": True,
+ "supports_none_reasoning_effort": False,
+ "supports_reasoning": True,
+ "supports_prompt_caching": True,
+ "supported_endpoints": ["/v1/chat/completions", "/v1/responses"],
+ "use_openai_responses_path": True,
+ },
+ "bedrock_mantle/openai.gpt-5.6-terra": {
+ "litellm_provider": "bedrock_mantle",
+ "mode": "responses",
+ "input_cost_per_token": 3.08e-06,
+ "output_cost_per_token": 1.848e-05,
+ "cache_read_input_token_cost": 3.08e-07,
+ "cache_creation_input_token_cost": 3.85e-06,
+ "input_cost_per_token_above_272k_tokens": 6.16e-06,
+ "output_cost_per_token_above_272k_tokens": 2.772e-05,
+ "cache_read_input_token_cost_above_272k_tokens": 6.16e-07,
+ "cache_creation_input_token_cost_above_272k_tokens": 7.7e-06,
+ "max_tokens": 128000,
+ "max_input_tokens": 1050000,
+ "max_output_tokens": 128000,
+ "supports_function_calling": True,
+ "supports_reasoning": True,
+ "supports_prompt_caching": True,
+ "supported_endpoints": ["/v1/chat/completions", "/v1/responses"],
+ "use_openai_responses_path": True,
+ "search_context_cost_per_query": {
+ "search_context_size_high": 0.0168,
+ "search_context_size_low": 0.0168,
+ "search_context_size_medium": 0.0168,
+ },
+ },
+ "bedrock_mantle/anthropic.claude-opus-5-5": {
+ "litellm_provider": "bedrock_mantle",
+ "mode": "chat",
+ "input_cost_per_token": 6.6e-06,
+ "output_cost_per_token": 3.3e-05,
+ "cache_read_input_token_cost": 3.3e-07,
+ "cache_creation_input_token_cost": 8.25e-06,
+ "cache_creation_input_token_cost_above_1hr": 1.32e-05,
+ "max_tokens": 128000,
+ "max_input_tokens": 1000000,
+ "max_output_tokens": 128000,
+ "supports_function_calling": True,
+ "supports_reasoning": True,
+ "supports_prompt_caching": True,
},
"us.anthropic.claude-opus-5-5": {
"cache_creation_input_token_cost_above_1hr": 8.8e-06,
@@ -1410,24 +1563,16 @@ COST_MAP_ENTRIES: Final[dict[str, dict[str, JsonValue]]] = {
"cache_creation_input_token_cost": 1.625e-07,
"cache_creation_input_token_cost_above_272k_tokens": 3.25e-07,
"input_cost_per_token": 1.3e-07,
- "input_cost_per_token_flex": 6.5e-08,
- "input_cost_per_token_priority": 2.6e-07,
"litellm_provider": "azure",
"max_input_tokens": 922000,
"max_output_tokens": 128000,
"max_tokens": 128000,
"mode": "chat",
"output_cost_per_token": 6.5e-07,
- "output_cost_per_token_flex": 3.25e-07,
- "output_cost_per_token_priority": 1.3e-06,
"supports_function_calling": True,
"supports_none_reasoning_effort": True,
"input_cost_per_token_above_272k_tokens": 2.6e-07,
- "input_cost_per_token_above_272k_tokens_flex": 1.3e-07,
- "input_cost_per_token_above_272k_tokens_priority": 5.2e-07,
"output_cost_per_token_above_272k_tokens": 1.3e-06,
- "output_cost_per_token_above_272k_tokens_flex": 6.5e-07,
- "output_cost_per_token_above_272k_tokens_priority": 2.6e-06,
"cache_read_input_token_cost_above_272k_tokens": 2.6e-08,
},
"azure/gpt-6-astra": {
@@ -1435,24 +1580,16 @@ COST_MAP_ENTRIES: Final[dict[str, dict[str, JsonValue]]] = {
"cache_creation_input_token_cost": 1.5625e-05,
"cache_creation_input_token_cost_above_272k_tokens": 3.125e-05,
"input_cost_per_token": 1.25e-05,
- "input_cost_per_token_flex": 6.25e-06,
- "input_cost_per_token_priority": 2.5e-05,
"litellm_provider": "azure",
"max_input_tokens": 922000,
"max_output_tokens": 128000,
"max_tokens": 128000,
"mode": "chat",
"output_cost_per_token": 6.25e-05,
- "output_cost_per_token_flex": 3.125e-05,
- "output_cost_per_token_priority": 0.000125,
"supports_function_calling": True,
"supports_none_reasoning_effort": True,
"input_cost_per_token_above_272k_tokens": 2.5e-05,
- "input_cost_per_token_above_272k_tokens_flex": 1.25e-05,
- "input_cost_per_token_above_272k_tokens_priority": 5e-05,
"output_cost_per_token_above_272k_tokens": 0.000125,
- "output_cost_per_token_above_272k_tokens_flex": 6.25e-05,
- "output_cost_per_token_above_272k_tokens_priority": 0.00025,
"cache_read_input_token_cost_above_272k_tokens": 2.5e-06,
},
"azure/gpt-6.1-sol": {
@@ -1460,24 +1597,16 @@ COST_MAP_ENTRIES: Final[dict[str, dict[str, JsonValue]]] = {
"cache_creation_input_token_cost": 3e-06,
"cache_creation_input_token_cost_above_272k_tokens": 6e-06,
"input_cost_per_token": 2.4e-06,
- "input_cost_per_token_flex": 1.2e-06,
- "input_cost_per_token_priority": 4.8e-06,
"litellm_provider": "azure",
"max_input_tokens": 922000,
"max_output_tokens": 128000,
"max_tokens": 128000,
"mode": "chat",
"output_cost_per_token": 1.2e-05,
- "output_cost_per_token_flex": 6e-06,
- "output_cost_per_token_priority": 2.4e-05,
"supports_function_calling": True,
"supports_none_reasoning_effort": True,
"input_cost_per_token_above_272k_tokens": 4.8e-06,
- "input_cost_per_token_above_272k_tokens_flex": 2.4e-06,
- "input_cost_per_token_above_272k_tokens_priority": 9.6e-06,
"output_cost_per_token_above_272k_tokens": 2.4e-05,
- "output_cost_per_token_above_272k_tokens_flex": 1.2e-05,
- "output_cost_per_token_above_272k_tokens_priority": 4.8e-05,
"cache_read_input_token_cost_above_272k_tokens": 4.8e-07,
},
}
diff --git a/tests/integration/cost_calculation/cost_tracking_case.py b/tests/integration/cost_calculation/cost_tracking_case.py
index 208d95e6a14..3efa97407f7 100644
--- a/tests/integration/cost_calculation/cost_tracking_case.py
+++ b/tests/integration/cost_calculation/cost_tracking_case.py
@@ -48,6 +48,7 @@ class CostMapEntry(BaseModel):
supports_reasoning: bool | None = None
supports_prompt_caching: bool | None = None
supported_endpoints: tuple[str, ...] | None = None
+ use_openai_responses_path: bool | None = None
supports_bedrock_runtime_chat_completions_tools_with_reasoning: bool | None = None
supports_bedrock_runtime_chat_completions_response_format: bool | None = None
cache_creation_input_token_cost_above_100k_tokens: float | None = None
@@ -572,6 +573,7 @@ _PROVIDER_PREFIXES: Final[Mapping[str, str]] = MappingProxyType(
"deepgram": "deepgram",
"text-completion-openai": "text-completion-openai",
"cohere": "cohere",
+ "vertex_ai": "vertex_ai",
"vertex_ai-language-models": "vertex_ai",
"vertex_ai-image-models": "vertex_ai",
"vertex_ai-anthropic_models": "vertex_ai",
@@ -621,6 +623,9 @@ _LITELLM_PARAMS: Final[Mapping[str, Mapping[str, str]]] = MappingProxyType(
"deepgram": MappingProxyType({}),
"text-completion-openai": MappingProxyType({}),
"cohere": MappingProxyType({}),
+ "vertex_ai": MappingProxyType(
+ {"vertex_project": "cc-scripted-project", "vertex_location": "us-central1"}
+ ),
"vertex_ai-language-models": MappingProxyType(
{"vertex_project": "cc-scripted-project", "vertex_location": "us-central1"}
),