-
-
Notifications
You must be signed in to change notification settings - Fork 11k
fix(pricing): add undated azure aliases for gpt-audio-mini and gpt-realtime-mini #33291
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
mihidumh
wants to merge
4
commits into
BerriAI:litellm_internal_staging
from
mihidumh:fix/azure-audio-mini-price-aliases
Closed
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
0a39803
fix(pricing): add undated azure aliases for gpt-audio-mini and gpt-re…
mihidumh d47cd73
test(pricing): assert undated azure audio aliases exactly mirror thei…
mihidumh d1853ff
fix(pricing): mirror updated mode=realtime on the undated gpt-realtim…
mihidumh e189a58
fix(pricing): mirror the new deprecation_date onto the undated gpt-au…
mihidumh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| """Undated azure aliases for the audio models must exist and match their dated | ||
| variants — Azure deployments are commonly created against the undated model | ||
| name, and `base_model: azure/gpt-audio-mini` previously resolved to nothing | ||
| (text tokens billed at $0). Issue #33170.""" | ||
|
|
||
| import pytest | ||
|
|
||
| import litellm | ||
|
|
||
|
|
||
| @pytest.fixture(autouse=True) | ||
| def _use_local_model_cost_map(monkeypatch): | ||
| original_model_cost = litellm.model_cost | ||
| monkeypatch.setenv("LITELLM_LOCAL_MODEL_COST_MAP", "True") | ||
| litellm.model_cost = litellm.get_model_cost_map(url="") | ||
| try: | ||
| yield | ||
| finally: | ||
| litellm.model_cost = original_model_cost | ||
|
|
||
|
|
||
| COST_FIELDS = ( | ||
| "input_cost_per_token", | ||
| "output_cost_per_token", | ||
| "input_cost_per_audio_token", | ||
| "output_cost_per_audio_token", | ||
| ) | ||
|
|
||
|
|
||
| @pytest.mark.parametrize( | ||
| "undated, dated", | ||
| [ | ||
| ("azure/gpt-audio-mini", "azure/gpt-audio-mini-2025-10-06"), | ||
| ("azure/gpt-realtime-mini", "azure/gpt-realtime-mini-2025-10-06"), | ||
| ], | ||
| ) | ||
| def test_undated_azure_audio_alias_matches_dated_entry(undated, dated): | ||
| undated_info = litellm.get_model_info(undated) | ||
| dated_info = litellm.get_model_info(dated) | ||
|
|
||
| for field in COST_FIELDS: | ||
| assert undated_info.get(field) == dated_info.get(field), field | ||
| # the production symptom was text tokens billed at $0 — make sure the | ||
| # alias carries real, non-zero prices | ||
| assert (undated_info.get(field) or 0) > 0, f"{undated}.{field} must be non-zero" | ||
|
|
||
| assert undated_info.get("litellm_provider") == "azure" | ||
| assert undated_info.get("mode") == dated_info.get("mode") | ||
|
|
||
|
|
||
| @pytest.mark.parametrize( | ||
| "undated, dated", | ||
| [ | ||
| ("azure/gpt-audio-mini", "azure/gpt-audio-mini-2025-10-06"), | ||
| ("azure/gpt-realtime-mini", "azure/gpt-realtime-mini-2025-10-06"), | ||
| ], | ||
| ) | ||
| def test_undated_azure_audio_alias_is_exact_mirror(undated, dated): | ||
| """The undated alias must be a byte-for-byte mirror of its dated entry — | ||
| covers every field (incl. realtime-specific cache/audio cost keys) so any | ||
| future drift between the pair is caught, not just the core COST_FIELDS.""" | ||
| model_map = litellm.model_cost | ||
| assert undated in model_map, f"{undated} missing from model cost map" | ||
| assert model_map[undated] == model_map[dated], ( | ||
| f"{undated} must exactly mirror {dated}; " | ||
| f"diff keys: {[k for k in set(model_map[undated]) | set(model_map[dated]) if model_map[undated].get(k) != model_map[dated].get(k)]}" | ||
| ) | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.