Server SDK

Python SDK

The Python SDK wraps the Radist HTTP API with a simple synchronous client. Use it to create P2P calls and SFU rooms from Django, FastAPI, Flask, or any Python service.

Install

Shell
pip install radist-server

Constructor

RadistServerClient(secret_token, *, project_id, api_base_url=...)

ParameterDescription
secret_tokenYour project secret key (rad_sk_...).
project_idYour project id, used as the path parameter in API calls.
api_base_urlOptional. Override the default API base URL for testing.

API surface

MethodReturnsDescription
create_p2p_connection(access_control=)P2PConnectionCreates a two-peer call and returns call_id, call_tokens, and access_control. Defaults to "private"; pass access_control="public" for open calls.
create_room()RoomCreates an SFU room and returns room_id and room_tokens.
mint_connection_token(call_id=, room_id=)ConnectionTokenMints an extra participant token. Pass either call_id or room_id.

Access control

Calls are private by default: only tokens minted server-side with your secret key are accepted. Pass access_control="public" to allow anyone with your public key to join — useful for demos. Private calls return 403 to the public-key endpoint, so you distribute tokens to authorized participants yourself.

Python
# Private (default) — only your server can mint tokens for this call:
conn = client.create_p2p_connection()
# or equivalently:
conn = client.create_p2p_connection(access_control="private")

# Public — anyone with your public key can join via the easy interface:
conn = client.create_p2p_connection(access_control="public")

# For private calls, mint additional tokens server-side as needed:
token = client.mint_connection_token(call_id=conn.call_id)
print("extra token:", token.connection_token)

Create a P2P call

Python
from radist_server import RadistServerClient

client = RadistServerClient(
    "rad_sk_your_secret_key",
    project_id="your_project_id",
)

# access_control defaults to "private"
conn = client.create_p2p_connection()
print("call id:", conn.call_id)
print("tokens:", conn.call_tokens)
print("access control:", conn.access_control)

Create an SFU room

Python
room = client.create_room()
print("room id:", room.room_id)
print("room tokens:", room.room_tokens)

Mint a connection token

Python
# Mint a token for an existing P2P call
result = client.mint_connection_token(call_id="550e8400-e29b-41d4-a716-446655440000")

# Or mint a token for an SFU room
result = client.mint_connection_token(room_id="room_abc123")

print("token:", result.connection_token)

Error handling

API errors raise RadistApiError with a status_code attribute.

Python
from radist_server import RadistServerClient, RadistApiError

try:
    conn = client.create_p2p_connection()
except RadistApiError as e:
    print(f"API error {e.status_code}: {e}")