fix(pricing): add the azure gpt-realtime-2 family and price realtime image input per token - #31565
Conversation
Greptile SummaryThis PR fixes image-token pricing for Azure realtime models and adds three missing
Confidence Score: 5/5
|
| Filename | Overview |
|---|---|
| model_prices_and_context_window.json | Renames input_cost_per_image → input_cost_per_image_token on three existing azure realtime entries, adds three new azure/gpt-realtime-2 family entries, and corrects gpt-realtime-2 (openai) context/output limits and output rate. All values verified against Azure's retail pricing API. |
| litellm/model_prices_and_context_window_backup.json | Mirror of the root JSON with identical changes — field renames, new azure entries, and gpt-realtime-2 limit corrections are kept in sync between both files. |
Reviews (7): Last reviewed commit: "fix(pricing): add the azure gpt-realtime..." | Re-trigger Greptile
Greptile SummaryThis PR updates the model cost maps for
Confidence Score: 4/5The pricing-map change is isolated, but the Azure output-token limit needs correction before merge. The modified JSON entries are straightforward and duplicated consistently, while the Azure metadata appears to advertise a larger output limit than the provider catalog allows. model_prices_and_context_window.json and litellm/model_prices_and_context_window_backup.json
What T-Rex did
Reviews (1): Last reviewed commit: "fix(pricing): add azure/gpt-realtime-2 a..." | Re-trigger Greptile |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
Fixed in 08e05df. The P1 was right: realtime output is capped at 4096, not 32000. Microsoft Foundry's catalog and the Azure OpenAI Realtime API docs both cap realtime output at 4096 tokens, matching every other realtime sibling in the map (gpt-realtime, gpt-realtime-1.5, gpt-realtime-mini), so max_output_tokens and max_tokens are now 4096 for both azure/gpt-realtime-2 and the openai gpt-realtime-2 correction. The 128k context window and the $24/1M text output price are unchanged |
|
The fix looks correct. Both files are updated consistently:
The Tip: You can customize Greptile's behavior for this repo with |
|
@greptileai can you also revisit your original review and update confidence score if everything is now in order? |
206991c to
3dcbd41
Compare
3dcbd41 to
e76f5c8
Compare
e76f5c8 to
91993db
Compare
yuneng-berri
left a comment
There was a problem hiding this comment.
Hey, thanks for the contribution. A few things to confirm before I can sign off on this:
- max_output_tokens is 4096 on all three, but OpenAI documents 32000 for gpt-realtime-2, 2.1, and 2.1-mini. Can you please confirm: https://developers.openai.com/api/docs/models/gpt-realtime-2.1-mini
- your azure/gpt-realtime-2 ($24 output / 128k context) is correct, but it now disagrees with the existing openai/gpt-realtime-2
…0 and reconcile openai/gpt-realtime-2 Addresses the maintainer review on BerriAI#31565. OpenAI documents gpt-realtime-2, gpt-realtime-2.1, and gpt-realtime-2.1-mini at a 128k context window and 32000 max output tokens (confirmed against developers.openai.com), so the three azure realtime-2 entries move from max_output_tokens/max_tokens 4096 to 32000, matching the already-correct openai gpt-realtime-2.1 entry. The existing openai gpt-realtime-2 entry was stale (32k context, 4096 output, $16 output); it is corrected to 128k context, 32000 output, and $24/1M output so it agrees with azure/gpt-realtime-2 and OpenAI's published rate. Both cost-map files stay in sync
|
@yuneng-berri thanks for the review, both confirmed and fixed in a34bce1 On the output limit: you're right. OpenAI documents gpt-realtime-2, gpt-realtime-2.1, and gpt-realtime-2.1-mini at a 128k context window and 32000 max output tokens (the mini included), so max_output_tokens and max_tokens on all three azure entries now move from 4096 to 32000, matching the openai gpt-realtime-2.1 entry already in the map. My earlier 4096 came from an automated review suggestion citing the Foundry catalog's token-limits line, which turned out to be wrong for this generation On the disagreement: I corrected the existing openai/gpt-realtime-2 entry to 128k context, 32000 output, and $24/1M text output so it agrees with azure/gpt-realtime-2 and OpenAI's published rate; it had been stale at 32k context / 4096 output / $16 output Resolved values after the fix (get_model_info against the updated map): A live realtime call to confirm isn't practical to include here, so the above is the resolver reading the corrected entries One thing to flag while we're here: openai/gpt-realtime-2.1-mini (added separately, not in this PR) still carries max_output_tokens 4096, so by the same reasoning it now disagrees with azure/gpt-realtime-2.1-mini at 32000. I left it out to keep this PR scoped to the azure additions plus the gpt-realtime-2 reconciliation you asked for, but I'm happy to correct it here too if you'd prefer them consistent in one go |
yuneng-berri
left a comment
There was a problem hiding this comment.
azure realtime model's max_input_tokens looks wrong. The docs are at 32000
…uest limits Second round of maintainer review on BerriAI#31565. Azure's Foundry model table documents the gpt-realtime-2 / -2.1 / -2.1-mini realtime models with max request tokens of 32000 input and 4096 output (distinct from the 128k context window), and every azure realtime sibling already in the map (azure/gpt-realtime-2025-08-28, azure/gpt-realtime-mini-2025-10-06, azure/gpt-realtime-1.5-*) uses 32000/4096. So the three azure entries move to max_input_tokens 32000 and max_output_tokens/max_tokens 4096. The openai entries keep 128k context / 32000 output per OpenAI's own docs; Azure and OpenAI publish different limits for these models. Pricing is unchanged
|
@yuneng-berri good catch, fixed in a0aeadc You're right. Azure's Foundry model table lists gpt-realtime-2, -2.1, and -2.1-mini with a 128k context window but max request limits of 32000 input and 4096 output, and every azure realtime sibling already in the map (azure/gpt-realtime-2025-08-28, azure/gpt-realtime-mini-2025-10-06, azure/gpt-realtime-1.5-*) uses 32000 / 4096. So the three azure entries now use max_input_tokens 32000 and max_output_tokens / max_tokens 4096 That also means my earlier bump of the azure output to 32000 was off: I applied OpenAI's 32000 output figure to the azure entries, but Azure's Realtime API caps a single response at 4096. The openai entries keep 128k context / 32000 output per OpenAI's own docs, so azure and openai legitimately differ on these limits. Pricing is unchanged Resolved values after the fix (get_model_info against the updated map): |
The six azure/gpt-realtime keys our realtime groups resolve to carried the image input rate as input_cost_per_image. Nothing reads that field for token usage: the calculator reads input_cost_per_image_token, so image tokens fell through to input_cost_per_token and billed at the text rate. Azure realtime does accept image input, verified on a live session that reported 155 text and 194 image input tokens, and it billed $0.00020940 where the metered rates give $0.00024820. The values were already correct; only the field name was wrong. Rates confirmed against Azure's own retail meters for the Global tier rather than OpenAI's price card, since Azure prices its OpenAI models independently: image input 5.00 per 1M tokens on the full models and 0.80 on the minis, with the Data Zone meters at exactly 1.1x Global. Matches upstream 63c1053 (PR BerriAI#31565).
a0aeadc to
63c1053
Compare
…image input per token Adds azure/gpt-realtime-2, azure/gpt-realtime-2.1 and azure/gpt-realtime-2.1-mini, which had no cost map entry, reconciles the openai-direct gpt-realtime-2 entry, and corrects the field the realtime family uses for image input. Image input on these models is billed per token, and the existing entries carry that rate as input_cost_per_image. Nothing reads that field for token usage: the calculator reads input_cost_per_image_token, so image tokens fell through to input_cost_per_token and billed at the text rate. Measured on a live session that reported 155 text and 194 image input tokens, this billed $0.00020940 where the metered rates give $0.00024820. The values were already right; only the field name was wrong, so this renames it on the three existing azure/gpt-realtime keys and uses it on the three new ones. Every rate is taken from Azure's own retail meters rather than from OpenAI's price card, since Azure prices its OpenAI models independently. For the Global tier, per 1M tokens: gpt-realtime-2 text 4.00 in / 24.00 out, image 5.00 in, text cached 0.40 gpt-realtime-2.1 same, plus audio 32.00 in / 64.00 out, audio cached 0.40 gpt-realtime-2.1-mini text 0.60 in / 2.40 out, image 0.80 in, audio 10.00 / 20.00 The Data Zone meters come out at exactly 1.1x Global across every dimension, which is the expected relationship and a good signal the rows are live rather than stale. These agree with OpenAI's published realtime rates, but the meters are the authority for an azure/ key. The azure entries keep Azure's 32000 input / 4096 output request limits while the openai-direct entries keep 128000 / 32000, per the review earlier in this PR: Azure's Realtime API caps a single response at 4096 even though the context window is 128k, so the two providers legitimately differ here. Rebuilt on litellm_internal_staging: this branch previously targeted litellm_oss_daily_2026_07_10, and no daily branch has been cut since 2026_07_20. Rebuilding also picks up mode: realtime, which staging had already corrected on the sibling entries. The gpt-realtime-2 reconciliation asked for in review is carried forward, since staging still has it at 32000/4096 and 16.00 output.
63c1053 to
06348cc
Compare
|
Superseded by rolling registry audit #37902, which reverified and absorbed the provider-documented metadata changes at field level |
|
@mateo-berri Could a maintainer reopen this? #37902 closed unmerged, so nothing was absorbed, and utils.py:672 still falls back to the text rate |
|
Reopened Sorry about closing this. Since staging already has the |
|
Superseded by the rolling registry PR #39388, which already carries these Azure realtime entries and the image token pricing fields |
|
Closing as superseded: every field this PR adds or changes landed with the same values in #39388, plus sources and retirement dates. |
TLDR
Problem this solves:
gpt-realtime-2entry is staleHow it solves it:
azure/gpt-realtime-2,-2.1and-2.1-minigpt-realtime-2to its published limits and rateUser Flow
Before: a developer sending a photo into a realtime session is charged the text rate for it, so their spend understates what the vendor charges
wss://litellm-domain/v1/realtime?model=gpt-realtime-2.1-miniconversation.item.createcarrying aninput_imagecontent part and ask about itinput_token_detailswithimage_tokens: 194https://litellm-domain/ui/?page=logsand the request's input cost is $0.00020940, which is those 194 tokens charged at the $0.60/1M text rateazure/gpt-realtime-2,-2.1or-2.1-minigets no spend row at all, because the model resolves to no entryAfter: image tokens are charged at the image rate, and the three new models are priced
wss://litellm-domain/v1/realtime?model=gpt-realtime-2.1-miniconversation.item.createcarrying aninput_imagecontent part and ask about itinput_token_detailswithimage_tokens: 194azure/gpt-realtime-2,-2.1and-2.1-miniresolve and billRelevant issues
Linear ticket
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
@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
The image rate was on a field nothing reads. These entries carry image input cost as
input_cost_per_image, which is the per-image field used by generation models. The token calculator readsinput_cost_per_image_token, so image tokens fell through toinput_cost_per_tokenand were charged the text rate. Same usage, same entry, only the field name changed:Confirmed on a real realtime session against a live gateway. Azure does accept image input on this API, and the session reported the split itself:
Reading the resulting spend row back, the input cost reconciles to the reported split exactly, at the rate each modality should pay:
The image row is the one that moves: before this change it billed $0.00020940 for the same tokens. Text and audio are unchanged, so nothing that was already correct shifted.
This adds up faster than a single photo suggests. A realtime session has no video content type, so a camera feed is sent as a sequence of image parts: four consecutive frames reported 776 image tokens, 194 apiece. At the text rate that stream is billed at roughly three quarters of what it should be, and it scales with frame rate.
Rates come from Azure's meters, not OpenAI's price card. Azure prices its OpenAI models independently, so the values were checked against the retail prices API for the Global tier, per 1M tokens:
The Data Zone meters are exactly 1.1x Global on every dimension, which is the expected relationship and a signal the rows are live rather than stale. These agree with OpenAI's published realtime rates, but the meters are what an
azure/key should follow.Resolution check on the updated map:
Type
🐛 Bug Fix
Changes
Adds
azure/gpt-realtime-2,azure/gpt-realtime-2.1andazure/gpt-realtime-2.1-minito both cost map files.Renames
input_cost_per_imagetoinput_cost_per_image_tokenon the sixazure/gpt-realtimeentries, so image tokens are priced at the image rate instead of falling back to text. The values were already correct.Carries forward the
gpt-realtime-2reconciliation from review: 32k context / 4096 output / $16 output to 128k / 32000 / $24, agreeing with the azure entry and both vendors' published rate.The azure entries use Azure's 32000 input / 4096 output request limits while the openai-direct entries keep 128000 / 32000. Azure's Realtime API caps a single response at 4096 even though the context window is 128k, so the two providers legitimately differ; this is the correction made earlier in this PR's review and it supersedes the 128k/32000 figures an earlier revision of this description quoted for the azure entries.
Rebuilt on
litellm_internal_staging. This branch previously targetedlitellm_oss_daily_2026_07_10and no daily branch has been cut since2026_07_20. Rebuilding also picks upmode: realtime, which staging had since corrected on the sibling entries.No new test, per the cost-map convention; the existing cost suite is the verification.
Caveats (if any)
openai/gpt-realtime-2.1-ministill carries max_output_tokens 4096gpt-realtime*entries keep the inert per-image fieldFinal Attestation