forked from phoenix/litellm-mirror
fix(user_api_key_auth.py): add auth check for websocket endpoint
Fixes https://github.com/BerriAI/litellm/issues/6926
This commit is contained in:
parent
037171b98b
commit
9ec6ebaeeb
3 changed files with 58 additions and 3 deletions
|
@ -134,7 +134,10 @@ from litellm.proxy.auth.model_checks import (
|
|||
get_key_models,
|
||||
get_team_models,
|
||||
)
|
||||
from litellm.proxy.auth.user_api_key_auth import user_api_key_auth
|
||||
from litellm.proxy.auth.user_api_key_auth import (
|
||||
user_api_key_auth,
|
||||
user_api_key_auth_websocket,
|
||||
)
|
||||
|
||||
## Import All Misc routes here ##
|
||||
from litellm.proxy.caching_routes import router as caching_router
|
||||
|
@ -4394,7 +4397,11 @@ from litellm import _arealtime
|
|||
|
||||
|
||||
@app.websocket("/v1/realtime")
|
||||
async def websocket_endpoint(websocket: WebSocket, model: str):
|
||||
async def websocket_endpoint(
|
||||
websocket: WebSocket,
|
||||
model: str,
|
||||
user_api_key_dict=Depends(user_api_key_auth_websocket),
|
||||
):
|
||||
import websockets
|
||||
|
||||
await websocket.accept()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue