big-controller-60015
09/20/2025, 1:34 PMtall-airline-16756
09/20/2025, 1:34 PMtall-airline-16756
09/20/2025, 1:35 PMfrom livekit import api, rtc
API_KEY = "your-livekit-api-key"
API_SECRET = "your-livekit-api-secret"
ROOM_NAME = "your-room-name"
PARTICIPANT_IDENTITY = "your-identity"
token = (
api.AccessToken(API_KEY, API_SECRET)
.with_identity(PARTICIPANT_IDENTITY)
.with_grants(api.VideoGrants(room_join=True, room=ROOM_NAME))
.to_jwt()
)
2. Connect to the Room:
room = rtc.Room()
await room.connect("<wss://your-livekit-instance.livekit.cloud>", token)
Just a friendly reminder to replace those placeholders with your actual API key, secret, room name, and participant identity to make sure everything works smoothly.
Security Note: It's super important to never expose your API secret in frontend or client-side code. Always generate tokens securely on your backend or through a serverless function to keep everything safe.
Sources: examples/agent_dispatch.py | Authentication | LiveKit Docs | .env.example | terminal-client/client.py | Generating tokens | LiveKit Docs