mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-28 01:32:17 +00:00
feat(azure_ai): add MAI-Image-2.5-Pro image generation pricing
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
This commit is contained in:
parent
2886b8ee27
commit
d268c8b58a
3 changed files with 58 additions and 0 deletions
|
|
@ -11159,6 +11159,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,
|
||||
|
|
|
|||
|
|
@ -11159,6 +11159,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,
|
||||
|
|
|
|||
|
|
@ -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="")
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue