From d652ee367769120193f54e4c7ed8d425fd696cce Mon Sep 17 00:00:00 2001 From: AaronG Date: Wed, 4 Nov 2026 08:04:15 +0800 Subject: [PATCH] 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 --- model_prices_and_context_window.json | 34 ++++++++++++++++- .../test_azure_ai_mythos_cost_map.py | 37 +++++++++++++++++++ 2 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 tests/unit_tests/test_azure_ai_mythos_cost_map.py diff --git a/model_prices_and_context_window.json b/model_prices_and_context_window.json index be93d6fcd9b..e8f6677e628 100644 --- a/model_prices_and_context_window.json +++ b/model_prices_and_context_window.json @@ -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, diff --git a/tests/unit_tests/test_azure_ai_mythos_cost_map.py b/tests/unit_tests/test_azure_ai_mythos_cost_map.py new file mode 100644 index 00000000000..17d506b8c8b --- /dev/null +++ b/tests/unit_tests/test_azure_ai_mythos_cost_map.py @@ -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