Repository navigation
fix(azure): send the deployment's api_version on async audio transcriptions - #53400
Conversation
…dio transcriptions Azure's v1 route answers DeploymentNotFound for transcription deployments, so preview, latest and v1 fall back to the dated default on the per-deployment route, which also stops the sync path from raising on a v1 client
…iption_api_version # Conflicts: # litellm/llms/azure/audio_transcriptions.py # tests/unit/llms/azure/test_audio_transcriptions.py
[Medium impact] The PR appears safe to merge, with no new actionable issues found.
|
…iption_api_version # Conflicts: # tests/unit/llms/azure/test_audio_transcriptions.py
|
bugbot run |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit be13b19. Configure here.
Handwritten 1-3 sentence description
Azure transcription deployments now send the api_version you set in config.yaml. Before this, every proxy and router call quietly used litellm's default 2025-02-01-preview, so pinning a version did nothing
Details
TLDR
Problem this solves:
api_version2025-02-01-previewinsteadHow it solves it:
api_versionas sync--api_version(default2025-02-01-preview), orAZURE_API_VERSIONin the SDKnonefalls back the same wayv1, latest, preview and
nonekeep the deployments route, as sync has done since #35600. Chat sendsnoneto Azure's/openai/v1route, but that route answers DeploymentNotFound for transcription deployments. Before this, sync sentapi-version=none, which Azure answers with 404Async now picks the version like sync and chat. The request's
api_versionwins, then the deployment's, thenlitellm_settings.api_version, thenAZURE_API_VERSION. Aliases skiplitellm_settings.api_versionAn existing router test expected the default version for a dated deployment, which pinned this bug. It now expects the configured version
This is one of a pair with the lts/1.108.x twin. Merge this one first, then the LTS one
User Flow
Before: an admin pins a dated
api_versionon an Azure transcription deployment, and Azure still gets litellm's default versionazure/whisperwithapi_version: "2024-06-01"to config.yaml and starts the proxymodel=whisper-datedand a wav fileapi-version=2025-02-01-preview, not the pinned2024-06-01After: the same request reaches Azure with the pinned version
azure/whisperwithapi_version: "2024-06-01"to config.yaml and starts the proxymodel=whisper-datedand a wav fileapi-version=2024-06-01, and gpt-transcribe pinned at2025-03-01-previewgets its version too, streaming includedPre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
uv run pytest tests/unit/<your_test_file>.py -v. Leave the suites (make test-unit-*,make test-unit) to CI: it finishes in ~15 minutes where a laptop takes an hour or moreDelays in PR merge?
If you're seeing a delay in your PR being merged, ping the LiteLLM Team on Slack (#pr-review).
Screenshots / Proof of Fix
Last updated: be13b19. QA ran on d1ee386. Changes since QA: one local variable renamed in
audio_transcriptions.py. Proof remains valid because the rename changes no value. Verification: affected unit tests andmake checkpass at be13b19Before ran at the merge base cc497fd and After at d1ee386, each a no-DB proxy with 2 uvicorn workers, called with curl against real Azure. A logging forward proxy in front of Azure records each request's api-version and status.
AZURE_API_VERSIONis unset2024-06-012025-02-01-preview2024-06-012025-03-01-preview2025-02-01-preview2025-03-01-previewstream=true2025-03-01-preview2025-02-01-preview2025-03-01-previewv12025-02-01-preview2025-02-01-previewV12025-02-01-preview2025-02-01-previewnone2025-02-01-preview2025-02-01-previewnonenone, 4042025-02-01-preview, 200PreviewPreview, 4042025-02-01-preview, 200Every proxy call answered 200 with the Gettysburg transcript on both legs. The SDK calls with
noneandPreviewgot a 404 before and the transcript afterShared setup (config.yaml, proxy launcher, egress logger, SDK script, case script)
Env var names:
AZURE_LIT6549_AUDIO_QA_API_BASE,AZURE_LIT6549_AUDIO_QA_API_KEY(whisper resource),AZURE_FOUNDRY_API_BASE,AZURE_FOUNDRY_API_KEY(gpt-transcribe resource)config.yaml for the Before leg (the After leg is the same with its own logger ports 21395 and 29800)
Proxy launcher, run as
launch.sh <tree> <venv> <port> <config>Egress logger, run as
python recorder.py <port> $AZURE_..._API_BASE <leg>-<resource>.jsonlonce per resource per legSDK script, run as
sdk_version.py <api_base> <api_version>Case script, run as
cases.sh <leg> <tree> <venv> <proxy port> <logger port>Before (cc497fd)
whisper, api_version 2024-06-01
Send the request
Read the egress log rows that call wrote
gpt-transcribe, api_version 2025-03-01-preview
Commands and output
Send the request
Read the egress log rows that call wrote
gpt-transcribe streaming, api_version 2025-03-01-preview
Commands and output
Send the request
Read the egress log rows that call wrote
gpt-transcribe, api_version v1
Commands and output
Send the request
Read the egress log rows that call wrote
gpt-transcribe, api_version V1
Commands and output
Send the request
Read the egress log rows that call wrote
gpt-transcribe, api_version none
Commands and output
Send the request
Read the egress log rows that call wrote
Python SDK, litellm.transcription with api_version none
Commands and output
Send the request
Read the egress log rows that call wrote
Python SDK, litellm.transcription with api_version Preview
Commands and output
Send the request
Read the egress log rows that call wrote
After (d1ee386)
whisper, api_version 2024-06-01
Send the request
Read the egress log rows that call wrote
gpt-transcribe, api_version 2025-03-01-preview
Commands and output
Send the request
Read the egress log rows that call wrote
gpt-transcribe streaming, api_version 2025-03-01-preview
Commands and output
Send the request
Read the egress log rows that call wrote
gpt-transcribe, api_version v1
Commands and output
Send the request
Read the egress log rows that call wrote
gpt-transcribe, api_version V1
Commands and output
Send the request
Read the egress log rows that call wrote
gpt-transcribe, api_version none
Commands and output
Send the request
Read the egress log rows that call wrote
Python SDK, litellm.transcription with api_version none
Commands and output
Send the request
Read the egress log rows that call wrote
Python SDK, litellm.transcription with api_version Preview
Commands and output
Send the request
Read the egress log rows that call wrote
/live-pr-risk
No breaking path at d1ee386. The two contract changes below are the ones the ticket asks for
Ran on d1ee386 against the merge base cc497fd. Each side ran two proxy processes with 2 workers each on one Postgres and one Redis, and requests alternated between the two processes. A logging forward proxy in front of each Azure resource recorded every request's path, api-version and status.
AZURE_API_VERSIONwas unset andlitellm_settings.api_versionwas2025-04-01-preview. The rename in be13b19 changes no value, so these results stand for it. Main has changed none of the files on this walk since cc497fd apart from an OTEL settings change inproxy_server.py, so they also stand for the merge into mainBreaking
None. Every dependent answered the same on both sides apart from the version this PR means to send
Backward incompatible
A caller's
api_versionform field or?api-version=now wins over the deployment's pin on async transcription, where the merge base ignored it. A 5 KB value answered 200 at the merge base and an Azure 404 at the tip. An emptyapi_versionform field now drops the pin, solitellm_settings.api_versionis sent. Chat does the same for an emptyapi_versionon both sides. Mateo asked for chat's order in the ticket behind this PR ("as chat completions does"), so no separate sign-off is neededAn unpinned transcription deployment now gets
litellm_settings.api_versioninstead of the proxy's default. A pin or global value Azure does not support for audio now gets a 404 (see Caveats). Mateo's ticket asks for this tooRegression risk
The Entra ID token path builds its client through the same helper with the same version argument and was not driven live. The version argument is the only input this PR changes there, and the API key cells exercise it
Dependency graph
azure_ai/transcriptionstream=true/health?model=NONE, 5 KB/key/*/v1/messages/spend/logstests/e2eNot verified
The Entra ID token path, since no Entra app credential for the QA Azure resources is in the
.env. The Azure v1 streaming e2e test, which sendsv1, an input this PR leaves as it was. The unit shards, which CI runs at the tipType
🐛 Bug Fix
Caveats (if any)
Medium
api_versionandlitellm_settings.api_versionnow reach Azure on async transcription?api-version=or routerdefault_litellm_paramsbeats the pin, and an unpinned deployment gets the global value2023-05-15sent either way answered 200 at the merge base and 404 here. Sync and chat already work this way2023-05-15pin answered 200 at the merge base, which ignored it, and 404 here. Azure also rejects2023-07-01-previewfor audio2023-09-01-previewor newerLow
nonedeployments skiplitellm_settings.api_version, as sync did at the merge base (see Decisions)litellm.api_versionto adatetime.datenow raises on async transcription, as chat already does. The proxy refuses an unquoted date at boot on both sidesDecisions
litellm_settings.api_version,AZURE_API_VERSION, then the default. The rejected option was reading only the deployment's version on async, which would make async and sync disagree. Request kwargs, routerdefault_litellm_paramsincluded, override deployment params for every router call type, and stopping callers from sendingapi_versionwould be a proxy-wide auth change for chat too, so it stays outside this fixnonekeep the deployments route and fall back toAZURE_API_VERSIONor the default, skippinglitellm_settings.api_version. That is what sync did for lowercase v1, latest and preview at the merge base. One rejected option was sendinglitellm_settings.api_versionfor them, which would also change sync for alias deployments and treat an alias like no version at all. The other was chat's/openai/v1route with no api-version, since that route answers DeploymentNotFound for transcription deploymentsV1keeps the default as async always did. The shared helper stays exact-case, since changing it would also change chat routingFinal Attestation
Bugbot summary