diff --git a/cookbook/livekit_agent_sdk/main.py b/cookbook/livekit_agent_sdk/main.py index 45c733b21d5..0e2d7ebdfaf 100644 --- a/cookbook/livekit_agent_sdk/main.py +++ b/cookbook/livekit_agent_sdk/main.py @@ -32,7 +32,7 @@ async def run_voice_agent(): print(f" Proxy: {PROXY_URL}") print() - async with websockets.connect(url, extra_headers=headers) as ws: + async with websockets.connect(url, additional_headers=headers) as ws: # Receive initial connection event initial = json.loads(await ws.recv()) print(f"✅ Connected! Event: {initial['type']}\n") diff --git a/docs/my-website/docs/tutorials/livekit_xai_realtime.md b/docs/my-website/docs/tutorials/livekit_xai_realtime.md index 6d644f73691..cdd21b2fdb3 100644 --- a/docs/my-website/docs/tutorials/livekit_xai_realtime.md +++ b/docs/my-website/docs/tutorials/livekit_xai_realtime.md @@ -178,12 +178,28 @@ Because they make up everything! ``` -## Complete Working Example (Cookbook) +## Complete Working Example -See the full working example in our [LiveKit Agent SDK Cookbook](https://github.com/BerriAI/litellm/tree/main/cookbook/livekit_agent_sdk). +**[LiveKit Agent SDK Cookbook](https://github.com/BerriAI/litellm/tree/main/cookbook/livekit_agent_sdk)** + +Includes: +- ✅ Simple voice agent (`main.py`) +- ✅ Config example (`config.example.yaml`) +- ✅ How to run guide (`HOW_TO_RUN.md`) + +### Quick Test + +```bash +# 1. Start proxy +poetry run litellm --config cookbook/livekit_agent_sdk/config.example.yaml --port 4000 + +# 2. Run agent (in new terminal) +cd cookbook/livekit_agent_sdk +poetry run python main.py +``` ## Learn More -- [xAI Realtime API Documentation](/docs/providers/xai_realtime) -- [LiveKit xAI Plugin Docs](https://docs.livekit.io/agents/models/realtime/plugins/xai/) +- [xAI Realtime API](/docs/providers/xai_realtime) +- [LiveKit xAI Plugin](https://docs.livekit.io/agents/models/realtime/plugins/xai/) - [LiteLLM Realtime API](/docs/realtime) diff --git a/litellm/llms/openai/realtime/handler.py b/litellm/llms/openai/realtime/handler.py index a6340ec571d..ef9cc43c3e1 100644 --- a/litellm/llms/openai/realtime/handler.py +++ b/litellm/llms/openai/realtime/handler.py @@ -131,7 +131,7 @@ class OpenAIRealtime(OpenAIChatCompletion): ) async with websockets.connect( # type: ignore url, - extra_headers=headers, # type: ignore + additional_headers=headers, # type: ignore max_size=REALTIME_WEBSOCKET_MAX_MESSAGE_SIZE_BYTES, ssl=ssl_config, ) as backend_ws: