fix(proxy): add realtime WebRTC HTTP sub-routes to openai_routes to unblock non-admin keys - #30029
Conversation
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.
Greptile SummaryRegisters the six WebRTC HTTP sub-routes (
Confidence Score: 4/5Safe to merge; the change is a targeted list addition with no logic changes and the routes correctly mirror the endpoint registrations in endpoints.py The fix is minimal and correct — the six strings added match exactly what is registered in realtime_endpoints/endpoints.py, and the auth model for each endpoint is unchanged. The only gap is that no test verifies these routes appear in openai_routes, so a future accidental removal would not be caught automatically. litellm/proxy/_types.py is the only changed file; a corresponding test in tests/test_litellm/proxy/auth/test_route_checks.py would be worth adding
|
| Filename | Overview |
|---|---|
| litellm/proxy/_types.py | Adds 6 missing WebRTC HTTP sub-routes to LiteLLMRoutes.openai_routes, unblocking non-admin virtual keys from accessing /realtime/client_secrets and /realtime/calls |
Reviews (1): Last reviewed commit: "fix(proxy): add realtime WebRTC HTTP sub..." | Re-trigger Greptile
| # realtime WebRTC HTTP sub-routes (client_secrets, calls) - fixes #29923 | ||
| "/realtime/client_secrets", | ||
| "/v1/realtime/client_secrets", | ||
| "/openai/v1/realtime/client_secrets", | ||
| "/realtime/calls", | ||
| "/v1/realtime/calls", | ||
| "/openai/v1/realtime/calls", |
There was a problem hiding this comment.
No test coverage for route registration fix
The PR adds these routes to fix a 401 regression, but there are no tests asserting that is_llm_api_route() (or equivalently, that these paths appear in LiteLLMRoutes.openai_routes) returns True for the new paths. tests/test_litellm/proxy/auth/test_route_checks.py exists and would be the natural home for parameterized assertions like assert RouteChecks.is_llm_api_route("/v1/realtime/client_secrets") is True. Without such a test the regression can silently revert if a future refactor inadvertently removes these entries.
Rule Used: What: Ensure that any PR claiming to fix an issue ... (source)
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
@VANDRANKI — could you add a screenshot or short video showing that this change works as expected (e.g. a non-admin key successfully hitting |
Description
Fixes #29923
The realtime WebRTC HTTP routes
/realtime/client_secretsand/realtime/calls(and their/v1/and/openai/v1/prefixed variants) are registered inrealtime_endpoints/endpoints.pybut were absent fromLiteLLMRoutes.openai_routesin_types.py.As a result,
is_llm_api_route()returnedFalsefor 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
LiteLLMRoutes.openai_routes, mirroring how the WebSocket/realtimepaths were added via PR #27323:File changed
litellm/proxy/_types.py— 6 routes added toLiteLLMRoutes.openai_routesType of change
Checklist
/,/v1/,/openai/v1/)realtime_endpoints/endpoints.py