Getting Started / CLI Setup

CLI Setup

Install LiveKit CLI and test your setup using an example client application.

On this page

Install LiveKit CLI

Generate access token

Test with a LiveKit client

Simulating another publisher

Install LiveKit CLI

brew install livekit-cli

livekit-cli lets you conveniently access server APIs, create tokens, and generate test traffic, all from your command line. For more details, refer to our CLI docs or GitHub repo.

Generate access token

A participant creating or joining a LiveKit room needs an access token to do so. For now, lets generate one via CLI:

Make sure you're running LiveKit server locally in dev mode

livekit-cli create-token \
--api-key devkey --api-secret secret \
--join --room my-first-room --identity user1 \
--valid-for 24h

Test with a LiveKit client

Note:

If you're testing a LiveKit Cloud instance, you can find your LiveKit URL (it starts with wss://) right above your project's name under the Dashboard sidebar menu item.

Using our example app, enter the token you previously generated to connect to your LiveKit instance. Once connected, your microphone and camera are being streamed in real-time to your new LiveKit instance (and any other participant who connects to the same room)!

browser client screenshot

If interested, here's the full source for this example app.

Simulating another publisher

One way to test a multi-user session is by generating a second token (ensure --identity is unique), opening our example app in another browser tab and connecting to the same room.

Another way is to use the CLI as a fake participant and publish a prerecorded video to the room. Here's how:

livekit-cli join-room \
--url ws://localhost:7880 \
--api-key devkey --api-secret secret \
--room my-first-room --identity bot-user \
--publish-demo

This command publishes a looped demo video to my-first-room. Due to how the file was encoded, expect a short delay before your browser has sufficient data to render frames.