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]

fix(azure): add model router flat fee to azure provider cost tracking (#44876)

devin-ai-integration[bot]e2c55daaaff7
diff --git a/litellm/cost_calculator.py b/litellm/cost_calculator.py
index 8971b958c1c..86e1a8fd196 100644
--- a/litellm/cost_calculator.py
+++ b/litellm/cost_calculator.py
@@ -278,7 +278,7 @@ def _get_additional_costs(
try:
config_class = None
- if custom_llm_provider == "azure_ai":
+ if custom_llm_provider in ("azure_ai", "azure"):
from litellm.llms.azure_ai.common_utils import AzureFoundryModelInfo
config_class = AzureFoundryModelInfo.get_azure_ai_config_for_model(model)
@@ -1818,7 +1818,7 @@ def completion_cost(
)
# Get additional costs from provider (e.g., routing fees, infrastructure costs)
- if custom_llm_provider == "azure_ai" and not azure_ai_is_model_router_name(model):
+ if custom_llm_provider in ("azure_ai", "azure") and not azure_ai_is_model_router_name(model):
model_for_additional_costs = request_model_for_cost
if completion_response is not None:
hidden_params = getattr(completion_response, "_hidden_params", None) or {}