fix(model_prices): add gpt-realtime-2.1 models with regional processing uplift - #32387
Conversation
Greptile SummaryThis PR fixes zero-cost tracking for
Confidence Score: 5/5Safe to merge — the change is purely additive data entries in the cost map; no existing model entries are modified and no production logic is touched. All numeric values are consistent with the PR description and align with the existing gpt-realtime-2 / gpt-realtime-mini structure. The previously flagged missing cache_read_input_audio_token_cost field is now present on gpt-realtime-2.1. Both JSON files are in sync. The test uses a local cost-map fixture with no network calls. No files require special attention.
|
| Filename | Overview |
|---|---|
| model_prices_and_context_window.json | Adds gpt-realtime-2.1 and gpt-realtime-2.1-mini entries with correct pricing, audio/text cache costs, regional uplift multipliers (1.1), and supported-endpoints metadata — consistent with the existing gpt-realtime-2 / gpt-realtime-mini pattern; previously flagged cache_read_input_audio_token_cost gap is now present. |
| litellm/model_prices_and_context_window_backup.json | Backup JSON updated identically to the primary — all pricing fields, cache costs, and regional uplift multipliers match the primary file; no drift between the two files. |
| tests/test_litellm/litellm_core_utils/llm_cost_calc/test_llm_cost_calc_utils.py | Existing test_data_residency_applies_uplift parametrized to cover gpt-realtime-2.1 and gpt-realtime-2.1-mini; uses the _local_model_cost_map fixture (no network calls), correctly asserts 1.10x uplift on both prompt and completion sides. |
Reviews (2): Last reviewed commit: "fix(model_prices): add cache_read_input_..." | Re-trigger Greptile
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Merging this PR will degrade performance by 14.81%
Warning Please fix the performance issues or acknowledge them on CodSpeed. Performance Changes
Tip Investigate this regression by commenting Comparing |
bd6cabe
into
litellm_internal_staging
Relevant issues
Linear ticket
Resolves LIT-3912
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
@greptileaito re-request a review after pushing changes)Screenshots / Proof of Fix
Verified on a live local proxy hitting the real OpenAI realtime API over a WebSocket, one worktree per branch, each in its own fresh venv. Both runs used
LITELLM_LOCAL_MODEL_COST_MAP=Trueso the proxy reads the in-repo cost map instead of the copy on main, an identical config withgpt-realtime-2.1/gpt-realtime-2.1-minipointed atopenai/..., and the exact same text-only realtime request ("Reply with exactly one word: ok"). The only variable between the two runs is the branch. The realtime client is a shortwebsocketsscript that opensws://localhost:PORT/v1/realtime?model=gpt-realtime-2.1withAuthorization: Bearer sk-1234, sends asession.update(text modality), aconversation.item.create, and aresponse.create, then prints theresponse.doneevent and its usageBoth runs produced the identical real response and usage (129 text input tokens, 16 text output tokens with 11 reasoning tokens). The difference is purely in cost tracking
Before (branch
litellm_internal_staging)/v1/model/infohas no prices and no uplift fields for either modelThe same real realtime call still returns a valid answer from OpenAI
but the proxy cannot cost it: the model is unmapped, so both token costs default to 0 and the response cost is 0.0
After (branch
litellm_lit3912_gpt_realtime_21_regional_uplift)/v1/model/infonow returns the token prices and both uplift multipliers set to 1.1The same real realtime call returns the same answer and usage
and this time the proxy computes a real nonzero cost with no "Defaulting to 0"
That 0.001164 is exactly what the new prices give: 129 text input tokens at $4 / 1M is 0.000516, and 16 output text tokens plus 11 reasoning tokens at $24 / 1M is 0.000648, summing to 0.001164
Regional processing uplift
The available OpenAI key is a global-project key, so a real call to a data-residency host is rejected by OpenAI itself rather than by LiteLLM
As far as real keys allow, the uplift is proven two ways on this branch. First,
/v1/model/infoabove exposesregional_processing_uplift_multiplier_euandregional_processing_uplift_multiplier_usequal to 1.1 on both models. Second, running the same cost path the realtime handler uses, against the real in-repo cost map, applies exactly 1.1x whendata_residencyiseuorusWhen the api_base is a regional host (
eu.api.openai.comorus.api.openai.com),infer_openai_data_residencysetsdata_residencyaccordingly and the same 1.1x lands on the live realtime costType
🐛 Bug Fix
Changes
gpt-realtime-2.1andgpt-realtime-2.1-miniwere missing entirely from the cost map, so usage on them resolved to zero cost and never picked up the 10% regional processing uplift that OpenAI charges on data-residency endpointsThis adds both models to
model_prices_and_context_window.jsonand the identicallitellm/model_prices_and_context_window_backup.json, mirroring the field structure of the existinggpt-realtime-2/gpt-realtime-minientries with prices taken from OpenAI's pricing page.gpt-realtime-2.1is text input $4, cached text $0.40, text output $24, audio input $32, cached audio $0.40, audio output $64, image input $5.gpt-realtime-2.1-miniis text input $0.60, cached text $0.06, text output $2.40, audio input $10, cached audio $0.30, audio output $20, image input $0.80, all per 1M tokensBoth models are on OpenAI's list of models eligible for the regional processing (data residency) uplift for releases on or after 2026-03-05, so each entry carries
regional_processing_uplift_multiplier_euandregional_processing_uplift_multiplier_usset to 1.1, matching the convention already used for the gpt-5.4/5.5 series. The uplift is applied by_get_regional_uplift_multiplierinlitellm/litellm_core_utils/llm_cost_calc/utils.pywhendata_residencyis inferred from the api_base (eu.api.openai.com->eu,us.api.openai.com->us)The existing
test_data_residency_applies_upliftregression test intests/test_litellm/litellm_core_utils/llm_cost_calc/test_llm_cost_calc_utils.pyis extended to parametrize over the two new models, asserting that cost withdata_residencyset toeuorusis exactly 1.1x the base cost on both the prompt and completion sides. The test fails if either entry or its multiplier fields are removed