mirror of
https://github.com/BerriAI/litellm.git
synced 2026-11-14 09:03:16 +00:00
fix(cost-map): add azure_ai/claude-mythos-5-1 entry
`azure_ai/claude-mythos-5-1` had no entry in the model cost map, so the provider lookup rejected it (the bare `claude-mythos-5-1` belongs to the `anthropic` provider). `cost_per_token()` raised `ModelNotMappedError` and the proxy recorded zero spend for a model that actually bills. Add the dedicated `azure_ai/` entry, reusing Anthropic's published per-model token rates (per the Microsoft Foundry docs: Foundry uses Anthropic's published rates), and mirroring the existing `azure_ai/claude-*` layout. Add a regression test that resolves the entry via `get_model_info` and asserts non-zero input/output costs from `cost_per_token` (no credentials needed). Fixes #49865
This commit is contained in:
parent
baddc67041
commit
d652ee3677
2 changed files with 70 additions and 1 deletions
|
|
@ -3833,7 +3833,39 @@
|
|||
"prompt_cache_min_tokens": 4096,
|
||||
"source": "https://learn.microsoft.com/en-us/azure/foundry/openai/concepts/model-retirement-schedule"
|
||||
},
|
||||
"azure_ai/claude-opus-4-5": {
|
||||
"azure_ai/claude-mythos-5-1": {
|
||||
"litellm_provider": "azure_ai",
|
||||
"mode": "chat",
|
||||
"max_input_tokens": 1000000,
|
||||
"max_output_tokens": 128000,
|
||||
"input_cost_per_token": 1e-05,
|
||||
"output_cost_per_token": 5e-05,
|
||||
"input_cost_per_token_batches": 5e-06,
|
||||
"output_cost_per_token_batches": 2.5e-05,
|
||||
"cache_creation_input_token_cost": 1.25e-05,
|
||||
"cache_creation_input_token_cost_above_1hr": 2e-05,
|
||||
"cache_creation_input_token_cost_batches": 6.25e-06,
|
||||
"cache_read_input_token_cost": 2.5e-07,
|
||||
"cache_read_input_token_cost_batches": 1.25e-07,
|
||||
"prompt_cache_min_tokens": 512,
|
||||
"supports_function_calling": true,
|
||||
"supports_vision": true,
|
||||
"supports_pdf_input": true,
|
||||
"supports_prompt_caching": true,
|
||||
"supports_reasoning": true,
|
||||
"supports_response_schema": true,
|
||||
"supports_tool_choice": true,
|
||||
"supports_computer_use": true,
|
||||
"supports_assistant_prefill": false,
|
||||
"supports_sampling_params": false,
|
||||
"supports_adaptive_thinking": true,
|
||||
"supports_xhigh_reasoning_effort": true,
|
||||
"supports_max_reasoning_effort": true,
|
||||
"supports_output_config": true,
|
||||
"supports_native_structured_output": true,
|
||||
"source": "https://platform.claude.com/docs/en/about-claude/pricing"
|
||||
},
|
||||
"azure_ai/claude-opus-4-5": {
|
||||
"deprecation_date": "2026-11-24",
|
||||
"cache_creation_input_token_cost": 6.25e-06,
|
||||
"cache_creation_input_token_cost_above_1hr": 1e-05,
|
||||
|
|
|
|||
37
tests/unit_tests/test_azure_ai_mythos_cost_map.py
Normal file
37
tests/unit_tests/test_azure_ai_mythos_cost_map.py
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
"""
|
||||
Regression test for https://github.com/BerriAI/litellm/issues/49865
|
||||
|
||||
`azure_ai/claude-mythos-5-1` had no entry in the model cost map. The bare
|
||||
`claude-mythos-5-1` entry belongs to the `anthropic` provider and is rejected by
|
||||
the azure_ai provider lookup, so `cost_per_token()` raised `ModelNotMappedError`
|
||||
and the proxy recorded zero spend for a model that actually bills.
|
||||
|
||||
This test asserts the dedicated azure_ai entry resolves and returns non-zero
|
||||
input/output costs, mirroring the issue's reproduction (no credentials needed).
|
||||
"""
|
||||
import pytest
|
||||
|
||||
from litellm import cost_per_token, get_model_info
|
||||
|
||||
|
||||
def test_azure_ai_claude_mythos_5_1_get_model_info():
|
||||
info = get_model_info("claude-mythos-5-1", custom_llm_provider="azure_ai")
|
||||
assert info["litellm_provider"] == "azure_ai"
|
||||
assert info["input_cost_per_token"] > 0
|
||||
assert info["output_cost_per_token"] > 0
|
||||
|
||||
|
||||
def test_azure_ai_claude_mythos_5_1_cost_per_token():
|
||||
spend = cost_per_token(
|
||||
model="claude-mythos-5-1",
|
||||
custom_llm_provider="azure_ai",
|
||||
prompt_tokens=1271,
|
||||
completion_tokens=389,
|
||||
)
|
||||
try:
|
||||
prompt_cost, completion_cost = spend
|
||||
except (TypeError, ValueError):
|
||||
prompt_cost = spend["prompt_cost"]
|
||||
completion_cost = spend["completion_cost"]
|
||||
assert prompt_cost > 0
|
||||
assert completion_cost > 0
|
||||
Loading…
Add table
Reference in a new issue