Skip to main content

Cartesia

Cartesia is a service that provides Speech-to-Text (STT) and Text-to-Speech (TTS) capabilities. It's designed for real-time voice applications, making it ideal for voice AI agents, transcription pipelines, and conversational interfaces.

The Cartesia plugin for the Stream Python AI SDK allows you to add STT and TTS functionality to your project.

Installation

Install the Stream Cartesia plugin with

uv add "vision-agents[cartesia]"
# or directly
uv add vision-agents-plugins-cartesia

Examples

Read on for some key details and check out our Cartesia examples to see working code samples:

  • in main.py we see a voice bot that uses Cartesia STT and TTS in a Stream call
  • in narrator-example.py we see a well-prompted combination of an STT -> LLM -> TTS flow that leverages Cartesia's Ink and Sonic models to narrate a creative story from the user's input

Initialisation

The Cartesia plugin for Stream exposes STT and TTS classes:

from vision_agents.plugins import cartesia

stt = cartesia.STT()
tts = cartesia.TTS()
To initialise without passing in the API key, make sure the `CARTESIA_API_KEY` is available as an environment variable. You can do this either by defining it in a `.env` file or exporting it directly in your terminal.

Parameters

These are the parameters available in the Cartesia STT plugin for you to customise:

Name Type Default Description
api_key str or None None Your Cartesia API key. If not provided, the plugin will look for the CARTESIA_API_KEY environment variable.
model str "ink-2" ID of the Cartesia STT model to use.
sample_rate int 16000 Sample rate (in Hz) sent to Cartesia.
encoding str "pcm_s16le" PCM encoding sent to Cartesia.
cartesia_version str "2026-03-01" Cartesia API version used for the turn-detection websocket.

These are the parameters available in the Cartesia TTS plugin for you to customise:

Name Type Default Description
api_key str or None None Your Cartesia API key. If not provided, the plugin will look for the CARTESIA_API_KEY environment variable.
model_id str "sonic-3.5" ID of the Cartesia TTS model to use.
voice_id str or None "f9836c6e-a0bd-460e-9d3c-f7299fa60f94" ID of the voice to use for TTS responses.
sample_rate int 16000 Sample rate (in Hz) used for audio processing.

Functionality

Send audio to transcribe speech

STT streams PCM audio to Cartesia Ink and emits transcript and turn events that Vision Agents can use for interruption and eager turn handling.

agent = Agent(
    ...,
    stt=cartesia.STT(),
    tts=cartesia.TTS(),
)

Send text to convert to speech

The send_iter() method sends the text passed in for the service to synthesize and yields TTSOutputChunks containing the produced PCM audio.

async for chunk in tts.send_iter("Demo text you want AI voice to say"):
    pass

Metadata

Release files for vision-agents-plugins-cartesia 0.6.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for vision-agents-plugins-cartesia 0.6.9
File Size Uploaded Provenance Actions
vision_agents_plugins_cartesia-0.6.9.tar.gz 7.0 kB Without provenance Details for vision_agents_plugins_cartesia-0.6.9.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for vision-agents-plugins-cartesia 0.6.9
File Interpreter ABI Platform Actions
vision_agents_plugins_cartesia-0.6.9-py3-none-any.whl Python 3 none any Details for vision_agents_plugins_cartesia-0.6.9-py3-none-any.whl

Total release size: 14.6 kB

Release files / vision_agents_plugins_cartesia-0.6.9.tar.gz

Download URL vision_agents_plugins_cartesia-0.6.9.tar.gz
Size 7.0 kB
Tags Source
SHA-256 checksum
How to use checksums
06d71f4eeacd19f04754b57ede95d13b52adeb9eb13facadca7097cbf619ebcc
BLAKE2b-256 checksum
How to use checksums
7b9cceefebaa676d1e1c5a9a0dcf2403d0bb64d4eb268b2e42ebc4d395e62885
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.10 {"installer":{"name":"uv","version":"0.10.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / vision_agents_plugins_cartesia-0.6.9-py3-none-any.whl

Download URL vision_agents_plugins_cartesia-0.6.9-py3-none-any.whl
Size 7.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
74b2b80e24e5fd1165181073f6fffb6d848458fd666a5bac402fe16cef242d75
BLAKE2b-256 checksum
How to use checksums
52f86f7d3abdb9d6e62f32d52fe104fd221eb7d7cca1b56aa199dbd51f7f02ea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.10.10 {"installer":{"name":"uv","version":"0.10.10","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for vision-agents-plugins-cartesia 0.6.9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.6.9 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page