litellm/tests/unit/llms/azure
tavren27 6fc368a15c
fix(azure): send no api-version on Foundry project /openai/v1 Responses bases (#51767)
* fix(azure): send no api-version on Foundry project /openai/v1 Responses bases

Azure answers 400 "api-version query parameter is not allowed when using /v1 path" for every api-version on a Foundry project's /api/projects/<p>/openai/v1/responses route, so drop it there and keep it everywhere else

* fix(azure): send no api-version on Foundry project v1 chat and WebSocket, bill routed models

Chat completions on a Foundry project /openai/v1 base now use the v1 OpenAI client, so they send no
api-version, which that path rejects. The Responses WebSocket URL builder strips a bare /openai/v1 base
before adding /openai/v1/responses, so it no longer dials a doubled path. An azure/model-router call that
routes to a model priced only under azure_ai/ is billed from that row plus the router fee once

* fix(azure): keep the Azure client off chat-only paths, honor api_version none, drop api-version from v1 base queries

Only chat completions switch to the v1 OpenAI client on a Foundry project /openai/v1 base, so transcription and
azure_text keep the Azure client and no longer fail inside LiteLLM. A deployment with api_version none sends no
api-version on Responses and chat, for gateways that hide the project path. The v1 client now moves an api_base
query into default_query without api-version instead of gluing the route after it

* fix(azure): pick the v1 client for o-series chat, keep api_version none off a doubled /openai/responses path

* fix(azure): send no api-version on embeddings under api_version none, test async and streaming chat on v1 bases

* fix(azure): join openai/v1 once onto a v1 client base that ends in /openai

Chat and embeddings under api_version none, and chat under api_version v1, built /openai/openai/v1 from an api_base ending in /openai, while Responses on the same base already built /openai/v1. The v1 client now joins the route the same overlap-aware way

* fix(azure): keep a percent-encoded gateway path as typed on the v1 client base

Join openai/v1 by string instead of add_path_to_api_base, which decodes %2F, %25, %3F and %23 in the base path. Type the chat test helper's mode as a Literal with assert_never.

* test(azure): import assert_never from typing_extensions so the Azure tests load on Python 3.10

typing.assert_never needs Python 3.11, and the package supports 3.10

---------

Co-authored-by: mateo-berri <277851410+mateo-berri@users.noreply.github.com>
2026-11-14 05:24:12 -05:00
..
batches test: move tests/test_litellm/llms into tests/unit/llms (#43191) 2026-09-25 12:43:23 -07:00
chat refactor(rust_bridge): route every Rust-to-Python call through host modules (#50822) 2026-11-11 01:57:54 +00:00
completion test: migrate tests/llm_translation into unit, integration and e2e tiers (#45759) 2026-10-11 07:58:53 +00:00
decisions fix(azure)!: answer 401 when Entra rejects the deployment's credential (#49863) 2026-11-04 20:44:55 +00:00
image_edit test(unit): add package markers to migrated unit test directories 2026-09-20 11:53:14 +00:00
image_generation refactor(images): remove dall-e-2 and dall-e-3 code paths (#48703) 2026-10-28 17:48:09 -07:00
passthrough fix(vllm): write spend log rows for /vllm passthrough calls to router models (#45733) 2026-10-14 12:40:48 -07:00
realtime feat(realtime)!: support latest OpenAI audio models (#35600) 2026-11-03 07:27:52 +00:00
response fix(azure): send no api-version on Foundry project /openai/v1 Responses bases (#51767) 2026-11-14 05:24:12 -05:00
search fix(azure)!: answer 401 when Entra rejects the deployment's credential (#49863) 2026-11-04 20:44:55 +00:00
text_to_speech test: migrate SDK and proxy-booting legacy CircleCI tests to their tiers (#45758) 2026-10-11 00:17:21 -07:00
vector_stores fix(vector_stores): put azure vector store id before the api-version query on retrieve, update and delete (#48224) 2026-10-24 13:44:19 -07:00
videos test: move tests/test_litellm/llms into tests/unit/llms (#43191) 2026-09-25 12:43:23 -07:00
__init__.py test(unit): add package markers to migrated unit test directories 2026-09-20 11:53:14 +00:00
test_audio_transcriptions.py feat(realtime)!: support latest OpenAI audio models (#35600) 2026-11-03 07:27:52 +00:00
test_azure.py fix(azure): share one Entra token request per worker and audit #47348 (#48769) 2026-10-28 12:24:20 -07:00
test_azure_common_utils.py fix(azure): send no api-version on Foundry project /openai/v1 Responses bases (#51767) 2026-11-14 05:24:12 -05:00
test_azure_cost_calculation.py test: move tests/test_litellm/llms into tests/unit/llms (#43191) 2026-09-25 12:43:23 -07:00
test_azure_embedding.py test: migrate tests/llm_translation into unit, integration and e2e tiers (#45759) 2026-10-11 07:58:53 +00:00
test_azure_exception_mapping.py fix(openai): keep the upstream error body on e.response for OpenAI and Azure errors (#49079) 2026-10-29 23:30:02 -07:00
test_azure_fine_tuning_api.py test: move tests/test_litellm/llms into tests/unit/llms (#43191) 2026-09-25 12:43:23 -07:00
test_azure_ptu_capacity.py feat(proxy): split Azure PTU deployments across teams with per-team PTU ceilings and PTU-hour reporting (#43043) 2026-10-15 18:44:30 +00:00
test_azure_speech_audio_transcription.py refactor(types): replace Any with proven types in 137 files (#44478) 2026-10-05 11:01:45 -07:00