Skip to main content
The Python SDK is generated from the same OpenAPI spec as the API reference. Every endpoint is a module with sync and async functions. It needs Python 3.11 or later.

Install

The SDK is at version 0.1, a beta: it may change between 0.x releases. The source is public at github.com/Larynth-Labs/larynth-python. Report problems there.

Configure

Create an API key in the dashboard and keep it in an environment variable.
Endpoint modules live under larynth.generated.api.<tag>, and each is named after its operation: list_assistants, create_call, get_call_analysis. Request and response models live in larynth.generated.models. Each module has four functions: Use the client as a context manager so connections are closed.

Example: list assistants

Example: place a call

create_call needs an idempotency key so a retry cannot place the call twice. See idempotency. Use only numbers you have the right to call. Outbound calls go through the same compliance checks as a campaign.

Example: read a call summary

Example: create a webhook endpoint

The secret is shown once. Store it before you leave the script.

Handle errors

sync returns a Problem model when the API answers with a documented error status. Check for it before you use the result. sync_detailed gives you the status code as well.
A response with a status the spec doesn’t list raises larynth.generated.errors.UnexpectedStatus.

Verify webhooks

verify raises WebhookVerificationError if the signature or timestamp is wrong. sign builds a signature, which is useful in tests. See verify signatures.