fix(realtime): add /openai/v1/realtime to routes for logging - #27323
Conversation
|
Michael Riad Zaky seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
Greptile SummaryThis PR adds
Confidence Score: 5/5Strictly additive routing change with no modifications to existing logic; safe to merge. All three required registration sites (WebSocket decorator, route allowlist, call-type map) are updated in tandem, and the new unit test guards against any of them going missing in future refactors. No existing tests are modified, no auth logic is touched, and the change cannot affect clients that do not use the new path alias. No files require special attention.
|
| Filename | Overview |
|---|---|
| litellm/proxy/proxy_server.py | Adds @app.websocket("/openai/v1/realtime") decorator stacked on the existing two realtime decorators — strictly additive, no logic changes. |
| litellm/proxy/_types.py | Adds /openai/v1/realtime and /openai/v1/realtime?{model} to LiteLLMRoutes.openai_routes, consistent with existing /realtime and /v1/realtime entries. |
| litellm/types/utils.py | Adds /openai/v1/realtime → [CallTypes.arealtime] to API_ROUTE_TO_CALL_TYPES, matching the existing entries for the other two aliases. |
| tests/test_litellm/proxy/test_proxy_server.py | New test test_realtime_websocket_route_aliases_registered verifies all three realtime aliases appear in WebSocket routes, openai_routes, and API_ROUTE_TO_CALL_TYPES without making real network calls. |
Reviews (2): Last reviewed commit: "fix(realtime): register /openai/v1/realt..." | Re-trigger Greptile
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: New route missing from auth allowlist causes 403
- Added
/openai/v1/realtimeand its model-query variant toLiteLLMRoutes.openai_routesso auth treats the websocket route as an OpenAI LLM API route.
- Added
Preview (8cc35add42)
diff --git a/litellm/proxy/_types.py b/litellm/proxy/_types.py
--- a/litellm/proxy/_types.py
+++ b/litellm/proxy/_types.py
@@ -353,8 +353,10 @@
# realtime
"/realtime",
"/v1/realtime",
+ "/openai/v1/realtime",
"/realtime?{model}",
"/v1/realtime?{model}",
+ "/openai/v1/realtime?{model}",
# responses API
"/responses",
"/v1/responses",
diff --git a/litellm/proxy/proxy_server.py b/litellm/proxy/proxy_server.py
--- a/litellm/proxy/proxy_server.py
+++ b/litellm/proxy/proxy_server.py
@@ -8805,6 +8805,7 @@
return tuple(params)
+@app.websocket("/openai/v1/realtime")
@app.websocket("/v1/realtime")
@app.websocket("/realtime")
async def realtime_websocket_endpoint(You can send follow-ups to the cloud agent here.
Reviewed by Cursor Bugbot for commit 94a0ec82be7f82956e21620dda57bae3a4c6aa88. Configure here.
8cc35ad to
82b3245
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
82b3245 to
5d7b7e7
Compare
|
@greptile-ai |
Fixes BerriAI#29923 The realtime WebRTC HTTP routes /realtime/client_secrets and /realtime/calls (and their /v1/ and /openai/v1/ prefixed variants) were registered in realtime_endpoints/endpoints.py but absent from LiteLLMRoutes.openai_routes in _types.py. As a result, is_llm_api_route() returned False for these paths, and any non-admin virtual key (e.g. role=internal_user_viewer) was blocked with 401 instead of being treated as a standard LLM API call. Fix: add the six missing paths to openai_routes, mirroring how the WSS /realtime paths were added via PR BerriAI#27323.
…eusMetrics fix(realtime): add /openai/v1/realtime to routes for logging

Relevant issues
/openai/v1/realtime is not present in the proxy file like the other routes, leading to observability tools like Prometheus not giving observability about that route when it's used. This PR adds that route with a decorator like the other paths.
Linear ticket
Resolves LIT-2225.
Pre-Submission checklist
Please complete all items before asking a LiteLLM maintainer to review your PR
tests/test_litellm/directory, Adding at least 1 test is a hard requirement - see detailsmake test-unit@greptileaiand received a Confidence Score of at least 4/5 before requesting a maintainer reviewScreenshots / Proof of Fix
Route change:

Type
🐛 Bug Fix
Changes
proxy_server
Note
Low Risk
Low risk, additive routing change that should only affect clients using the new alias; primary risk is misrouting/authorization mismatches if route mappings diverge.
Overview
Adds the
/openai/v1/realtimealias for the realtime WebSocket endpoint, alongside existing/realtimeand/v1/realtime, so upgrades don’t fall through to the HTTP-only passthrough and observability/auth logic can recognize the route.Updates route allowlists (
LiteLLMRoutes.openai_routes) and call-type mapping (API_ROUTE_TO_CALL_TYPES) to treat the new alias asCallTypes.arealtime, and adds a unit test asserting all three aliases are registered consistently.Reviewed by Cursor Bugbot for commit 5d7b7e7. Bugbot is set up for automated code reviews on this repo. Configure here.