steps to setup and run livekit server
# ask-ai
c
steps to setup and run livekit server
t
Thanks for reaching out, raj. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Here’s a friendly guide to help you set up and run your LiveKit server: 1. Prerequisites • Make sure you have Go 1.23+ installed if you’re building from source. • LiveKit works right out of the box in development mode, or you can customize it for production. 2. Running in Development Mode 1. Kick off the LiveKit server in development mode by running: `livekit-server --dev`This uses a placeholder API key and secret to get you started quickly: ◦ API Key:
devkey
◦ API Secret:
secret
1. By default, the signal server listens on
127.0.0.1:7880
. If you want to access it from other devices on your network, just run:
livekit-server --dev --bind 0.0.0.0
3. Production Setup 1. Generate API Key and Secret: For production, you’ll want to create your own API key and secret. You can easily generate these with the CLI:
livekit-server generate-keys
2. Custom Configuration: Set up a configuration file (like
config.yaml
) to define your production settings. Here’s an example:
Copy code
port: 7880
bind_addresses:
    - "0.0.0.0"
rtc:
    udp_port: 7882
    tcp_port: 7881
3. Start the Server with Configuration:
livekit-server --config config.yaml
4. Ports • TCP/7880 for signaling • TCP/7881 for RTCP • UDP/7882 for WebRTC traffic 5. Verification • Double-check that your server is up and running by looking at the logs. You should see:
starting LiveKit server
Notes • Keep in mind, development mode (
--dev
) isn’t secure and isn’t meant for production. • For production, make sure to set up SSL/TLS properly and configure your firewall. • The server supports both TCP and UDP for WebRTC traffic, but UDP usually gives you better performance. If you want to dive deeper or explore more advanced setups, check out the official LiveKit deployment documentation. We’re here to help you every step of the way! Sources: Running LiveKit locally | LiveKit Docs | pkg/service/server.go | Running LiveKit on AWS
c
I just downloaded the zip file from source. what to do next. I have livekitserver.exe file with me
t
Hey there! To get your LiveKit server up and running with the
livekitserver.exe
file, just follow these simple steps: 1. First, unzip the downloaded ZIP file to a folder on your computer. 2. Next, open Command Prompt or PowerShell and head over to the folder where you put the
livekitserver.exe
file. 3. Now, start the server in development mode by running: `. livekitserver.exe --dev`This kicks things off with a default API key and secret (`devkey`:
secret
), so you’re good to go. 4. If you want the server to be reachable from other devices on your network, just run:
Copy code
.
livekitserver.exe --bind 0.0.0.0 --dev
5. Finally, check the logs to make sure everything’s running smoothly. You should see messages confirming the server is active and listening on ports (default is
7880
for HTTP and
7882
for UDP). If you hit any bumps or want help tweaking the setup, just give me a shout—I’m here to help!
c
how to work with this I have started the server: (base) PS C:\Users\Rajendra Prasad K\Desktop\livekit_1.9.0_windows_amd64> .\livekit-server.exe --dev 2025-08-14T204401.825+0530 INFO livekit server/main.go:208 starting in development mode 2025-08-14T204401.827+0530 INFO livekit server/main.go:211 no keys provided, using placeholder keys {"API Key": "devkey", "API Secret": "secret"} 2025-08-14T204401.827+0530 ERROR livekit hwstats/cpu_null.go:38 CPU monitoring unsupported on current platform. Server capacity management will be disabled github.com/livekit/protocol/utils/hwstats.newPlatformCPUMonitor /home/runner/go/pkg/mod/github.com/livekit/protocol@v1.39.1-0.20250604205715-2227c44329ee/utils/hwstats/cpu_null.go:38 github.com/livekit/protocol/utils/hwstats.NewCPUStats /home/runner/go/pkg/mod/github.com/livekit/protocol@v1.39.1-0.20250604205715-2227c44329ee/utils/hwstats/cpu.go:53 github.com/livekit/livekit-server/pkg/telemetry/prometheus.Init /home/runner/go/pkg/mod/github.com/livekit/livekit-server@v1.9.0/pkg/telemetry/prometheus/node.go:122 main.startServer /home/runner/go/pkg/mod/github.com/livekit/livekit-server@v1.9.0/cmd/server/main.go:275 github.com/urfave/cli/v2.(*Command).Run /home/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.27.5/command.go:276 github.com/urfave/cli/v2.(*App).RunContext /home/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.27.5/app.go:333 github.com/urfave/cli/v2.(*App).Run /home/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.27.5/app.go:307 main.main /home/runner/go/pkg/mod/github.com/livekit/livekit-server@v1.9.0/cmd/server/main.go:185 runtime.main /opt/hostedtoolcache/go/1.23.4/x64/src/runtime/proc.go:272 2025-08-14T204401.829+0530 INFO livekit routing/interfaces.go:175 using single-node routing 2025-08-14T204401.931+0530 INFO livekit service/server.go:265 starting LiveKit server {"portHttp": 7880, "nodeID": "ND_gDEJFwJ46FGu", "nodeIP": "169.254.195.85", "version": "1.9.0", "bindAddresses": ["127.0.0.1", "::1"], "rtc.portTCP": 7881, "rtc.portUDP": {"Start":7882,"End":0}} 2025-08-14T204401.931+0530 INFO livekit service/server.go:267 Windows detected, capacity management is unavailable 2025-08-14T204401.931+0530 DEBUG livekit service/signal.go:119 starting relay signal server {"topic": "ND_gDEJFwJ46FGu"} what next
t
Great news—your LiveKit server is up and running! Here’s what you can do next: 1. Generate an Access Token: To connect to your server, you’ll want to create an access token using the LiveKit CLI. Just run this command: `lk token create \ --api-key devkey --api-secret secret \ --join --room my-first-room --identity user1 \ --valid-for 24h`This will give you a JWT token that lets you connect to your LiveKit instance. 2. Test with the Example App: Feel free to try out the LiveKit React Example App. Just pop in the token you generated to connect and test video/audio publishing—it’s a great way to see everything in action. 3. Simulate a Publisher: Want to simulate a publisher in a room? Use the LiveKit CLI with this command: `lk room join \ --url ws://localhost:7880 \ --api-key devkey --api-secret secret \ --identity bot-user1 \ --publish-demo \ my-first-room`This will create a publisher streaming a looped demo video in your chosen room. 4. Development Mode Configuration: When you’re in development mode, the server uses these default credentials:If you’re gearing up for production, you can customize these settings—check out the deployment documentation for all the details. ◦ API Key:
devkey
◦ API Secret:
secret
If you hit any bumps or have questions along the way, just let me know—I’m here to help! Sources: cmd/server/main.go
c
okay I have used the above command to generate a access token, project url and then token grants. now what next
t
Alright, now that you’ve got your access token and token grants, here’s what to do next: 1. Use the Token for Authentication: The access token you generated is a JWT that you’ll send to your client app. Your clients will use this token to connect to the LiveKit room with the permissions you’ve set. 2. Integrate with Client Application: Just pass the token to your app’s frontend. From there, clients can join a room using LiveKit’s client SDKs, like JavaScript, iOS, or Android. 3. Handle Token Expiry: Tokens expire after a certain time. Make sure your app can request a fresh token once the current one runs out—usually by hitting the same endpoint that created the original token. 4. Optional: Test with LiveKit Meet: If you want to test things out, try using LiveKit Meet. Just pop your access token into the field and join the room to see everything in action. If you run into any trouble or want a hand integrating the token or testing, just give me a shout—I’m here to help! Sources: CLI Setup | LiveKit Docs | Transcription Applications | livekit/livekit_composite | DeepWiki | Generating tokens | LiveKit Docs | CLI Setup | LiveKit Docs
c
I just have a backend file with livekit agent and the livekit server running. now what to do to test my agent
t
Here’s a friendly guide to help you test your backend agent with the LiveKit server up and running: 1. Use the Access Token: Share the access token you generated with your backend agent. This token lets your agent authenticate and connect smoothly to the LiveKit server. 2. Connect to a Room: Make sure your agent joins the right room on the LiveKit server—the room name should match what you used when creating the token. 3. Simulate Client Interactions: Try out your agent’s features by simulating client actions like joining the room, publishing audio/video tracks, and subscribing to other participants’ tracks. 4. Monitor Logs: Keep an eye on the server and agent logs to confirm everything’s working as it should and that events are handled properly. 5. Optional: Use LiveKit Meet: If you want to explore further, tools like LiveKit Meet are great for interacting with the room and seeing how your agent behaves. If you get stuck or want a hand with any step, just let me know—I’m here to help!
c
how to connect to that room
t
Connecting to a room in LiveKit is pretty straightforward! Just follow these simple steps: 1. Prepare the WebSocket URL: If you’re working with a self-hosted server, use
<ws://localhost:7880>
while developing. If you’re on LiveKit Cloud, you can find the WebSocket URL in your project settings. 2. Generate an Access Token: Make sure you have a valid access token that includes the room name, participant identity, and permissions. This token is essential for authentication. 3. Use a Client SDK: Pick a client SDK that fits your platform—whether that’s JavaScript, Flutter, Python, Android, or Go. Here’s a quick example for JavaScript:
Copy code
import { Room } from 'livekit-client';

const room = new Room();
await room.connect('<ws://localhost:7880>', 'your-token-here');
console.log('Connected to room:', room.name);
4. Set Up Event Listeners: Before you connect, set up event listeners to keep an eye on room events like participants joining, track subscriptions, or disconnections. 5. Test the Connection: Once you’re connected, double-check everything’s working by interacting with participants, publishing tracks, or trying out tools like LiveKit Meet. If you want a hand with a specific SDK or need more details, just let me know—I’m here to help! Sources: README.md | livekit-rtc/livekit/rtc/room.py | Android quickstart | LiveKit Docs | room.go | example/sample.ts
c
i am using cloud and I have generated the token
t
Since you’re using LiveKit Cloud and already have your token ready, here’s a friendly guide to help you connect to a room: 1. Find your WebSocket URL: You can grab the WebSocket URL for your LiveKit Cloud project from the project settings. It usually looks like
<wss://your-project-id.livekit.cloud>
. 2. Pick a Client SDK: Choose the client SDK that fits your platform. For example, in JavaScript:
Copy code
import { Room } from 'livekit-client';

const room = new Room();
await room.connect('<wss://your-project-id.livekit.cloud>', 'your-token-here');
console.log('Connected to room:', room.name);
3. Set up Event Listeners: Before you connect, it’s a good idea to set up event listeners to keep track of things like participants joining, track subscriptions, and disconnections. 4. Give it a Test: Once you’re connected, try interacting with participants or publishing tracks to make sure everything’s working smoothly. If you want a hand with a specific SDK or need more details, just let me know—I’m here to help!
c
I only have project and sip url in the settings
t
Hey there! To connect to a room in LiveKit Cloud using your project and SIP URL, here’s a friendly step-by-step guide to help you out: 1. WebSocket URL: For LiveKit Cloud, your WebSocket URL usually looks like
wss://<your-project-id>.livekit.cloud
. You can easily find this in your Project Settings. 2. Generate an Access Token: Make sure you have a valid access token that includes the room name, participant identity, and permissions. These tokens are generated server-side using your API key and secret. Here’s a quick example in Python:
Copy code
from livekit.api import AccessToken

api_key = "your-api-key"
api_secret = "your-api-secret"
access_token = AccessToken(api_key, api_secret) \
    .with_identity("participant-1") \
    .with_name("Participant 1") \
    .with_grants(VideoGrants(room_join=True, room="my-room")) \
    .to_jwt()
3. Connect to the Room: Next, use a client SDK to connect. Here’s how you might do it in JavaScript:
Copy code
import { Room } from 'livekit-client';

const room = new Room();
await room.connect('<wss://your-project-id.livekit.cloud>', 'your-token-here');
console.log('Connected to room:', room.name);
4. SIP URL Usage: The SIP URL comes into play for telephony integrations, like connecting to PSTN numbers or SIP trunks. To add a SIP participant, you’ll use the
CreateSIPParticipant
endpoint. Here’s a Python example to get you started:
Copy code
from livekit.api import SIPClient, CreateSIPParticipantRequest

sip_client = SIPClient(wsUrl, api_key, api_secret)
response = sip_client.CreateSIPParticipant(
    CreateSIPParticipantRequest(
        room_name="my-room",
        participant_identity="sip-participant",
        sip_uri="<sip:caller@sip.exampl>e.com"
    )
)
If you have any questions or need a hand with SIP integration or connecting to your room, just give me a shout—I’m here to help! Sources: Connecting to LiveKit | LiveKit Docs | test/cloud/config.go