how do i use the livekit-cli and what can it do? ...
# ask-ai
e
how do i use the livekit-cli and what can it do? is there documentation ?
t
Thanks for reaching out, Jason. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Hi there! The LiveKit CLI is a fantastic tool designed to make your experience with LiveKit smooth and efficient. It offers wonderful features like application bootstrapping, token creation, room and egress management, participant simulation, and load testing to help you get the most out of your projects. To get started easily, you can install it with these commands: • Mac:
brew install livekit-cli
• Linux:
curl -sSL <https://get.livekit.io/cli> | bash
• Windows:
winget install LiveKit.LiveKitCLI
Once you have it installed, just authenticate using
lk cloud auth
, and you’ll be ready to explore all its helpful features, like: • Application Bootstrapping: Easily kick off a new project with
lk app create --template <template_name> my-app
. • Token Management: Create access tokens effortlessly using
lk token create --join --room <room_name> --identity <user_id>
. • Room Interaction: Join a room as a participant by running
lk room join --identity <id> <room_name>
. • Egress (Recording): Start recording a room or track composition with
lk egress start
. • Load Testing: Simulate traffic to see how your server performs using
lk load-test
. If you’d like to dive deeper, the GitHub repository and the LiveKit Docs have some great detailed guides. And remember, you can always use the
--help
flag for quick tips on any command (for example,
lk --help
). Sources: README.md | LiveKit CLI Setup | LiveKit Docs | LiveKit CLI project management | LiveKit Docs
e
does it work in a self hosting environment?
t
Absolutely! The LiveKit CLI works perfectly in a self-hosting environment. You can easily set it up to connect with your self-hosted LiveKit server by configuring a few environment variables: • `LIVEKIT_URL`: This should be the URL of your self-hosted server. • `LIVEKIT_API_KEY`: Your API key goes here. • `LIVEKIT_API_SECRET`: And this is where you put your API secret. Once you have these set, the CLI lets you generate access tokens, manage rooms, and even simulate publishers right on your own server. For instance, if you want to create a token for a local server in dev mode, you can run:
Copy code
lk token create \
    --api-key devkey --api-secret secret \
    --join --room my-first-room --identity user1 \
    --valid-for 24h
If you have any questions or need a hand with the setup, just let me know—I’m here to help! Sources: Making calls using SIP | LiveKit Docs | LiveKit CLI Setup | LiveKit Docs | Making calls using SIP | LiveKit Docs