Python SDK
rydhm is the Python client for the Rydhm API. It is generated from the API’s OpenAPI document, so its models match what the API accepts and returns.
The SDK isn’t published to PyPI yet. Until it is, call the API over HTTP: every example in these docs has a curl version, and the API reference shows each request in Python.
Install
The SDK is built on httpx and pydantic.
Initialize
If you pass no api_key, the client reads RYDHM_API_KEY from the environment.
For asyncio, use AsyncRydhm the same way and await each call.
How methods are named
Methods are grouped by resource: client.experts, client.knowledge, client.conversations, client.chat, client.voice, client.meetings, client.tools, client.analytics. Path parameters come first, as positional arguments; everything else is a keyword argument in snake_case:
Responses are pydantic models: read fields as attributes, such as expert.name.
Every method needs a scope on your key. See Scopes.
Common tasks
List experts
Scope: experts:read.
Start a chat and send a message
chat.send stores your message. Read the expert’s reply from the stream. Scope: chat:write.
Stream the reply
Each frame is a model with a type: sources, delta, tool_call, tool_result, message, done or error. The loop ends after done or error. See Stream the reply.
To continue the conversation, call chat.send and chat.stream again with the same id.
Read a conversation
Scope: conversations:read.
Search knowledge
Scope: knowledge:read. mode ("hybrid" or "vector") is optional.
Add a document
Scope: knowledge:write. For a PDF, Word, Markdown, text or CSV file, use client.knowledge.add_file(expert_id, filename=..., data=...) with the file as base64.
Send an expert to a meeting
Scope: meetings:join. Always pass an idempotency key: a retry with the same key returns the first result instead of sending a second bot.
Errors
A non-2xx response raises. Each common status has its own exception, and all of them extend ApiError:
e.body is the API’s error body, with error (or code), message and the request id.
Retries
By default the SDK retries a request up to 2 times, with exponential backoff, when the response is 408, 409, 429 or any 5xx. Change it for the whole client with max_retries, or for one call:
Retries also apply to calls that start paid work. Always pass idempotency_key to meetings.join, so a retried request can’t send a second bot.
Headers and request ids
with_raw_response gives you the response headers too, such as the request id and rate-limit state:
Every method also takes request_options, a dictionary with timeout (seconds), max_retries and additional_headers.