Skip to main content
The Finesse Python SDK wraps the API in typed sync and async clients. It covers voices, cloning, one-shot and streamed speech, and realtime sessions for voice agents, and it handles retries, timeouts and errors for you.

PyPI

flam-finesse, for Python 3.10+. Built on httpx, Pydantic and websockets.

Source on GitHub

homingos/finesse-python, Apache-2.0. The full README and every option live there.

Install

The package is flam-finesse; you import it as flam_finesse. Create an API key in the dashboard under Developers → API Keys, and put it in your environment, where the client reads it:
Keep the key on your server. See Authentication.

Hello, Finesse

hello.py
hello.wav is a 24 kHz WAV file.

Text to speech

speech.create returns the whole clip in one response. speech.stream sends audio as it is generated, so playback can start before the clip is finished:
Both take output_format ("wav", raw PCM formats, or "mulaw" for phone calls) and sample_rate. See Synthesize speech for every parameter.

Async

AsyncFinesse has the same methods as Finesse, with await:

Realtime

Realtime is for voice agents: one WebSocket, text in as your LLM writes it, audio back as fast as the engine makes it, and cancel on barge-in. It uses the async client:
To stream an LLM reply, open a context, send text as it arrives and finish() the turn; call cancel() when the user interrupts. The concepts, events and limits are the same as in the TypeScript Realtime guide.

Direct sessions

For the lowest latency, a direct session runs the socket straight against the synthesis GPU in your account’s region:
A session is single use, limited to the voices you list, and has a character budget and a one-hour lifetime: see Direct sessions and Create a direct realtime session. To connect from somewhere that holds no API key, create the session on your server and open it there with connect_direct.

Errors

Every error derives from flam_finesse.FinesseError. HTTP errors carry status_code, a machine-readable code (branch on this, not on the message), retry_after and request_id:
Requests that cost credits send an Idempotency-Key, so the client’s automatic retries never bill twice. See Errors for every code.

More

The README on GitHub covers everything else: cloning a voice, short-lived tokens, audio formats, per-request options, timeouts and logging.