Skip to content

fix(realtime): add /openai/v1/realtime to routes for logging - #27323

Merged
yuneng-berri merged 1 commit into
litellm_internal_stagingfrom
litellm_realtimePrometheusMetrics
May 9, 2026
Merged

fix(realtime): add /openai/v1/realtime to routes for logging#27323
yuneng-berri merged 1 commit into
litellm_internal_stagingfrom
litellm_realtimePrometheusMetrics

Conversation

@Michael-RZ-Berri

@Michael-RZ-Berri Michael-RZ-Berri commented May 6, 2026

Copy link
Copy Markdown
Contributor

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

  • I have Added testing in the tests/test_litellm/ directory, Adding at least 1 test is a hard requirement - see details
  • My PR passes all unit tests on make test-unit
  • My PR's scope is as isolated as possible, it only solves 1 specific problem
  • I have requested a Greptile review by commenting @greptileai and received a Confidence Score of at least 4/5 before requesting a maintainer review

Screenshots / Proof of Fix

Route change:
Screenshot 2026-05-06 at 12 01 50 PM

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/realtime alias for the realtime WebSocket endpoint, alongside existing /realtime and /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 as CallTypes.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.

@CLAassistant

CLAassistant commented May 6, 2026

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.


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-apps

greptile-apps Bot commented May 6, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR adds /openai/v1/realtime as a third WebSocket alias for the realtime endpoint, ensuring Prometheus and other observability tools correctly attribute traffic that arrives via this path. The change is additive across all three touch-points: the FastAPI decorator, the LiteLLMRoutes.openai_routes allowlist, and API_ROUTE_TO_CALL_TYPES.

  • proxy_server.py: stacks @app.websocket(\"/openai/v1/realtime\") above the existing two decorators so WebSocket upgrades on this path reach realtime_websocket_endpoint.
  • _types.py: adds the plain and ?{model} variants of the new path to LiteLLMRoutes.openai_routes, consistent with the existing /realtime and /v1/realtime entries.
  • types/utils.py: maps /openai/v1/realtime[CallTypes.arealtime] in API_ROUTE_TO_CALL_TYPES so call-type-aware features resolve correctly. A new unit test asserts all three aliases are registered in all three locations.

Confidence Score: 5/5

Strictly 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.

Important Files Changed

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

Comment thread litellm/proxy/proxy_server.py

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

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/realtime and its model-query variant to LiteLLMRoutes.openai_routes so auth treats the websocket route as an OpenAI LLM API route.
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.

Comment thread litellm/proxy/proxy_server.py
@Michael-RZ-Berri
Michael-RZ-Berri force-pushed the litellm_realtimePrometheusMetrics branch from 8cc35ad to 82b3245 Compare May 6, 2026 20:04
@codecov

codecov Bot commented May 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@Michael-RZ-Berri
Michael-RZ-Berri force-pushed the litellm_realtimePrometheusMetrics branch from 82b3245 to 5d7b7e7 Compare May 6, 2026 20:14
@Michael-RZ-Berri

Copy link
Copy Markdown
Contributor Author

@greptile-ai

@yuneng-berri
yuneng-berri merged commit f69521a into litellm_internal_staging May 9, 2026
117 checks passed
@yuneng-berri
yuneng-berri deleted the litellm_realtimePrometheusMetrics branch May 9, 2026 17:11
VANDRANKI added a commit to VANDRANKI/litellm that referenced this pull request Jun 8, 2026
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.
fzowl pushed a commit to fzowl/litellm that referenced this pull request Jun 24, 2026
…eusMetrics

fix(realtime): add /openai/v1/realtime to routes for logging
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants