Cartesia Python SDK v2.0.0
We are excited to announce the release of v2.0.0 of our Python SDK, polishing the developer experience when using Cartesia's AI voice capabilities with Python.
Getting started with Cartesia using Python
Install the Cartesia Python SDK in your project with:
Initialize the SDK and authenticate:
Now, you can start making requests. For example, to generate audio with Cartesia's text-to-speech model:
For more examples, check out our API Explorer to generate Python code snippets for any of our APIs.
The Python SDK at a glance
Building upon industry established SDK patterns, v2 of our Python SDK delivers a great development experience structured around a primary Cartesia client, which is the entry point for accessing the various API endpoints.
Even more features
Basic Client - Instantiate and use the client with just 24 lines of code.
Async Client - The SDK exports an
async
client alongside standard real-time calls, allowing you to make non-blocking API requests.Streaming - The SDK supports streaming responses and outputs a generator that you can iterate over.
WebSocket - Integrate using WebSockets to build realtime, low-latency voice applications.
Exception Handling - The API gracefully handles non-success status codes (4xx and 5xx responses).
Retries - The SDK is instrumented with automatic retries with exponential backoff.
Timeouts - The SDK defaults to a 60 second timeout. You can configure this with a timeout option at the client or request level.
Custom Client — You can override the
httpx
client to customize it for your use-case. Some common use-cases include support for proxies and transports.
What’s next?
We can’t wait to see what you build with the Cartesia Python SDK! Your feedback helps us improve—let us know your thoughts on our Discord or by submitting issues on GitHub.