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]

chore: merge litellm_cost_shard_pricing_dimensions into litellm_cost_shard_provider_wires

kerryedc34a29211d
diff --cc tests/integration/contracts.json
index 5585060ad4f,1c2fba247f0..290335037d5
--- a/tests/integration/contracts.json
+++ b/tests/integration/contracts.json
@@@ -1337,53 -1337,119 +1337,119 @@@
"quota_management.spend_tracking.scripted_wire.logs_cost"
],
"tests/integration/cost_calculation/test_cost_tracking.py::test_case_bills_expected_cost[whisper-next-transcriptions-per-second]": [
- "quota_management.spend_tracking.cost_matrix.logs_cost"
+ "quota_management.spend_tracking.cost_matrix.logs_cost"
],
"tests/integration/cost_calculation/test_cost_tracking.py::test_case_bills_expected_cost[whisper-verbose-next-transcriptions-duration]": [
- "quota_management.spend_tracking.cost_matrix.logs_cost"
+ "quota_management.spend_tracking.cost_matrix.logs_cost"
],
"tests/integration/cost_calculation/test_cost_tracking.py::test_case_bills_expected_cost[gpt-4o-transcribe-next-transcriptions-tokens]": [
- "quota_management.spend_tracking.cost_matrix.logs_cost"
+ "quota_management.spend_tracking.cost_matrix.logs_cost"
],
"tests/integration/cost_calculation/test_cost_tracking.py::test_case_bills_expected_cost[nova-next-transcriptions-per-second]": [
- "quota_management.spend_tracking.cost_matrix.logs_cost"
+ "quota_management.spend_tracking.cost_matrix.logs_cost"
],
"tests/integration/cost_calculation/test_cost_tracking.py::test_case_bills_expected_cost[azure-whisper-next-transcriptions-deployment]": [
- "quota_management.spend_tracking.cost_matrix.logs_cost"
+ "quota_management.spend_tracking.cost_matrix.logs_cost"
],
"tests/integration/cost_calculation/test_cost_tracking.py::test_case_bills_expected_cost[tts-next-speech-per-character]": [
- "quota_management.spend_tracking.cost_matrix.logs_cost"
+ "quota_management.spend_tracking.cost_matrix.logs_cost"
],
"tests/integration/cost_calculation/test_cost_tracking.py::test_case_bills_expected_cost[tts-next-hd-speech-per-character]": [
- "quota_management.spend_tracking.cost_matrix.logs_cost"
+ "quota_management.spend_tracking.cost_matrix.logs_cost"
],
"tests/integration/cost_calculation/test_cost_tracking.py::test_case_bills_expected_cost[azure-tts-next-speech-deployment]": [
- "quota_management.spend_tracking.cost_matrix.logs_cost"
+ "quota_management.spend_tracking.cost_matrix.logs_cost"
],
"tests/integration/cost_calculation/test_cost_tracking.py::test_case_bills_expected_cost[dall-e-3-next-images-standard]": [
- "quota_management.spend_tracking.cost_matrix.logs_cost"
+ "quota_management.spend_tracking.cost_matrix.logs_cost"
],
"tests/integration/cost_calculation/test_cost_tracking.py::test_case_bills_expected_cost[dall-e-3-next-images-hd]": [
- "quota_management.spend_tracking.cost_matrix.logs_cost"
+ "quota_management.spend_tracking.cost_matrix.logs_cost"
],
"tests/integration/cost_calculation/test_cost_tracking.py::test_case_bills_expected_cost[dall-e-3-next-images-wide]": [
- "quota_management.spend_tracking.cost_matrix.logs_cost"
+ "quota_management.spend_tracking.cost_matrix.logs_cost"
],
"tests/integration/cost_calculation/test_cost_tracking.py::test_case_bills_expected_cost[dall-e-3-next-images-two]": [
- "quota_management.spend_tracking.cost_matrix.logs_cost"
+ "quota_management.spend_tracking.cost_matrix.logs_cost"
],
"tests/integration/cost_calculation/test_cost_tracking.py::test_case_bills_expected_cost[gpt-image-next-images-low]": [
- "quota_management.spend_tracking.cost_matrix.logs_cost"
+ "quota_management.spend_tracking.cost_matrix.logs_cost"
],
"tests/integration/cost_calculation/test_cost_tracking.py::test_case_bills_expected_cost[imagen-next-images-one]": [
- "quota_management.spend_tracking.cost_matrix.logs_cost"
+ "quota_management.spend_tracking.cost_matrix.logs_cost"
],
"tests/integration/cost_calculation/test_cost_tracking.py::test_case_bills_expected_cost[amazon-nova-canvas-next-images-one]": [
- "quota_management.spend_tracking.cost_matrix.logs_cost"
+ "quota_management.spend_tracking.cost_matrix.logs_cost"
],
"tests/integration/cost_calculation/test_cost_tracking.py::test_case_bills_expected_cost[gpt-image-next-images-edit]": [
- "quota_management.spend_tracking.cost_matrix.logs_cost"
+ "quota_management.spend_tracking.cost_matrix.logs_cost"
],
+ "tests/integration/cost_calculation/test_cost_tracking.py::test_case_bills_expected_cost[azure-text-embeddings-4-large-deployment]": [
+ "quota_management.spend_tracking.cost_matrix.logs_cost"
+ ],
+ "tests/integration/cost_calculation/test_cost_tracking.py::test_case_bills_expected_cost[bedrock-cohere-embeddings-v4]": [
+ "quota_management.spend_tracking.cost_matrix.logs_cost"
+ ],
+ "tests/integration/cost_calculation/test_cost_tracking.py::test_case_bills_expected_cost[bedrock-cohere-rerank-v4]": [
+ "quota_management.spend_tracking.cost_matrix.logs_cost"
+ ],
+ "tests/integration/cost_calculation/test_cost_tracking.py::test_case_bills_expected_cost[bedrock-embeddings-titan-v2]": [
+ "quota_management.spend_tracking.cost_matrix.logs_cost"
+ ],
+ "tests/integration/cost_calculation/test_cost_tracking.py::test_case_bills_expected_cost[cohere-embeddings-v5]": [
+ "quota_management.spend_tracking.cost_matrix.logs_cost"
+ ],
+ "tests/integration/cost_calculation/test_cost_tracking.py::test_case_bills_expected_cost[cohere-rerank-v4-one]": [
+ "quota_management.spend_tracking.cost_matrix.logs_cost"
+ ],
+ "tests/integration/cost_calculation/test_cost_tracking.py::test_case_bills_expected_cost[cohere-rerank-v4-three]": [
+ "quota_management.spend_tracking.cost_matrix.logs_cost"
+ ],
+ "tests/integration/cost_calculation/test_cost_tracking.py::test_case_bills_expected_cost[cohere-rerank-v4-total-tokens-fallback]": [
+ "quota_management.spend_tracking.cost_matrix.logs_cost"
+ ],
+ "tests/integration/cost_calculation/test_cost_tracking.py::test_case_bills_expected_cost[fireworks-embeddings-v1]": [
+ "quota_management.spend_tracking.cost_matrix.logs_cost"
+ ],
+ "tests/integration/cost_calculation/test_cost_tracking.py::test_case_bills_expected_cost[gemini-embeddings-002]": [
+ "quota_management.spend_tracking.cost_matrix.logs_cost"
+ ],
+ "tests/integration/cost_calculation/test_cost_tracking.py::test_case_bills_expected_cost[omni-moderations-next-list]": [
+ "quota_management.spend_tracking.cost_matrix.logs_cost"
+ ],
+ "tests/integration/cost_calculation/test_cost_tracking.py::test_case_bills_expected_cost[omni-moderations-next-single]": [
+ "quota_management.spend_tracking.cost_matrix.logs_cost"
+ ],
+ "tests/integration/cost_calculation/test_cost_tracking.py::test_case_bills_expected_cost[text-completions-openai-basic]": [
+ "quota_management.spend_tracking.cost_matrix.logs_cost"
+ ],
+ "tests/integration/cost_calculation/test_cost_tracking.py::test_case_bills_expected_cost[text-completions-openai-n-best]": [
+ "quota_management.spend_tracking.cost_matrix.logs_cost"
+ ],
+ "tests/integration/cost_calculation/test_cost_tracking.py::test_case_bills_expected_cost[text-completions-openai-stream-usage]": [
+ "quota_management.spend_tracking.cost_matrix.logs_cost"
+ ],
+ "tests/integration/cost_calculation/test_cost_tracking.py::test_case_bills_expected_cost[text-embeddings-3-large-dimensions]": [
+ "quota_management.spend_tracking.cost_matrix.logs_cost"
+ ],
+ "tests/integration/cost_calculation/test_cost_tracking.py::test_case_bills_expected_cost[text-embeddings-4-small-batch]": [
+ "quota_management.spend_tracking.cost_matrix.logs_cost"
+ ],
+ "tests/integration/cost_calculation/test_cost_tracking.py::test_case_bills_expected_cost[text-embeddings-4-small-single]": [
+ "quota_management.spend_tracking.cost_matrix.logs_cost"
+ ],
+ "tests/integration/cost_calculation/test_cost_tracking.py::test_case_bills_expected_cost[text-embeddings-4-small-token-array]": [
+ "quota_management.spend_tracking.cost_matrix.logs_cost"
+ ],
+ "tests/integration/cost_calculation/test_cost_tracking.py::test_case_bills_expected_cost[together-completions-v1]": [
+ "quota_management.spend_tracking.cost_matrix.logs_cost"
+ ],
+ "tests/integration/cost_calculation/test_cost_tracking.py::test_case_bills_expected_cost[together-embeddings-v1]": [
+ "quota_management.spend_tracking.cost_matrix.logs_cost"
+ ],
+ "tests/integration/cost_calculation/test_cost_tracking.py::test_case_bills_expected_cost[vertex-embeddings-text-006]": [
+ "quota_management.spend_tracking.cost_matrix.logs_cost"
+ ],
"tests/integration/cost_calculation/test_cost_tracking.py::test_case_bills_expected_cost[gpt-5.6-responses_cache_read]": [
"quota_management.spend_tracking.cost_matrix.logs_cost"
],
diff --cc tests/integration/cost_calculation/cost_tracking_cases.json
index d532a6851fd,d9ebf238cd5..bb909de2e06
--- a/tests/integration/cost_calculation/cost_tracking_cases.json
+++ b/tests/integration/cost_calculation/cost_tracking_cases.json
@@@ -570,53 -561,97 +570,145 @@@
"mode": "image_generation",
"output_cost_per_image": 0.045
},
+ "bedrock/invoke/anthropic.claude-haiku-4-5-20251001-v1:0": {
+ "litellm_provider": "bedrock",
+ "mode": "chat",
- "input_cost_per_token": 1.01e-06,
++ "input_cost_per_token": 1.19e-06,
+ "output_cost_per_token": 5.01e-06
+ },
+ "eu.anthropic.claude-sonnet-5-v1:0": {
+ "litellm_provider": "bedrock_converse",
+ "mode": "chat",
+ "input_cost_per_token": 3.4e-06,
+ "output_cost_per_token": 1.7e-05
+ },
+ "amazon.nova-2-pro-preview-20251202-v1:0": {
+ "litellm_provider": "bedrock_converse",
+ "mode": "chat",
+ "input_cost_per_token": 2.1875e-06,
+ "output_cost_per_token": 1.75e-05
+ },
+ "mistral.mistral-large-3-675b-instruct": {
+ "litellm_provider": "bedrock_converse",
+ "mode": "chat",
+ "input_cost_per_token": 5.1e-07,
+ "output_cost_per_token": 1.51e-06
+ },
+ "azure_ai/gpt-5.4-mini-2026-03-17": {
+ "litellm_provider": "azure_ai",
+ "mode": "chat",
+ "input_cost_per_token": 7.5e-07,
+ "output_cost_per_token": 4.5e-06
+ },
+ "groq/qwen/qwen3.8-27b": {
+ "litellm_provider": "groq",
+ "mode": "chat",
+ "input_cost_per_token": 8e-07,
+ "output_cost_per_token": 4e-06
+ },
+ "cohere_chat/v2/command-a-03-2025": {
+ "litellm_provider": "cohere_chat",
+ "mode": "chat",
+ "input_cost_per_token": 2.51e-06,
+ "output_cost_per_token": 1.001e-05
+ },
+ "mistral/mistral-medium-2604": {
+ "litellm_provider": "mistral",
+ "mode": "chat",
+ "input_cost_per_token": 1.51e-06,
+ "output_cost_per_token": 7.51e-06
++ },
+ "text-embedding-4-small": {
+ "input_cost_per_token": 1.01e-06,
+ "output_cost_per_token": 0,
+ "litellm_provider": "openai",
+ "mode": "embedding"
+ },
+ "text-embedding-3-large-next": {
+ "input_cost_per_token": 1.02e-06,
+ "output_cost_per_token": 0,
+ "litellm_provider": "openai",
+ "mode": "embedding"
+ },
+ "azure/text-embedding-4-large": {
+ "input_cost_per_token": 1.03e-06,
+ "output_cost_per_token": 0,
+ "litellm_provider": "azure",
+ "mode": "embedding"
+ },
+ "embed-v5": {
+ "input_cost_per_token": 1.04e-06,
+ "output_cost_per_token": 0,
+ "litellm_provider": "cohere",
+ "mode": "embedding"
+ },
+ "amazon.titan-embed-text-v2:0": {
+ "input_cost_per_token": 1.05e-06,
+ "output_cost_per_token": 0,
+ "litellm_provider": "bedrock",
+ "mode": "embedding"
+ },
+ "cohere.embed-english-v4": {
+ "input_cost_per_token": 1.06e-06,
+ "output_cost_per_token": 0,
+ "litellm_provider": "bedrock",
+ "mode": "embedding"
+ },
+ "text-embedding-006": {
+ "input_cost_per_token": 1.07e-06,
+ "output_cost_per_token": 0,
+ "litellm_provider": "vertex_ai-embedding-models",
+ "mode": "embedding"
+ },
+ "gemini/gemini-embedding-002": {
+ "input_cost_per_token": 1.08e-06,
+ "output_cost_per_token": 0,
+ "litellm_provider": "gemini",
+ "mode": "embedding"
+ },
+ "together_ai/together-embed-v1": {
+ "input_cost_per_token": 1.09e-06,
+ "output_cost_per_token": 0,
+ "litellm_provider": "together_ai",
+ "mode": "embedding"
+ },
+ "fireworks_ai/fireworks-embed-v1": {
+ "input_cost_per_token": 1.1e-06,
+ "output_cost_per_token": 0,
+ "litellm_provider": "fireworks_ai",
+ "mode": "embedding"
+ },
+ "rerank-v4": {
+ "input_cost_per_token": 1.11e-06,
+ "output_cost_per_token": 0,
+ "input_cost_per_query": 0.0021,
+ "litellm_provider": "cohere",
+ "mode": "rerank"
+ },
+ "cohere.rerank-v4:0": {
+ "input_cost_per_token": 1.12e-06,
+ "output_cost_per_token": 0,
+ "input_cost_per_query": 0.0022,
+ "litellm_provider": "bedrock",
+ "mode": "rerank"
+ },
+ "gpt-3.5-turbo-instruct-next": {
+ "input_cost_per_token": 1.14e-06,
+ "output_cost_per_token": 2.14e-06,
+ "litellm_provider": "text-completion-openai",
+ "mode": "completion"
+ },
+ "omni-moderation-next": {
+ "input_cost_per_token": null,
+ "output_cost_per_token": 0,
+ "litellm_provider": "openai",
+ "mode": "moderation"
+ },
+ "together_ai/meta-llama/Llama-3.3-70B-Instruct-Turbo": {
+ "input_cost_per_token": 1.16e-06,
+ "output_cost_per_token": 2.16e-06,
+ "litellm_provider": "together_ai",
+ "mode": "completion"
}
},
"cases": [
@@@ -28405,30 -29073,11 +29342,24 @@@
"id": "chatcmpl-$REQUEST_ID",
"object": "chat.completion",
"model": "sonar-next",
- "choices": [{"index": 0, "message": {"role": "assistant", "content": "ok"}, "finish_reason": "stop"}],
- "usage": {"prompt_tokens": 1840, "completion_tokens": 412, "total_tokens": 2252}
+ "choices": [
+ {
+ "index": 0,
+ "message": {
+ "role": "assistant",
+ "content": "ok"
+ },
+ "finish_reason": "stop"
+ }
+ ],
+ "usage": {
+ "prompt_tokens": 1840,
+ "completion_tokens": 412,
+ "total_tokens": 2252
+ }
}
},
- "expected": {
- "spend": 0.0023646,
- "input_cost": 0.001932,
- "output_cost": 0.0004326,
- "prompt_tokens": 1840,
- "completion_tokens": 412
- }
+ "expected": {"spend": 0.0025118, "input_cost": 0.0020792, "output_cost": 0.0004326, "prompt_tokens": 1840, "completion_tokens": 412}
},
{
"name": "deepseek-deepseek-v4-chat-prompt_cache_hit",
@@@ -28667,756 -29230,7 +29598,756 @@@
}
}
},
- "expected": {"spend": 0.0421, "input_cost": 0.0, "output_cost": 0.0421, "prompt_tokens": 1840, "completion_tokens": 412}
+ "expected": {
+ "spend": 0.0421,
+ "input_cost": 0.0,
+ "output_cost": 0.0421,
+ "prompt_tokens": 1840,
+ "completion_tokens": 412
+ }
+ },
+ {
+ "name": "bedrock-invoke-haiku-json",
+ "covers": "quota_management.spend_tracking.cost_matrix.logs_cost",
+ "model": "bedrock/invoke/anthropic.claude-haiku-4-5-20251001-v1:0",
+ "endpoint": "/v1/messages",
+ "request": {
+ "model": "$MODEL",
+ "messages": [
+ {
+ "role": "user",
+ "content": "bedrock-invoke-haiku-json"
+ }
+ ],
+ "stream": false,
+ "max_tokens": 412
+ },
+ "response": {
+ "content_type": "application/json",
+ "body": {
+ "id": "msg_$REQUEST_ID",
+ "type": "message",
+ "role": "assistant",
+ "model": "anthropic.claude-haiku-4-5-20251001-v1:0",
+ "content": [
+ {
+ "type": "text",
+ "text": "scripted response"
+ }
+ ],
+ "stop_reason": "end_turn",
+ "stop_sequence": null,
+ "usage": {
+ "input_tokens": 1840,
+ "output_tokens": 412
+ }
+ }
+ },
+ "expected": {
- "spend": 0.00392252,
- "input_cost": 0.0018584,
++ "spend": 0.00425372,
++ "input_cost": 0.0021896,
+ "output_cost": 0.00206412,
+ "prompt_tokens": 1840,
+ "completion_tokens": 412
+ }
+ },
+ {
+ "name": "bedrock-invoke-haiku-stream",
+ "covers": "quota_management.spend_tracking.scripted_wire.logs_cost",
+ "model": "bedrock/invoke/anthropic.claude-haiku-4-5-20251001-v1:0",
+ "endpoint": "/v1/messages",
+ "request": {
+ "model": "$MODEL",
+ "messages": [
+ {
+ "role": "user",
+ "content": "bedrock-invoke-haiku-stream"
+ }
+ ],
+ "stream": true,
+ "max_tokens": 412
+ },
+ "response": {
+ "content_type": "application/vnd.amazon.eventstream",
+ "framing": "invoke",
+ "events": [
+ {
+ "event_type": "message_start",
+ "payload": {
+ "type": "message_start",
+ "message": {
+ "id": "msg_$REQUEST_ID",
+ "type": "message",
+ "role": "assistant",
+ "model": "anthropic.claude-haiku-4-5-20251001-v1:0",
+ "content": [],
+ "stop_reason": null,
+ "stop_sequence": null,
+ "usage": {
+ "input_tokens": 1840,
+ "output_tokens": 0
+ }
+ }
+ }
+ },
+ {
+ "event_type": "content_block_delta",
+ "payload": {
+ "type": "content_block_delta",
+ "index": 0,
+ "delta": {
+ "type": "text_delta",
+ "text": "scripted response"
+ }
+ }
+ },
+ {
+ "event_type": "message_delta",
+ "payload": {
+ "type": "message_delta",
+ "delta": {
+ "stop_reason": "end_turn"
+ },
+ "usage": {
+ "output_tokens": 412
+ }
+ }
+ },
+ {
+ "event_type": "message_stop",
+ "payload": {
+ "type": "message_stop"
+ }
+ }
+ ]
+ },
+ "expected": {
- "spend": 0.00392252,
- "input_cost": 0.0018584,
++ "spend": 0.00425372,
++ "input_cost": 0.0021896,
+ "output_cost": 0.00206412,
+ "prompt_tokens": 1840,
+ "completion_tokens": 412
+ }
+ },
+ {
+ "name": "bedrock-converse-profile-base-model",
+ "covers": "quota_management.spend_tracking.cost_matrix.logs_cost",
+ "model": "anthropic.claude-sonnet-5-v1:0",
+ "deployment": {
+ "model": "bedrock/converse/arn:aws:bedrock:us-east-1:123456789012:application-inference-profile/abc123",
+ "base_model": "anthropic.claude-sonnet-5-v1:0"
+ },
+ "request": {
+ "model": "$MODEL",
+ "messages": [
+ {
+ "role": "user",
+ "content": "bedrock-converse-profile-base-model"
+ }
+ ],
+ "stream": false
+ },
+ "response": {
+ "content_type": "application/json",
+ "body": {
+ "output": {
+ "message": {
+ "role": "assistant",
+ "content": [
+ {
+ "text": "scripted response"
+ }
+ ]
+ }
+ },
+ "stopReason": "end_turn",
+ "usage": {
+ "inputTokens": 1840,
+ "outputTokens": 412,
+ "totalTokens": 2252
+ },
+ "metrics": {
+ "latencyMs": 1
+ }
+ }
+ },
+ "expected": {
+ "spend": 0.01287,
+ "input_cost": 0.006072,
+ "output_cost": 0.006798,
+ "prompt_tokens": 1840,
+ "completion_tokens": 412
+ }
+ },
+ {
+ "name": "bedrock-converse-eu-regional-key",
+ "covers": "quota_management.spend_tracking.cost_matrix.logs_cost",
+ "model": "eu.anthropic.claude-sonnet-5-v1:0",
+ "deployment": {
+ "model": "bedrock/converse/eu.anthropic.claude-sonnet-5-v1:0"
+ },
+ "request": {
+ "model": "$MODEL",
+ "messages": [
+ {
+ "role": "user",
+ "content": "bedrock-converse-eu-regional-key"
+ }
+ ],
+ "stream": false
+ },
+ "response": {
+ "content_type": "application/json",
+ "body": {
+ "output": {
+ "message": {
+ "role": "assistant",
+ "content": [
+ {
+ "text": "scripted response"
+ }
+ ]
+ }
+ },
+ "stopReason": "end_turn",
+ "usage": {
+ "inputTokens": 1840,
+ "outputTokens": 412,
+ "totalTokens": 2252
+ },
+ "metrics": {
+ "latencyMs": 1
+ }
+ }
+ },
+ "expected": {
+ "spend": 0.01326,
+ "input_cost": 0.006256,
+ "output_cost": 0.007004,
+ "prompt_tokens": 1840,
+ "completion_tokens": 412
+ }
+ },
+ {
+ "name": "bedrock-converse-apac-bare-fallback",
+ "covers": "quota_management.spend_tracking.cost_matrix.logs_cost",
+ "model": "anthropic.claude-sonnet-5-v1:0",
+ "deployment": {
+ "model": "bedrock/converse/apac.anthropic.claude-sonnet-5-v1:0"
+ },
+ "request": {
+ "model": "$MODEL",
+ "messages": [
+ {
+ "role": "user",
+ "content": "bedrock-converse-apac-bare-fallback"
+ }
+ ],
+ "stream": false
+ },
+ "response": {
+ "content_type": "application/json",
+ "body": {
+ "output": {
+ "message": {
+ "role": "assistant",
+ "content": [
+ {
+ "text": "scripted response"
+ }
+ ]
+ }
+ },
+ "stopReason": "end_turn",
+ "usage": {
+ "inputTokens": 1840,
+ "outputTokens": 412,
+ "totalTokens": 2252
+ },
+ "metrics": {
+ "latencyMs": 1
+ }
+ }
+ },
+ "expected": {
+ "spend": 0.01287,
+ "input_cost": 0.006072,
+ "output_cost": 0.006798,
+ "prompt_tokens": 1840,
+ "completion_tokens": 412
+ }
+ },
+ {
+ "name": "bedrock-converse-nova-2-pro",
+ "covers": "quota_management.spend_tracking.cost_matrix.logs_cost",
+ "model": "amazon.nova-2-pro-preview-20251202-v1:0",
+ "request": {
+ "model": "$MODEL",
+ "messages": [
+ {
+ "role": "user",
+ "content": "bedrock-converse-nova-2-pro"
+ }
+ ],
+ "stream": false
+ },
+ "response": {
+ "content_type": "application/json",
+ "body": {
+ "output": {
+ "message": {
+ "role": "assistant",
+ "content": [
+ {
+ "text": "scripted response"
+ }
+ ]
+ }
+ },
+ "stopReason": "end_turn",
+ "usage": {
+ "inputTokens": 1840,
+ "outputTokens": 412,
+ "totalTokens": 2252
+ },
+ "metrics": {
+ "latencyMs": 1
+ }
+ }
+ },
+ "expected": {
+ "spend": 0.011235,
+ "input_cost": 0.004025,
+ "output_cost": 0.00721,
+ "prompt_tokens": 1840,
+ "completion_tokens": 412
+ }
+ },
+ {
+ "name": "bedrock-converse-mistral-large-3-stream",
+ "covers": "quota_management.spend_tracking.scripted_wire.logs_cost",
+ "model": "mistral.mistral-large-3-675b-instruct",
+ "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": "bedrock-converse-mistral-large-3-stream"
+ }
+ ]
+ }
+ ],
+ "stream": true,
+ "stream_options": {
+ "include_usage": true
+ },
+ "allowed_openai_params": []
+ },
+ "response": {
+ "content_type": "application/vnd.amazon.eventstream",
+ "events": [
+ {
+ "event_type": "messageStart",
+ "payload": {
+ "role": "assistant"
+ }
+ },
+ {
+ "event_type": "contentBlockDelta",
+ "payload": {
+ "delta": {
+ "text": "scripted response"
+ },
+ "contentBlockIndex": 0
+ }
+ },
+ {
+ "event_type": "contentBlockStop",
+ "payload": {
+ "contentBlockIndex": 0
+ }
+ },
+ {
+ "event_type": "messageStop",
+ "payload": {
+ "stopReason": "end_turn"
+ }
+ },
+ {
+ "event_type": "metadata",
+ "payload": {
+ "usage": {
+ "inputTokens": 1840,
+ "outputTokens": 412,
+ "totalTokens": 2252
+ },
+ "metrics": {
+ "latencyMs": 1
+ }
+ }
+ }
+ ]
+ },
+ "expected": {
+ "spend": 0.00156052,
+ "input_cost": 0.0009384,
+ "output_cost": 0.00062212,
+ "prompt_tokens": 1840,
+ "completion_tokens": 412
+ }
+ },
+ {
+ "name": "azure-ai-gpt-5.4-mini-latest",
+ "covers": "quota_management.spend_tracking.cost_matrix.logs_cost",
+ "model": "azure_ai/gpt-5.4-mini-2026-03-17",
+ "request": {
+ "model": "$MODEL",
+ "messages": [
+ {
+ "role": "user",
+ "content": "azure-ai-gpt-5.4-mini-latest"
+ }
+ ],
+ "stream": false
+ },
+ "response": {
+ "content_type": "application/json",
+ "body": {
+ "id": "chatcmpl-$REQUEST_ID",
+ "object": "chat.completion",
+ "model": "$MODEL",
+ "choices": [
+ {
+ "index": 0,
+ "message": {
+ "role": "assistant",
+ "content": "scripted response"
+ },
+ "finish_reason": "stop"
+ }
+ ],
+ "usage": {
+ "prompt_tokens": 1840,
+ "completion_tokens": 412,
+ "total_tokens": 2252
+ },
+ "service_tier": "default"
+ }
+ },
+ "expected": {
+ "spend": 0.003234,
+ "input_cost": 0.00138,
+ "output_cost": 0.001854,
+ "prompt_tokens": 1840,
+ "completion_tokens": 412
+ }
+ },
+ {
+ "name": "azure-ai-gpt-5.4-mini-latest-stream",
+ "covers": "quota_management.spend_tracking.scripted_wire.logs_cost",
+ "model": "azure_ai/gpt-5.4-mini-2026-03-17",
+ "request": {
+ "model": "$MODEL",
+ "messages": [
+ {
+ "role": "user",
+ "content": "azure-ai-gpt-5.4-mini-latest-stream"
+ }
+ ],
+ "stream": true
+ },
+ "response": {
+ "content_type": "text/event-stream",
+ "frames": [
+ "data: {\"id\":\"chatcmpl-$REQUEST_ID\",\"object\":\"chat.completion.chunk\",\"created\":1,\"model\":\"$MODEL\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":\"ok\"},\"finish_reason\":null}]}\n\n",
+ "data: {\"id\":\"chatcmpl-$REQUEST_ID\",\"object\":\"chat.completion.chunk\",\"created\":1,\"model\":\"$MODEL\",\"choices\":[],\"usage\":{\"prompt_tokens\":1840,\"completion_tokens\":412,\"total_tokens\":2252}}\n\n",
+ "data: [DONE]\n\n"
+ ]
+ },
+ "expected": {
+ "spend": 0.003234,
+ "input_cost": 0.00138,
+ "output_cost": 0.001854,
+ "prompt_tokens": 1840,
+ "completion_tokens": 412
+ }
+ },
+ {
+ "name": "azure-pinned-gpt-5.4-mini-stream",
+ "covers": "quota_management.spend_tracking.scripted_wire.logs_cost",
+ "model": "azure/gpt-5.4-mini",
+ "deployment": {
+ "model": "azure/cc-pinned-deployment",
+ "base_model": "azure/gpt-5.4-mini"
+ },
+ "request": {
+ "model": "$MODEL",
+ "messages": [
+ {
+ "role": "user",
+ "content": "azure-pinned-gpt-5.4-mini-stream"
+ }
+ ],
+ "stream": true
+ },
+ "response": {
+ "content_type": "text/event-stream",
+ "frames": [
+ "data: {\"id\":\"chatcmpl-$REQUEST_ID\",\"object\":\"chat.completion.chunk\",\"created\":1,\"model\":\"$MODEL\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":\"ok\"},\"finish_reason\":null}]}\n\n",
+ "data: {\"id\":\"chatcmpl-$REQUEST_ID\",\"object\":\"chat.completion.chunk\",\"created\":1,\"model\":\"$MODEL\",\"choices\":[],\"usage\":{\"prompt_tokens\":1840,\"completion_tokens\":412,\"total_tokens\":2252}}\n\n",
+ "data: [DONE]\n\n"
+ ]
+ },
+ "expected": {
+ "spend": 0.00184896,
+ "input_cost": 0.0006624,
+ "output_cost": 0.00118656,
+ "prompt_tokens": 1840,
+ "completion_tokens": 412
+ }
+ },
+ {
+ "name": "groq-qwen-3.8-json",
+ "covers": "quota_management.spend_tracking.cost_matrix.logs_cost",
+ "model": "groq/qwen/qwen3.8-27b",
+ "request": {
+ "model": "$MODEL",
+ "messages": [
+ {
+ "role": "user",
+ "content": "groq-qwen-3.8-json"
+ }
+ ],
+ "stream": false
+ },
+ "response": {
+ "content_type": "application/json",
+ "body": {
+ "id": "chatcmpl-$REQUEST_ID",
+ "object": "chat.completion",
+ "model": "$MODEL",
+ "choices": [
+ {
+ "index": 0,
+ "message": {
+ "role": "assistant",
+ "content": "scripted response"
+ },
+ "finish_reason": "stop"
+ }
+ ],
+ "usage": {
+ "prompt_tokens": 1840,
+ "completion_tokens": 412,
+ "total_tokens": 2252
+ },
+ "service_tier": "default",
+ "x_groq": {
+ "usage": {
+ "prompt_tokens": 1840,
+ "completion_tokens": 412,
+ "total_tokens": 2252
+ }
+ }
+ }
+ },
+ "expected": {
+ "spend": 0.00312,
+ "input_cost": 0.001472,
+ "output_cost": 0.001648,
+ "prompt_tokens": 1840,
+ "completion_tokens": 412
+ }
+ },
+ {
+ "name": "groq-qwen-3.8-stream_x_groq_recount",
+ "covers": "quota_management.spend_tracking.scripted_wire.logs_cost",
+ "model": "groq/qwen/qwen3.8-27b",
+ "request": {
+ "model": "$MODEL",
+ "messages": [
+ {
+ "role": "user",
+ "content": "groq-qwen-3.8-stream_x_groq_recount"
+ }
+ ],
+ "stream": true
+ },
+ "response": {
+ "content_type": "text/event-stream",
+ "frames": [
+ "data: {\"id\":\"chatcmpl-$REQUEST_ID\",\"object\":\"chat.completion.chunk\",\"created\":1,\"model\":\"$MODEL\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":\"ok\"},\"finish_reason\":null}]}\n\n",
+ "data: {\"id\":\"chatcmpl-$REQUEST_ID\",\"object\":\"chat.completion.chunk\",\"created\":1,\"model\":\"$MODEL\",\"choices\":[],\"x_groq\":{\"usage\":{\"prompt_tokens\":1840,\"completion_tokens\":412,\"total_tokens\":2252}}}\n\n",
+ "data: [DONE]\n\n"
+ ]
+ },
+ "expected": {
+ "recount": {
+ "input_cost_per_token": 8e-07,
+ "output_cost_per_token": 4e-06
+ }
+ }
+ },
+ {
+ "name": "cohere-command-a-v2-tokens",
+ "covers": "quota_management.spend_tracking.cost_matrix.logs_cost",
+ "model": "cohere_chat/v2/command-a-03-2025",
+ "deployment": {
+ "model": "cohere_chat/v2/command-a-03-2025"
+ },
+ "request": {
+ "model": "$MODEL",
+ "messages": [
+ {
+ "role": "user",
+ "content": "cohere-command-a-v2-tokens"
+ }
+ ],
+ "stream": false
+ },
+ "response": {
+ "content_type": "application/json",
+ "body": {
+ "id": "$REQUEST_ID",
+ "message": {
+ "role": "assistant",
+ "content": [
+ {
+ "type": "text",
+ "text": "scripted response"
+ }
+ ]
+ },
+ "finish_reason": "COMPLETE",
+ "usage": {
+ "tokens": {
+ "input_tokens": 1840,
+ "output_tokens": 412,
+ "total_tokens": 2252
+ },
+ "billed_units": {
+ "input_tokens": 1800,
+ "output_tokens": 400
+ }
+ }
+ }
+ },
+ "expected": {
+ "spend": 0.00874252,
+ "input_cost": 0.0046184,
+ "output_cost": 0.00412412,
+ "prompt_tokens": 1840,
+ "completion_tokens": 412
+ }
+ },
+ {
+ "name": "mistral-medium-2604-json",
+ "covers": "quota_management.spend_tracking.cost_matrix.logs_cost",
+ "model": "mistral/mistral-medium-2604",
+ "request": {
+ "model": "$MODEL",
+ "messages": [
+ {
+ "role": "user",
+ "content": "mistral-medium-2604-json"
+ }
+ ],
+ "stream": false
+ },
+ "response": {
+ "content_type": "application/json",
+ "body": {
+ "id": "chatcmpl-$REQUEST_ID",
+ "object": "chat.completion",
+ "model": "$MODEL",
+ "choices": [
+ {
+ "index": 0,
+ "message": {
+ "role": "assistant",
+ "content": "scripted response"
+ },
+ "finish_reason": "stop"
+ }
+ ],
+ "usage": {
+ "prompt_tokens": 1840,
+ "completion_tokens": 412,
+ "total_tokens": 2252
+ },
+ "service_tier": "default"
+ }
+ },
+ "expected": {
+ "spend": 0.00587252,
+ "input_cost": 0.0027784,
+ "output_cost": 0.00309412,
+ "prompt_tokens": 1840,
+ "completion_tokens": 412
+ }
+ },
+ {
+ "name": "openai-deployment-pricing-override",
+ "covers": "quota_management.spend_tracking.cost_matrix.logs_cost",
+ "model": "gpt-5.6",
+ "deployment": {
+ "model": "openai/cc-custom-model",
+ "input_cost_per_token": 7e-06,
+ "output_cost_per_token": 2.1e-05
+ },
+ "request": {
+ "model": "$MODEL",
+ "messages": [
+ {
+ "role": "user",
+ "content": "openai-deployment-pricing-override"
+ }
+ ],
+ "stream": false
+ },
+ "response": {
+ "content_type": "application/json",
+ "body": {
+ "id": "chatcmpl-$REQUEST_ID",
+ "object": "chat.completion",
+ "model": "$MODEL",
+ "choices": [
+ {
+ "index": 0,
+ "message": {
+ "role": "assistant",
+ "content": "scripted response"
+ },
+ "finish_reason": "stop"
+ }
+ ],
+ "usage": {
+ "prompt_tokens": 1840,
+ "completion_tokens": 412,
+ "total_tokens": 2252
+ },
+ "service_tier": "default"
+ }
+ },
+ "expected": {
+ "spend": 0.021532,
+ "input_cost": 0.01288,
+ "output_cost": 0.008652,
+ "prompt_tokens": 1840,
+ "completion_tokens": 412
+ }
}
]
}