Merge pull request #34941 from BerriAI/litellm_azure_ai_mai_image_2_5_pro

This commit is contained in:
kerry-berri 2026-09-21 08:07:36 -07:00 • committed by GitHub
commit 701c2b7256
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 429 additions and 12 deletions

View file

@ -3740,6 +3740,21 @@
"supports_vision": true,
"supports_web_search": true
},
"azure_ai/gpt-image-2": {
"cache_read_input_image_token_cost": 2e-06,
"cache_read_input_token_cost": 1.25e-06,
"input_cost_per_image_token": 8e-06,
"input_cost_per_token": 5e-06,
"litellm_provider": "azure_ai",
"mode": "image_generation",
"output_cost_per_image_token": 3e-05,
"source": "https://azure.microsoft.com/en-us/pricing/details/cognitive-services/openai-service/",
"supported_endpoints": [
"/v1/images/generations",
"/v1/images/edits"
],
"supports_vision": true
},
"azure_ai/codex-mini": {
"cache_read_input_token_cost": 3.75e-07,
"deprecation_date": "2026-11-15",
@ -11159,6 +11174,19 @@
],
"deprecation_date": "2026-10-01"
},
"azure_ai/MAI-Image-2.5-Pro": {
"input_cost_per_image_token": 8e-06,
"input_cost_per_token": 5e-06,
"litellm_provider": "azure_ai",
"mode": "image_generation",
"output_cost_per_image": 0.1085,
"output_cost_per_image_token": 0.000106,
"source": "https://techcommunity.microsoft.com/blog/azure-ai-foundry-blog/introducing-mai-image-2-5-pro-and-mai-voice-2-flash-in-microsoft-foundry/4539446",
"supported_endpoints": [
"/v1/images/generations",
"/v1/images/edits"
]
},
"azure_ai/MAI-Image-2e": {
"deprecation_date": "2026-08-15",
"input_cost_per_token": 5e-06,
@ -21888,6 +21916,7 @@
"supports_tool_choice": true
},
"deepseek/deepseek-coder": {
"cache_read_input_token_cost": 1.4e-08,
"input_cost_per_token": 1.4e-07,
"input_cost_per_token_cache_hit": 1.4e-08,
"litellm_provider": "deepseek",
@ -21902,6 +21931,7 @@
"supports_tool_choice": true
},
"deepseek/deepseek-r1": {
"cache_read_input_token_cost": 1.4e-07,
"input_cost_per_token": 5.5e-07,
"input_cost_per_token_cache_hit": 1.4e-07,
"litellm_provider": "deepseek",
@ -21957,6 +21987,7 @@
"supports_tool_choice": true
},
"deepseek/deepseek-v3.2": {
"cache_read_input_token_cost": 2.8e-08,
"input_cost_per_token": 2.8e-07,
"input_cost_per_token_cache_hit": 2.8e-08,
"litellm_provider": "deepseek",
@ -23796,6 +23827,25 @@
"supports_tool_choice": true,
"supports_vision": false
},
"fireworks_ai/deepseek-v4-pro-0813": {
"cache_read_input_token_cost": 4.4e-08,
"cache_read_input_token_cost_priority": 5.5e-08,
"input_cost_per_token": 1.32e-06,
"input_cost_per_token_priority": 1.65e-06,
"litellm_provider": "fireworks_ai",
"max_input_tokens": 1048576,
"max_output_tokens": 131072,
"max_tokens": 131072,
"mode": "chat",
"output_cost_per_token": 3.96e-06,
"output_cost_per_token_priority": 4.95e-06,
"source": "https://api.fireworks.ai/v1/serverless/models",
"supports_function_calling": true,
"supports_reasoning": true,
"supports_response_schema": true,
"supports_tool_choice": true,
"supports_vision": false
},
"fireworks_ai/accounts/fireworks/models/firefunction-v2": {
"input_cost_per_token": 9e-07,
"litellm_provider": "fireworks_ai",
@ -24182,7 +24232,7 @@
"supports_reasoning": true,
"supports_response_schema": true,
"supports_tool_choice": true,
"supports_vision": true
"supports_vision": false
},
"fireworks_ai/accounts/fireworks/models/mixtral-8x22b-instruct-hf": {
"input_cost_per_token": 1.2e-06,
@ -24508,7 +24558,7 @@
"supports_reasoning": true,
"supports_response_schema": true,
"supports_tool_choice": true,
"supports_vision": true
"supports_vision": false
},
"fireworks_ai/qwen3p7-plus": {
"cache_read_input_token_cost": 8e-08,
@ -35244,6 +35294,7 @@
"mode": "chat",
"output_cost_per_token": 3e-06,
"source": "https://console.groq.com/docs/model/qwen/qwen3.6-27b",
"deprecation_date": "2026-09-14",
"supports_function_calling": true,
"supports_reasoning": true,
"supports_response_schema": false,
@ -41472,6 +41523,7 @@
"supports_web_search": false
},
"openrouter/deepseek/deepseek-v3.2-exp": {
"cache_read_input_token_cost": 2e-08,
"deprecation_date": "2026-09-28",
"input_cost_per_token": 2.7e-07,
"input_cost_per_token_cache_hit": 2e-08,
@ -41494,6 +41546,7 @@
"supports_web_search": false
},
"openrouter/deepseek/deepseek-r1": {
"cache_read_input_token_cost": 1.4e-07,
"input_cost_per_token": 7e-07,
"input_cost_per_token_cache_hit": 1.4e-07,
"litellm_provider": "openrouter",
@ -44247,6 +44300,84 @@
"supports_system_messages": true,
"supports_native_structured_output": true
},
"bedrock/ap-northeast-1/qwen.qwen3-next-80b-a3b": {
"input_cost_per_token": 1.8e-07,
"litellm_provider": "bedrock",
"max_input_tokens": 128000,
"max_output_tokens": 8192,
"max_tokens": 8192,
"mode": "chat",
"output_cost_per_token": 1.45e-06,
"source": "https://aws.amazon.com/bedrock/pricing/",
"supports_function_calling": true,
"supports_native_structured_output": true,
"supports_system_messages": true
},
"bedrock/ap-south-1/qwen.qwen3-next-80b-a3b": {
"input_cost_per_token": 1.8e-07,
"litellm_provider": "bedrock",
"max_input_tokens": 128000,
"max_output_tokens": 8192,
"max_tokens": 8192,
"mode": "chat",
"output_cost_per_token": 1.41e-06,
"source": "https://aws.amazon.com/bedrock/pricing/",
"supports_function_calling": true,
"supports_native_structured_output": true,
"supports_system_messages": true
},
"bedrock/ap-southeast-2/qwen.qwen3-next-80b-a3b": {
"input_cost_per_token": 1.545e-07,
"litellm_provider": "bedrock",
"max_input_tokens": 128000,
"max_output_tokens": 8192,
"max_tokens": 8192,
"mode": "chat",
"output_cost_per_token": 1.236e-06,
"source": "https://aws.amazon.com/bedrock/pricing/",
"supports_function_calling": true,
"supports_native_structured_output": true,
"supports_system_messages": true
},
"bedrock/eu-west-1/qwen.qwen3-next-80b-a3b": {
"input_cost_per_token": 1.8e-07,
"litellm_provider": "bedrock",
"max_input_tokens": 128000,
"max_output_tokens": 8192,
"max_tokens": 8192,
"mode": "chat",
"output_cost_per_token": 1.41e-06,
"source": "https://aws.amazon.com/bedrock/pricing/",
"supports_function_calling": true,
"supports_native_structured_output": true,
"supports_system_messages": true
},
"bedrock/eu-west-2/qwen.qwen3-next-80b-a3b": {
"input_cost_per_token": 2.3e-07,
"litellm_provider": "bedrock",
"max_input_tokens": 128000,
"max_output_tokens": 8192,
"max_tokens": 8192,
"mode": "chat",
"output_cost_per_token": 1.86e-06,
"source": "https://aws.amazon.com/bedrock/pricing/",
"supports_function_calling": true,
"supports_native_structured_output": true,
"supports_system_messages": true
},
"bedrock/sa-east-1/qwen.qwen3-next-80b-a3b": {
"input_cost_per_token": 1.8e-07,
"litellm_provider": "bedrock",
"max_input_tokens": 128000,
"max_output_tokens": 8192,
"max_tokens": 8192,
"mode": "chat",
"output_cost_per_token": 1.45e-06,
"source": "https://aws.amazon.com/bedrock/pricing/",
"supports_function_calling": true,
"supports_native_structured_output": true,
"supports_system_messages": true
},
"qwen.qwen3-vl-235b-a22b": {
"input_cost_per_token": 5.3e-07,
"litellm_provider": "bedrock_converse",
@ -46291,8 +46422,8 @@
"together_ai/zai-org/GLM-4.6": {
"input_cost_per_token": 6e-07,
"litellm_provider": "together_ai",
"max_input_tokens": 200000,
"max_tokens": 200000,
"max_input_tokens": 202752,
"max_tokens": 202752,
"metadata": {
"successor": "together_ai/zai-org/GLM-5.2"
},
@ -46308,8 +46439,8 @@
"deprecation_date": "2026-04-02",
"input_cost_per_token": 4.5e-07,
"litellm_provider": "together_ai",
"max_input_tokens": 200000,
"max_tokens": 200000,
"max_input_tokens": 202752,
"max_tokens": 202752,
"metadata": {
"successor": "together_ai/zai-org/GLM-5.2"
},
@ -64215,6 +64346,25 @@
"supports_tool_choice": true,
"supports_vision": false
},
"fireworks_ai/glm-5p3": {
"cache_read_input_token_cost": 2.6e-07,
"cache_read_input_token_cost_priority": 3.25e-07,
"input_cost_per_token": 1.4e-06,
"input_cost_per_token_priority": 1.75e-06,
"litellm_provider": "fireworks_ai",
"max_input_tokens": 1048576,
"max_output_tokens": 128000,
"max_tokens": 128000,
"mode": "chat",
"output_cost_per_token": 4.4e-06,
"output_cost_per_token_priority": 5.5e-06,
"source": "https://api.fireworks.ai/v1/serverless/models",
"supports_function_calling": true,
"supports_reasoning": true,
"supports_response_schema": true,
"supports_tool_choice": true,
"supports_vision": false
},
"fireworks_ai/accounts/fireworks/routers/glm-5p3-fast": {
"cache_read_input_token_cost": 3.9e-07,
"input_cost_per_token": 2.1e-06,
@ -64262,6 +64412,23 @@
"supports_tool_choice": true,
"supports_vision": true
},
"fireworks_ai/glm-5p3-flash": {
"cache_read_input_token_cost": 3e-08,
"cache_read_input_token_cost_priority": 3.75e-08,
"input_cost_per_token": 1.5e-07,
"input_cost_per_token_priority": 1.875e-07,
"litellm_provider": "fireworks_ai",
"max_input_tokens": 1048576,
"max_tokens": 1048576,
"mode": "chat",
"output_cost_per_token": 5e-07,
"output_cost_per_token_priority": 6.25e-07,
"source": "https://api.fireworks.ai/v1/serverless/models",
"supports_function_calling": true,
"supports_response_schema": true,
"supports_tool_choice": true,
"supports_vision": true
},
"fireworks_ai/accounts/fireworks/models/inkling": {
"cache_read_input_token_cost": 1.7e-07,
"input_cost_per_token": 1e-06,

View file

@ -255,6 +255,7 @@ class ModelInfoBase(ProviderSpecificModelInfo, total=False):
cache_creation_input_token_cost_ultrafast: ReadOnly[float | None] # OpenAI ultrafast service tier pricing
cache_read_input_token_cost: float | None
cache_read_input_audio_token_cost: ReadOnly[float | None]
cache_read_input_image_token_cost: ReadOnly[float | None]
cache_read_input_token_cost_flex: float | None # OpenAI flex service tier pricing
cache_read_input_token_cost_priority: float | None # OpenAI priority service tier pricing
cache_read_input_token_cost_ultrafast: ReadOnly[float | None] # OpenAI ultrafast service tier pricing
@ -3635,6 +3636,7 @@ class CustomPricingLiteLLMParams(MirroredPricingParams):
cache_read_input_token_cost_above_272k_tokens_priority: float | None = None
cache_read_input_token_cost_above_272k_tokens_flex: float | None = None
cache_read_input_audio_token_cost: float | None = None
cache_read_input_image_token_cost: float | None = None
input_cost_per_character_above_128k_tokens: float | None = None
input_cost_per_audio_token: float | None = None
input_cost_per_token_cache_hit: float | None = None

View file

@ -3740,6 +3740,21 @@
"supports_vision": true,
"supports_web_search": true
},
"azure_ai/gpt-image-2": {
"cache_read_input_image_token_cost": 2e-06,
"cache_read_input_token_cost": 1.25e-06,
"input_cost_per_image_token": 8e-06,
"input_cost_per_token": 5e-06,
"litellm_provider": "azure_ai",
"mode": "image_generation",
"output_cost_per_image_token": 3e-05,
"source": "https://azure.microsoft.com/en-us/pricing/details/cognitive-services/openai-service/",
"supported_endpoints": [
"/v1/images/generations",
"/v1/images/edits"
],
"supports_vision": true
},
"azure_ai/codex-mini": {
"cache_read_input_token_cost": 3.75e-07,
"deprecation_date": "2026-11-15",
@ -11159,6 +11174,19 @@
],
"deprecation_date": "2026-10-01"
},
"azure_ai/MAI-Image-2.5-Pro": {
"input_cost_per_image_token": 8e-06,
"input_cost_per_token": 5e-06,
"litellm_provider": "azure_ai",
"mode": "image_generation",
"output_cost_per_image": 0.1085,
"output_cost_per_image_token": 0.000106,
"source": "https://techcommunity.microsoft.com/blog/azure-ai-foundry-blog/introducing-mai-image-2-5-pro-and-mai-voice-2-flash-in-microsoft-foundry/4539446",
"supported_endpoints": [
"/v1/images/generations",
"/v1/images/edits"
]
},
"azure_ai/MAI-Image-2e": {
"deprecation_date": "2026-08-15",
"input_cost_per_token": 5e-06,
@ -21888,6 +21916,7 @@
"supports_tool_choice": true
},
"deepseek/deepseek-coder": {
"cache_read_input_token_cost": 1.4e-08,
"input_cost_per_token": 1.4e-07,
"input_cost_per_token_cache_hit": 1.4e-08,
"litellm_provider": "deepseek",
@ -21902,6 +21931,7 @@
"supports_tool_choice": true
},
"deepseek/deepseek-r1": {
"cache_read_input_token_cost": 1.4e-07,
"input_cost_per_token": 5.5e-07,
"input_cost_per_token_cache_hit": 1.4e-07,
"litellm_provider": "deepseek",
@ -21957,6 +21987,7 @@
"supports_tool_choice": true
},
"deepseek/deepseek-v3.2": {
"cache_read_input_token_cost": 2.8e-08,
"input_cost_per_token": 2.8e-07,
"input_cost_per_token_cache_hit": 2.8e-08,
"litellm_provider": "deepseek",
@ -23796,6 +23827,25 @@
"supports_tool_choice": true,
"supports_vision": false
},
"fireworks_ai/deepseek-v4-pro-0813": {
"cache_read_input_token_cost": 4.4e-08,
"cache_read_input_token_cost_priority": 5.5e-08,
"input_cost_per_token": 1.32e-06,
"input_cost_per_token_priority": 1.65e-06,
"litellm_provider": "fireworks_ai",
"max_input_tokens": 1048576,
"max_output_tokens": 131072,
"max_tokens": 131072,
"mode": "chat",
"output_cost_per_token": 3.96e-06,
"output_cost_per_token_priority": 4.95e-06,
"source": "https://api.fireworks.ai/v1/serverless/models",
"supports_function_calling": true,
"supports_reasoning": true,
"supports_response_schema": true,
"supports_tool_choice": true,
"supports_vision": false
},
"fireworks_ai/accounts/fireworks/models/firefunction-v2": {
"input_cost_per_token": 9e-07,
"litellm_provider": "fireworks_ai",
@ -24182,7 +24232,7 @@
"supports_reasoning": true,
"supports_response_schema": true,
"supports_tool_choice": true,
"supports_vision": true
"supports_vision": false
},
"fireworks_ai/accounts/fireworks/models/mixtral-8x22b-instruct-hf": {
"input_cost_per_token": 1.2e-06,
@ -24508,7 +24558,7 @@
"supports_reasoning": true,
"supports_response_schema": true,
"supports_tool_choice": true,
"supports_vision": true
"supports_vision": false
},
"fireworks_ai/qwen3p7-plus": {
"cache_read_input_token_cost": 8e-08,
@ -35244,6 +35294,7 @@
"mode": "chat",
"output_cost_per_token": 3e-06,
"source": "https://console.groq.com/docs/model/qwen/qwen3.6-27b",
"deprecation_date": "2026-09-14",
"supports_function_calling": true,
"supports_reasoning": true,
"supports_response_schema": false,
@ -41472,6 +41523,7 @@
"supports_web_search": false
},
"openrouter/deepseek/deepseek-v3.2-exp": {
"cache_read_input_token_cost": 2e-08,
"deprecation_date": "2026-09-28",
"input_cost_per_token": 2.7e-07,
"input_cost_per_token_cache_hit": 2e-08,
@ -41494,6 +41546,7 @@
"supports_web_search": false
},
"openrouter/deepseek/deepseek-r1": {
"cache_read_input_token_cost": 1.4e-07,
"input_cost_per_token": 7e-07,
"input_cost_per_token_cache_hit": 1.4e-07,
"litellm_provider": "openrouter",
@ -44247,6 +44300,84 @@
"supports_system_messages": true,
"supports_native_structured_output": true
},
"bedrock/ap-northeast-1/qwen.qwen3-next-80b-a3b": {
"input_cost_per_token": 1.8e-07,
"litellm_provider": "bedrock",
"max_input_tokens": 128000,
"max_output_tokens": 8192,
"max_tokens": 8192,
"mode": "chat",
"output_cost_per_token": 1.45e-06,
"source": "https://aws.amazon.com/bedrock/pricing/",
"supports_function_calling": true,
"supports_native_structured_output": true,
"supports_system_messages": true
},
"bedrock/ap-south-1/qwen.qwen3-next-80b-a3b": {
"input_cost_per_token": 1.8e-07,
"litellm_provider": "bedrock",
"max_input_tokens": 128000,
"max_output_tokens": 8192,
"max_tokens": 8192,
"mode": "chat",
"output_cost_per_token": 1.41e-06,
"source": "https://aws.amazon.com/bedrock/pricing/",
"supports_function_calling": true,
"supports_native_structured_output": true,
"supports_system_messages": true
},
"bedrock/ap-southeast-2/qwen.qwen3-next-80b-a3b": {
"input_cost_per_token": 1.545e-07,
"litellm_provider": "bedrock",
"max_input_tokens": 128000,
"max_output_tokens": 8192,
"max_tokens": 8192,
"mode": "chat",
"output_cost_per_token": 1.236e-06,
"source": "https://aws.amazon.com/bedrock/pricing/",
"supports_function_calling": true,
"supports_native_structured_output": true,
"supports_system_messages": true
},
"bedrock/eu-west-1/qwen.qwen3-next-80b-a3b": {
"input_cost_per_token": 1.8e-07,
"litellm_provider": "bedrock",
"max_input_tokens": 128000,
"max_output_tokens": 8192,
"max_tokens": 8192,
"mode": "chat",
"output_cost_per_token": 1.41e-06,
"source": "https://aws.amazon.com/bedrock/pricing/",
"supports_function_calling": true,
"supports_native_structured_output": true,
"supports_system_messages": true
},
"bedrock/eu-west-2/qwen.qwen3-next-80b-a3b": {
"input_cost_per_token": 2.3e-07,
"litellm_provider": "bedrock",
"max_input_tokens": 128000,
"max_output_tokens": 8192,
"max_tokens": 8192,
"mode": "chat",
"output_cost_per_token": 1.86e-06,
"source": "https://aws.amazon.com/bedrock/pricing/",
"supports_function_calling": true,
"supports_native_structured_output": true,
"supports_system_messages": true
},
"bedrock/sa-east-1/qwen.qwen3-next-80b-a3b": {
"input_cost_per_token": 1.8e-07,
"litellm_provider": "bedrock",
"max_input_tokens": 128000,
"max_output_tokens": 8192,
"max_tokens": 8192,
"mode": "chat",
"output_cost_per_token": 1.45e-06,
"source": "https://aws.amazon.com/bedrock/pricing/",
"supports_function_calling": true,
"supports_native_structured_output": true,
"supports_system_messages": true
},
"qwen.qwen3-vl-235b-a22b": {
"input_cost_per_token": 5.3e-07,
"litellm_provider": "bedrock_converse",
@ -46291,8 +46422,8 @@
"together_ai/zai-org/GLM-4.6": {
"input_cost_per_token": 6e-07,
"litellm_provider": "together_ai",
"max_input_tokens": 200000,
"max_tokens": 200000,
"max_input_tokens": 202752,
"max_tokens": 202752,
"metadata": {
"successor": "together_ai/zai-org/GLM-5.2"
},
@ -46308,8 +46439,8 @@
"deprecation_date": "2026-04-02",
"input_cost_per_token": 4.5e-07,
"litellm_provider": "together_ai",
"max_input_tokens": 200000,
"max_tokens": 200000,
"max_input_tokens": 202752,
"max_tokens": 202752,
"metadata": {
"successor": "together_ai/zai-org/GLM-5.2"
},
@ -64215,6 +64346,25 @@
"supports_tool_choice": true,
"supports_vision": false
},
"fireworks_ai/glm-5p3": {
"cache_read_input_token_cost": 2.6e-07,
"cache_read_input_token_cost_priority": 3.25e-07,
"input_cost_per_token": 1.4e-06,
"input_cost_per_token_priority": 1.75e-06,
"litellm_provider": "fireworks_ai",
"max_input_tokens": 1048576,
"max_output_tokens": 128000,
"max_tokens": 128000,
"mode": "chat",
"output_cost_per_token": 4.4e-06,
"output_cost_per_token_priority": 5.5e-06,
"source": "https://api.fireworks.ai/v1/serverless/models",
"supports_function_calling": true,
"supports_reasoning": true,
"supports_response_schema": true,
"supports_tool_choice": true,
"supports_vision": false
},
"fireworks_ai/accounts/fireworks/routers/glm-5p3-fast": {
"cache_read_input_token_cost": 3.9e-07,
"input_cost_per_token": 2.1e-06,
@ -64262,6 +64412,23 @@
"supports_tool_choice": true,
"supports_vision": true
},
"fireworks_ai/glm-5p3-flash": {
"cache_read_input_token_cost": 3e-08,
"cache_read_input_token_cost_priority": 3.75e-08,
"input_cost_per_token": 1.5e-07,
"input_cost_per_token_priority": 1.875e-07,
"litellm_provider": "fireworks_ai",
"max_input_tokens": 1048576,
"max_tokens": 1048576,
"mode": "chat",
"output_cost_per_token": 5e-07,
"output_cost_per_token_priority": 6.25e-07,
"source": "https://api.fireworks.ai/v1/serverless/models",
"supports_function_calling": true,
"supports_response_schema": true,
"supports_tool_choice": true,
"supports_vision": true
},
"fireworks_ai/accounts/fireworks/models/inkling": {
"cache_read_input_token_cost": 1.7e-07,
"input_cost_per_token": 1e-06,

View file

@ -137,6 +137,10 @@
"type": "number",
"minimum": 0
},
"cache_read_input_image_token_cost": {
"type": "number",
"minimum": 0
},
"cache_read_input_token_cost": {
"type": "number",
"minimum": 0,

View file

@ -133,3 +133,9 @@ meta.llama3-2-11b-instruct-v1:0
us.meta.llama3-2-11b-instruct-v1:0
meta.llama3-2-90b-instruct-v1:0
us.meta.llama3-2-90b-instruct-v1:0
bedrock/ap-northeast-1/qwen.qwen3-next-80b-a3b
bedrock/ap-south-1/qwen.qwen3-next-80b-a3b
bedrock/ap-southeast-2/qwen.qwen3-next-80b-a3b
bedrock/eu-west-1/qwen.qwen3-next-80b-a3b
bedrock/eu-west-2/qwen.qwen3-next-80b-a3b
bedrock/sa-east-1/qwen.qwen3-next-80b-a3b

View file

@ -453,6 +453,38 @@ class TestAzureMAIImageGeneration:
)
assert round(cost, 10) == round(expected_cost, 10)
def test_mai_image_pro_edit_cost_splits_text_and_image_input(self, monkeypatch):
monkeypatch.setenv("LITELLM_LOCAL_MODEL_COST_MAP", "True")
litellm.model_cost = litellm.get_model_cost_map(url="")
model = "azure_ai/MAI-Image-2.5-Pro"
model_info = litellm.get_model_info(model=model, custom_llm_provider="azure_ai")
text_tokens = 37
image_tokens = 1024
output_image_tokens = 1024
image_response = ImageResponse(
data=[ImageObject(b64_json="img1")],
usage=ImageUsage(
input_tokens=text_tokens + image_tokens,
input_tokens_details=ImageUsageInputTokensDetails(
text_tokens=text_tokens,
image_tokens=image_tokens,
),
output_tokens=output_image_tokens,
total_tokens=text_tokens + image_tokens + output_image_tokens,
),
)
cost = azure_ai_image_cost_calculator(model=model, image_response=image_response)
expected_cost = (
text_tokens * model_info["input_cost_per_token"]
+ image_tokens * model_info["input_cost_per_image_token"]
+ output_image_tokens * model_info["output_cost_per_image_token"]
)
assert round(cost, 10) == round(expected_cost, 10)
assert model_info["input_cost_per_image_token"] != model_info["input_cost_per_token"]
def test_mai_image_cost_calculator_falls_back_to_flat_image_pricing(self, monkeypatch):
monkeypatch.setenv("LITELLM_LOCAL_MODEL_COST_MAP", "True")
litellm.model_cost = litellm.get_model_cost_map(url="")

View file

@ -4230,3 +4230,30 @@ def test_completion_cost_prices_responses_websocket_turns_per_service_tier():
assert ws_cost == pytest.approx(_http_cost(100, 40, "default") + _http_cost(60, 10, "priority"))
assert ws_cost != pytest.approx(_http_cost(160, 50, "default"))
assert ws_cost != pytest.approx(_http_cost(160, 50, "priority"))
QWEN3_NEXT_REGIONS: Final = ("ap-northeast-1", "ap-south-1", "ap-southeast-2", "eu-west-1", "eu-west-2", "sa-east-1")
@pytest.mark.parametrize("region", QWEN3_NEXT_REGIONS)
def test_cost_per_token_bedrock_qwen3_next_uses_regional_entry_not_us_rate(
monkeypatch: pytest.MonkeyPatch, region: str
) -> None:
monkeypatch.setenv("LITELLM_LOCAL_MODEL_COST_MAP", "True")
monkeypatch.setattr(litellm, "model_cost", litellm.get_model_cost_map(url=""))
regional: Final = litellm.model_cost[f"bedrock/{region}/qwen.qwen3-next-80b-a3b"]
us: Final = litellm.model_cost["qwen.qwen3-next-80b-a3b"]
assert regional["input_cost_per_token"] != us["input_cost_per_token"]
assert regional["output_cost_per_token"] != us["output_cost_per_token"]
prompt_tokens, completion_tokens = 1000, 500
prompt_usd, completion_usd = cost_per_token(
model=f"bedrock/{region}/qwen.qwen3-next-80b-a3b",
prompt_tokens=prompt_tokens,
completion_tokens=completion_tokens,
custom_llm_provider="bedrock",
)
assert prompt_usd == pytest.approx(prompt_tokens * regional["input_cost_per_token"])
assert completion_usd == pytest.approx(completion_tokens * regional["output_cost_per_token"])

View file

@ -652,6 +652,7 @@ def validate_model_cost_values(model_data, exceptions=None):
"cache_creation_input_audio_token_cost",
"cache_read_input_token_cost",
"cache_read_input_audio_token_cost",
"cache_read_input_image_token_cost",
"input_dbu_cost_per_token",
"output_db_cost_per_token",
"output_dbu_cost_per_token",
@ -740,6 +741,7 @@ def test_aaamodel_prices_and_context_window_json_is_valid():
"cache_read_input_token_cost_above_512k_tokens": {"type": "number"},
"cache_creation_input_token_cost_above_1hr_above_200k_tokens": {"type": "number"},
"cache_read_input_audio_token_cost": {"type": "number"},
"cache_read_input_image_token_cost": {"type": "number"},
"audio_transcription_config": {"type": "string"},
"deprecation_date": {"type": "string"},
"input_cost_per_audio_per_second": {"type": "number"},

View file

@ -30903,6 +30903,8 @@ export interface components {
cache_creation_input_token_cost_ultrafast?: number | null;
/** Cache Read Input Audio Token Cost */
cache_read_input_audio_token_cost?: number | null;
/** Cache Read Input Image Token Cost */
cache_read_input_image_token_cost?: number | null;
/** Cache Read Input Token Cost */
cache_read_input_token_cost?: number | null;
/** Cache Read Input Token Cost Above 200K Tokens */
@ -41620,6 +41622,8 @@ export interface components {
cache_creation_input_token_cost_ultrafast?: number | null;
/** Cache Read Input Audio Token Cost */
cache_read_input_audio_token_cost?: number | null;
/** Cache Read Input Image Token Cost */
cache_read_input_image_token_cost?: number | null;
/** Cache Read Input Token Cost */
cache_read_input_token_cost?: number | null;
/** Cache Read Input Token Cost Above 200K Tokens */

View file

@ -44,6 +44,7 @@ bedrock/ap-northeast-1/minimax.minimax-m2.5
bedrock/ap-northeast-1/moonshotai.kimi-k2-thinking
bedrock/ap-northeast-1/moonshotai.kimi-k2.5
bedrock/ap-northeast-1/qwen.qwen3-coder-next
bedrock/ap-northeast-1/qwen.qwen3-next-80b-a3b
bedrock/moonshotai.kimi-k2-thinking
bedrock/moonshotai.kimi-k2.5
bedrock/ap-south-1/meta.llama3-70b-instruct-v1:0
@ -54,6 +55,7 @@ bedrock/ap-south-1/minimax.minimax-m2.5
bedrock/ap-south-1/moonshotai.kimi-k2-thinking
bedrock/ap-south-1/moonshotai.kimi-k2.5
bedrock/ap-south-1/qwen.qwen3-coder-next
bedrock/ap-south-1/qwen.qwen3-next-80b-a3b
bedrock/ap-southeast-2/minimax.minimax-m2.5
bedrock/ap-southeast-3/deepseek.v3.2
bedrock/ap-southeast-3/minimax.minimax-m2.1
@ -83,11 +85,13 @@ bedrock/eu-west-1/meta.llama3-8b-instruct-v1:0
bedrock/eu-west-1/minimax.minimax-m2.1
bedrock/eu-west-1/minimax.minimax-m2.5
bedrock/eu-west-1/qwen.qwen3-coder-next
bedrock/eu-west-1/qwen.qwen3-next-80b-a3b
bedrock/eu-west-2/meta.llama3-70b-instruct-v1:0
bedrock/eu-west-2/meta.llama3-8b-instruct-v1:0
bedrock/eu-west-2/minimax.minimax-m2.1
bedrock/eu-west-2/minimax.minimax-m2.5
bedrock/eu-west-2/qwen.qwen3-coder-next
bedrock/eu-west-2/qwen.qwen3-next-80b-a3b
bedrock/eu-west-3/mistral.mistral-7b-instruct-v0:2
bedrock/eu-west-3/mistral.mistral-large-2402-v1:0
bedrock/eu-west-3/mistral.mixtral-8x7b-instruct-v0:1
@ -103,6 +107,7 @@ bedrock/sa-east-1/minimax.minimax-m2.5
bedrock/sa-east-1/moonshotai.kimi-k2-thinking
bedrock/sa-east-1/moonshotai.kimi-k2.5
bedrock/sa-east-1/qwen.qwen3-coder-next
bedrock/sa-east-1/qwen.qwen3-next-80b-a3b
bedrock/us-east-1/1-month-commitment/anthropic.claude-instant-v1
bedrock/us-east-1/1-month-commitment/anthropic.claude-v1
bedrock/us-east-1/1-month-commitment/anthropic.claude-v2:1
@ -240,3 +245,4 @@ bedrock/us-gov-east-1/anthropic.claude-sonnet-5
bedrock/us-gov-east-1/anthropic.claude-opus-4-8
bedrock/us-gov-east-1/anthropic.claude-opus-5
bedrock/us-gov-east-1/anthropic.claude-fable-5-1
bedrock/ap-southeast-2/qwen.qwen3-next-80b-a3b