Skip to main content

Livekit Server SDK for Python

Project description

LiveKit Server SDK Code style: black Imports: isort

API Reference:


Generate Access Token for a Client

import livekit

grant = livekit.VideoGrant(room_join=True, room="My Cool Room")
access_token = livekit.AccessToken("<api key>", "<api secret>", grant=grant, identity="bob", name="Bob")
token = access_token.to_jwt()

Using RoomServiceClient

import livekit

client = livekit.RoomServiceClient("<host>", "<api key>", "<api secret>")
    room="<room name>",
    track_sid="<track sid>",

Local Development

Make sure you clone with submodules:

$ git clone --recurse-submodules

Or if you have already cloned:

$ git submodule update --init


  • golang >= 1.17
  • protoc
    • Ubuntu: sudo apt install protobuf-compiler
  • protoc-gen-twirpy
    • go install
    • make sure ~/go/bin is in your $PATH
  • pre-commit

Environment Setup

Set up the python virtual environment:

$ python3 -m venv env
$ source env/bin/activate
$ pip install --editable '.[dev]'
$ pre-commit install

Run tests

The RoomServiceClient tests require a running LiveKit server. See the LiveKit Getting Started page.

The tests use the following environment variables to locate the LiveKit server.

export LIVEKIT_HOST='http://localhost:7880'
export LIVEKIT_API_KEY='<api key>'
export LIVEKIT_API_SECRET='<api secret>'

Run the tests:

$ pytest

Updating protocol

The script pulls the latest tag and builds

$ ./bin/

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

livekit_server_sdk_python-1.0.0.tar.gz (47.5 kB view hashes)

Uploaded Source

Built Distribution

livekit_server_sdk_python-1.0.0-py3-none-any.whl (62.1 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page