Skip to main content
LiveKit Agents logo
LiveKit is a WebRTC-first platform for realtime video, voice, and data in your product. LiveKit Agents is its framework for conversational agents. Cartesia integrates in two ways: LiveKit Inference and open source plugins.

LiveKit Inference

You can use Cartesia’s models on LiveKit’s infrastructure. API keys and pricing are managed by LiveKit rather than Cartesia.
  1. LiveKit docs for Cartesia STT
  2. LiveKit docs for Cartesia TTS

Open source plugins

These are plugins that can be used with the open-source LiveKit Agents packages.

Python

You can use Cartesia with Python LiveKit Agents by installing the livekit-plugins-cartesia package. If needed, you can the source code of the plugin in the /livekit-plugins/livekit-plugins-cartesia directory of the livekit/agents repo.
Ink 2 requires livekit-plugins-cartesia>=1.5.15. Older versions will produce poor results without raising runtime errors.

Setting up the Python plugin in your own agent

To get started, first install the main livekit-agents package as well as livekit-plugins-cartesia:
pip install livekit-agents livekit-plugins-cartesia
Then, use the Cartesia STT and TTS plugins when creating your agent.
from livekit.plugins import cartesia

# using cartesia STT and TTS in a LiveKit agent
session = AgentSession(
    stt=cartesia.STT(
        api_key=os.environ.get("CARTESIA_API_KEY"),
    ),
    tts=cartesia.TTS(
        api_key=os.environ.get("CARTESIA_API_KEY"),
    ),
)

Running a Python example

Check out /examples/other/cartesia.py in the livekit/agents repo for a fully working conversational agent.
# clone and setup livekit/agents
git clone git@github.com:livekit/agents.git
cd agents
uv sync

# run with required API keys:
# - CARTESIA_API_KEY
# - LIVEKIT_URL, LIVEKIT_API_KEY, LIVEKIT_API_SECRET
# -  some LLM provider's API key
uv run examples/other/cartesia.py console

Node.js

You can use Cartesia with Node.js LiveKit Agents by installing the @livekit/agents-plugins-cartesia package. If needed, you can reference the source code of the plugin in the /plugins/cartesia directory of the livekit/agents-js repo.
LiveKit Agents is not feature complete in Node.js. You should probably stick to Python for “serious” voice agents.

Setting up the Node.js plugin in your own agent

To get started, first install the main @livekit/agents package as well as @livekit/agents-plugins-cartesia:
npm i @livekit/agents @livekit/agents-plugin-cartesia
Then, use the Cartesia STT and TTS plugins when creating your agent.
import * as cartesia from "@livekit/agents-plugin-cartesia";

// using cartesia STT and TTS in a LiveKit agent
const session = new voice.AgentSession({
  stt: new cartesia.STT({
    apiKey: process.env.CARTESIA_API_KEY,
  }),
  tts: new cartesia.TTS({
    apiKey: process.env.CARTESIA_API_KEY,
  }),
});

Running a Node.js example

Check out /examples/src/cartesia.ts in the livekit/agents-js repo for a fully working conversational agent.
# clone and setup livekit/agents-js
git clone git@github.com:livekit/agents-js.git
cd agents-js
pnpm i && pnpm run build

# run with required API keys:
# - CARTESIA_API_KEY
# - LIVEKIT_URL, LIVEKIT_API_KEY, LIVEKIT_API_SECRET
# -  some LLM provider's API key
node ./examples/src/cartesia.ts dev

# go to https://agents-playground.livekit.io/
# find your agent (make sure you're in the right org)
# then connect to it with WebRTC transport

Demo

LiveKit Cartesia Demo

Try out a simple voice assistant built with LiveKit Agents and Cartesia.
Simplified source code for the demo is available on GitHub in the cartesia-ai/livekit-agents-example repo.