fix(pricing): mark realtime-only gpt-realtime models as mode realtime - #33728
Conversation
The gpt-realtime family (OpenAI and Azure) only serves /v1/realtime and is rejected by /v1/chat/completions with "This is not a chat model", but the cost map tagged them mode=chat. Retag them mode=realtime (a value already used by gemini-live and handled by the health-check realtime handler) and add realtime to the ModelInfoBase mode literal. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
|
|
Greptile SummaryThis PR corrects the
Confidence Score: 5/5Safe to merge — targeted metadata correction with no logic changes and a solid set of local-only tests guarding against regression. The fix is narrow (12 JSON fields and one type annotation), directly supported by live OpenAI evidence in the PR description, and backed by tests that check the JSON contents, the type hint, the get_model_info API, and backup/main file parity. The existing get_mode_handlers in health_check_helpers already handles realtime as a key, so no handler gap is introduced. No files require special attention.
|
| Filename | Overview |
|---|---|
| model_prices_and_context_window.json | 12 gpt-realtime-* model entries corrected from mode="chat" to mode="realtime", consistent with their supported_endpoints=["/v1/realtime"] metadata |
| litellm/model_prices_and_context_window_backup.json | Same 12 model entries updated to mode="realtime" as in the main JSON; the new test verifies both files stay in sync |
| litellm/types/utils.py | Adds "realtime" to the mode Literal in ModelInfoBase; this value was already present in the data (Gemini native-audio entries) but was missing from the type annotation |
| tests/test_litellm/test_gpt_realtime_mode.py | New test file validating mode="realtime" for all 12 affected models; reads only from local JSON files and type hints — no real network calls |
Reviews (1): Last reviewed commit: "fix(pricing): mark realtime-only gpt-rea..." | Re-trigger Greptile
The gpt-4o(-mini)-realtime-preview family (OpenAI and Azure, all regions) is realtime-only but was tagged mode=chat and carries no supported_endpoints field. Retag them mode=realtime alongside the gpt-realtime family. Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
00e0dd1
into
litellm_internal_staging
#33806) test_get_model_info_reports_realtime_mode resolved gpt-realtime-mini through litellm.get_model_info, which reads the cost map litellm fetches at import from raw.githubusercontent.com/BerriAI/litellm/main. The mode=realtime retag from #33728 is in this repo's json and its bundled backup but has not reached main yet, so the test failed whenever the fetch succeeded and passed whenever the runner was rate limited and litellm fell back to the backup, flapping the Unit Tests: MCP, Secrets, Containers & Misc job on unrelated PRs Resolve the lookup against the bundled backup instead, the way tests/test_litellm/test_cost_calculator.py already does: force LITELLM_LOCAL_MODEL_COST_MAP, rebind litellm.model_cost, and clear the get_model_info lru cache before asserting so a remote-backed entry cached earlier in the same worker cannot leak through, then clear it again afterwards so no locally-backed entry outlives the test
Relevant issues
Surfaced while reviewing #33291 (which adds undated azure
gpt-audio-mini/gpt-realtime-minipricing aliases); this corrects a related metadata bug in the same model familyLinear 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)Screenshots / Proof of Fix
Realtime health checks have been supported for a while (see the "Realtime Models" section of the health docs), but every OpenAI and Azure realtime model in the cost map was tagged
mode: "chat", somodenever resolved torealtimeautomatically; only the twogemini-liveentries carriedmode: "realtime". The user-visible effect is health checks: withmode=chat,ahealth_checkdispatcheslitellm.acompletionand the provider rejects it; withmode=realtimeit uses the realtime handler and opens a nativewss://Live against real OpenAI (
OPENAI_API_KEY), captured at commitab5dd03125:Both call
litellm.ahealth_checkwith a real key; BEFORE forcesmode="chat"(the old tagging) and AFTER reads the correctedmodefrom the cost mapIndependent confirmation the family is realtime-only, straight from OpenAI at the chat endpoint:
gpt-audio-miniby contrast does serve/v1/chat/completions(it just requires an audio modality), so it correctly staysmode=chatand is untouched hereType
🐛 Bug Fix
Changes
Retag every OpenAI and Azure realtime-only model from
mode: "chat"tomode: "realtime", a value already used bygemini/gemini-live-2.5-flash-preview-native-audio-09-2025and already handled by the health-check realtime handler inhealth_check_helpers.get_mode_handlers. Two groups are covered:gpt-realtime*family whosesupported_endpointsis exactly["/v1/realtime"]:gpt-realtime,gpt-realtime-1.5,gpt-realtime-2,gpt-realtime-2.1,gpt-realtime-2.1-mini,gpt-realtime-mini,gpt-realtime-2025-08-28,gpt-realtime-mini-2025-10-06,gpt-realtime-mini-2025-12-15,azure/gpt-realtime-2025-08-28,azure/gpt-realtime-1.5-2026-02-23,azure/gpt-realtime-mini-2025-10-06gpt-4o(-mini)-realtime-previewfamily (OpenAI and Azure, includingeu/usregional variants), which predates thesupported_endpointsfield and carries none but is equally realtime-onlyThe
*-whispertranscription entries keepaudio_transcriptionand the audio (non-realtime) models keepchat. Changes are applied to both the root map and the packaged backupAdd
"realtime"to themodeliteral inModelInfoBase(litellm/types/utils.py); it was a de-facto value already present in the data but missing from the typeScope note: the Gemini native-audio realtime-only entries are also tagged
chat, but they route through a different surface and are left out of this changeFinal Attestation
Link to Devin session: https://app.devin.ai/sessions/5b349e60806c4a7e8acc5edf6b93da72
Requested by: @krrish-berri-2