fix - azure model router integration

This commit is contained in:
Ishaan Jaffer 2026-01-13 13:50:07 -08:00
parent 93203cda7c
commit 43de4ffeab

View file

@ -364,4 +364,22 @@ def test_completion_azure_ai_gpt_4o_with_flexible_api_base(api_base):
except litellm.Timeout as e:
pass
except Exception as e:
pytest.fail(f"Error occurred: {e}")
pytest.fail(f"Error occurred: {e}")
@pytest.mark.asyncio
async def test_azure_ai_model_router():
litellm._turn_on_debug()
response = await litellm.acompletion(
model="azure_ai/azure-model-router",
messages=[{"role": "user", "content": "hi who is this"}],
api_base="https://ishaa-mh6uutut-swedencentral.cognitiveservices.azure.com/openai/v1/",
api_key=os.getenv("AZURE_MODEL_ROUTER_API_KEY"),
)
print("response: ", response)
# Check response cost
tracked_cost = response._hidden_params["response_cost"]
assert tracked_cost > 0
print("Tracked cost: ", tracked_cost)