fix(pricing): add undated azure aliases for gpt-audio-mini and gpt-realtime-mini - #37867
Conversation
|
@greptileai can you reply here with a score and why that score? |
|
Score: 5/5 This is a clean, well-scoped bug fix with strong evidence of the production issue and a correct solution. Here's why: What's right:
Minor observation (not a blocker): The Bottom line: Minimal blast radius, clear root cause, production-verified fix, strong test coverage. Ready to merge. |
Greptile SummaryThe PR adds undated Azure aliases for
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
| Filename | Overview |
|---|---|
| model_prices_and_context_window.json | Adds canonical undated Azure audio and realtime-mini aliases that exactly mirror their dated entries. |
| litellm/model_prices_and_context_window_backup.json | Keeps the packaged fallback pricing map synchronized with the canonical map. |
| tests/test_litellm/test_azure_audio_price_aliases.py | Verifies alias pricing, full metadata parity, and synchronization between both maps using the cache-clearing shared fixture. |
| tests/test_litellm/test_gpt_realtime_mode.py | Extends realtime-only model coverage to the new undated Azure realtime alias. |
Reviews (3): Last reviewed commit: "test(pricing): assert the azure audio al..." | Re-trigger Greptile
…altime-mini Azure deployments are commonly created against the undated model name, and the cost-tracking docs say to set base_model to azure/<model> — but only the dated -2025-10-06 entries existed for these two models (the openai provider has undated aliases for both). base_model: azure/gpt-audio-mini therefore resolved to nothing and, depending on the fallback path, text tokens billed at $0 while audio tokens billed fine. Mirror the -2025-10-06 entries as undated aliases, exactly like the undated openai entries mirror their newest dated variant. Fixes #33170 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…r dated entries Review follow-up: COST_FIELDS missed realtime-specific cost keys (cache_creation_input_audio_token_cost, cache_read_input_token_cost, input_cost_per_image). Full-entry equality catches drift on every field. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…e-mini alias Upstream changed the dated entry's mode from chat to realtime after this branch was cut; the undated alias must stay a byte-for-byte mirror. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
e189a58 to
23c3a13
Compare
…nfo's lru_cache never crosses maps
|
Pushed two updates since the last review: (1) rebased onto latest @greptileai can you reply here with a score and why that score? |
|
Score: 5/5 The PR is clean and correct. Here's the breakdown: What's right:
No issues remaining: the two previous inline findings (fixture usage and redundant comment) were both addressed in the latest push. Nothing left to block this. |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
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 805224a. Configure here.
…ot just the backup The alias test ran under the local_model_cost_map fixture, which pins litellm.model_cost to the packaged backup. A proxy left on its defaults fetches the root map instead, and that copy is what ships to the CDN, so an alias present in only one of the two files still bills $0 for every proxy reading the other. That is the same failure this file exists to prevent, and nothing caught it: dropping azure/gpt-audio-mini from the root map alone left the whole file green. Assert the root map directly, assert it agrees with the backup, and add azure/gpt-realtime-mini to REALTIME_ONLY_GPT_MODELS so the new realtime key also gets the root-map mode and endpoint checks its dated sibling already had.
|
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 e1c97eb. Configure here.
Note
This is a copy of #33291 by @mihidumh, pushed to a
litellm_-prefixed branch so the full CircleCI pipeline (which doesn't run on fork PRs) can execute. Commit authorship is preserved, so full credit goes to the original authorTLDR
Problem this solves:
azure/gpt-audio-miniorazure/gpt-realtime-minikeymodel_info.base_modelis what prices thembase_model: azure/gpt-audio-minipins the lookup to a key that isn't thereThis model isn't mapped yet, the proxy swallows it, and the call is logged at $0azure/gpt-realtime-minihit the same missing key with or withoutbase_model, so they log $0 tooHow it solves it:
-2025-10-06dated entriesUser Flow
Before: a team pricing an Azure audio deployment through
base_modelgets no cost header at all and $0 spend, on calls Azure does invoice them foraudio-mini-prod, registers it asmodel: azure/audio-mini-prodwithmodel_info.base_model: azure/gpt-audio-miniso the gateway knows what to price it as, and restarts the proxyPOST https://litellm-domain/v1/chat/completionswith"model": "audio-mini","modalities": ["text", "audio"], an audio config, and a short promptusageblock shows real counts, with the completion tokens split into text and audiox-litellm-response-costheader at all, andx-litellm-response-cost-original,-input,-output, andx-litellm-key-spendall read0.0https://litellm-domain/ui/?page=logsand that request shows $0 spendAfter: the same call comes back priced, so the header and the logs page match what Azure charges
audio-mini-prod, registers it asmodel: azure/audio-mini-prodwithmodel_info.base_model: azure/gpt-audio-miniso the gateway knows what to price it as, and restarts the proxyPOST https://litellm-domain/v1/chat/completionswith"model": "audio-mini","modalities": ["text", "audio"], an audio config, and a short promptusageblock shows real counts, with the completion tokens split into text and audiox-litellm-response-costwith a non-zero figure, billing text at $0.60 per million in and $2.40 per million out, and audio at $10 per million in and $20 per million outhttps://litellm-domain/ui/?page=logsand that request shows the real spendRelevant issues
Fixes #33170
Linear ticket
Resolves LIT-5990
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
uv run pytest tests/test_litellm/<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 more@greptileaito re-request a review after pushing changes)Delays 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
Live proxy against real Azure on both legs, real audio generation, real spend. Same config, same request, only the commit the proxy booted from differs.
audio-mini-prodis a real Azure deployment of gpt-audio-mini created under an admin-chosen name, which is exactly whymodel_info.base_modelis what prices it:Before, at merge base
0a5fa4fdc6599eb236c8116f9ce77e1ec29f83aeNo
x-litellm-response-costheader at all, and every cost field reads0.0, against a response that really did generate audio:Transcript
"Hello to you right now.", withaudio.datacarrying a real wav payload startingUklGRv////9XQVZFZm10After, at
e1c97eb3ee4570320ccf58c4fb6285e7c81a4692(the PR tip)Transcript
"Hello to you, my friend!". The arithmetic is exact on all three figures: input12 * 6e-07 = 7.2e-06, output15 * 2.4e-06 + 63 * 2e-05 = 0.001296, total0.0013032Realtime sessions, the same flip, with no
base_modelinvolvedA second A/B ran a real proxy at the merge base and at this tip against a live Azure
gpt-realtime-minideployment, drove a websocket session on/v1/realtime, and read the spend rows back out of each side's Postgres.Base:
Head:
Identical sessions and identical token counts, logged at
$0before and at a real figure after. The realtime path dials the deployment's ownazure/gpt-realtime-mini, so it needs nobase_modelto hit the missing keyNothing that already worked changed
The same A/B compared both sides across the map-reading surfaces.
/v1/modelsis byte-identical between base and head, with and withoutinclude_metadataandreturn_wildcard_routes, so no new model is exposed to clients. Chat audio deployments that already billed correctly bill the same rates on both sides. The only endpoints that differ are the ones that report model metadata (/model/info,/model_group/info,/model/deprecations), and each differs only by the two new keys' own data.Two reporting surfaces move in the fix's direction.
/model/deprecationslisted an undated Azure deployment under the OpenAI entry before (litellm_provider: openai,2027-01-20) and lists it under the Azure entry now (azure,2027-04-06)./healthprobes anazure/gpt-realtime-minideployment as a realtime model rather than a chat one, and it reports healthy on both sides.Observed alongside the runs, none of it caused or made worse by this PR:
base_model, the same deployment already billed correctlyThe one thing this PR does change beyond the header is
/v1/model/info, which reported0prices andmode: nullfor both aliases beforeType
🐛 Bug Fix
Caveats (if any)
-2025-10-06deprecation_date, matching most undated map keysazure/gpt-realtime-minigo from zero recorded spend to charged. Anyone running that deployment today will see spend appear where their dashboards read $0, and key or team budgets that could never be reached before can now tripmodel_info.base_model. It resolves from the model the session reports and the deployment's own model name, which is why adding the undated alias is what fixes it, and why pinningbase_modelon a realtime deployment does nothing for cost either way. That behavior is pre-existing and untouched hereazure/gpt-realtime-mininow reportsmode: realtime, so/healthprobes it over a websocket instead of as a chat model. That is the correct probe for it, but a deployment that answers chat probes while websockets are blocked would flip from healthy to unhealthy on upgradeFinal Attestation
Note
Low Risk
Data-only pricing map plus tests; no auth or request-path changes. Realtime alias now reports mode realtime, which can change health-check probing for that base_model.
Overview
Fixes Azure audio/realtime spend being logged at $0 when deployments are priced via
base_model: azure/gpt-audio-miniorazure/gpt-realtime-mini(issue #33170). Those undated keys were missing, so cost lookup failed and the proxy swallowed the error.Adds both aliases as exact mirrors of the dated
-2025-10-06entries in the root and packaged cost maps (chat + audio for audio-mini; realtime + cache/image costs for realtime-mini). Tests require the aliases to exist, match their dated counterparts field-for-field, and stay in sync across both JSON files.Reviewed by Cursor Bugbot for commit e1c97eb. Bugbot is set up for automated code reviews on this repo. Configure here.