cartesia-api
Skill1 starsChanged 2 months agoMITView on GitHub
Integrate Cartesia speech APIs (TTS, STT, voices) in application code or coding-agent workflows. Use when the user asks about Cartesia REST/WebSocket APIs, SDKs, API keys, Sonic TTS, Ink STT, voice IDs, access tokens, or embedding voice in an app. For Cartesia Line deployed agents, CLI deploy, and telephony, use the cartesia-line skill instead.
- Reads credentials
- Installs packages
- Sends data out
1 other project uses a version of this, 1 of them edited.
Adopted by
Most recently taken up by
- delorenj/skillsedited, first seen Oct 2, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 1
- delorenj/skills★ 1595% same
Wrote their own version · 0
None found.
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository26 other files it gives its agents.
- cartesia-lineSkill
- agentsSkill
- dubbingSkill
- speech-engineSkill
- speech-to-textSkill
- text-to-speechSkill
- voice-changerSkill
- voice-isolatorSkill
- building-livekit-agentsSkill
- debugging-livekit-agentsSkill
- operating-livekit-agentsSkill
- reading-livekit-docsSkill
- running-livekit-simulationsSkill
- testing-livekit-agentsSkill
- writing-livekit-scenariosSkill
- speechSkill
- transcribeSkill
- deploySkill
- initSkill
- talkSkill
- twilio-ai-agent-architectSkill
- twilio-call-recordingsSkill
- twilio-conference-callsSkill
- twilio-voice-conversation-relaySkill
- twilio-voice-outbound-callsSkill
- twilio-voice-twimlSkill
The file
We split this skill into the rules it gives an agent
8 rules. About 0 are common, 6 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈6
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 13
HTTPS only: All HTTP endpoints use https://api.cartesia.ai.
- Very specific: line 19
Server-side auth: Use Authorization: Bearer <api_key> with your Cartesia API key (sk_car_...).
- Distinctive: line 27
Source of truth: Prefer docs since they are updated first before SDKs / plugins / integrations
- Distinctive: line 46
Before you write any STT code: read Common STT Pitfalls
- Distinctive: line 47
Don't assume model or API behavior without grounding it in the docs — small client-side mistakes cause obscure but severe accuracy …
- Distinctive: line 51
Not following the API spec
- Distinctive: line 116
Do not collapse these:
- Distinctive: line 132
API keys in frontend code: use short-lived access tokens minted by your backend.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Cartesia Voice & Speech APIs
Cartesia provides text-to-speech (Sonic), speech-to-text (Ink), voices (library, clone, localize), and related HTTPS and WebSocket APIs. This skill covers application integration and agent-assisted coding. For Cartesia Line (managed voice agents, cartesia CLI, telephony, Line SDK), use cartesia-line.
Core directives
- HTTPS only: All HTTP endpoints use
https://api.cartesia.ai. WebSockets usewss://- HTTP may be unsupported; keys used over HTTP can be auto-rotated
- API version: Cartesia's API is dated (
Cartesia-Version: YYYY-MM-DD). Pin one version across your services and treat bumping it like a major dependency upgrade — a new version can carry breaking changes — so it's a fixed choice, not a runtime/per-call variable.- With an SDK (recommended): the SDK already pins a
Cartesia-Versionit was built and tested against. Let it manage that — do not override it (e.g. viadefault_headers) with your own date, since the SDK may not work against an arbitrary version. To move to a newer API version, upgrade the SDK. - Calling the API directly (no SDK): you must send
Cartesia-Versionyourself. Browser WebSockets can't set handshake headers, so pass it as?cartesia_version=...(query wins if both are present). - Optional:
GET https://api.cartesia.ai/returns{"ok":true,"version":"..."}(the gateway's current default), useful when wiring a new client.
- With an SDK (recommended): the SDK already pins a
- Server-side auth: Use
Authorization: Bearer <api_key>with your Cartesia API key (sk_car_...). - Client apps (browser / mobile): Never embed API keys. Have your backend mint a short-lived access token and use
Authorization: Bearer <access_token>- For WebSockets from browsers, pass the token as
?access_token=<token>(headers are not available on WS handshake) - The JS/TS SDK (v3+) runs in the browser with an access token — prefer it over hand-rolling the WebSocket (see its Browser Examples below); don't assume the SDK is server-only
- See Access Token API
- For WebSockets from browsers, pass the token as
- Errors: For
Cartesia-Version2026-03-01 and newer, errors are structured JSON (error_code,title,message,request_id, optionaldoc_url)- Older versions may return legacy plain-text or legacy JSON structures
- See API Errors and API conventions
- Source of truth: Prefer docs since they are updated first before SDKs / plugins / integrations
- Fetch docs as Markdown: append
.mdto anydocs.cartesia.aipage to get the agent-readable Markdown (e.g.https://docs.cartesia.ai/api-reference/stt/transcribe.md); the bare URL is the human HTML page. Prefer the.mdform when fetching docs programmatically - For machine index:
llms.txtandllms-full.txt
- Fetch docs as Markdown: append
- Optional MCP: hosted server
https://mcp.cartesia.ai/mcp(OAuth via the Playground) lists voices, runs TTS/STT, clones, and manages pronunciation dictionaries in Cursor / Claude- MCP does not replace API / SDKs for production
- Local stdio (
uvx cartesia-mcp) is for development; see MCP docs
Text-to-speech with Sonic (generating audio)
- Choosing a TTS model: See TTS models for current model IDs, supported languages, and features. Don't trust a model ID from memory — training data goes stale (e.g.
sonic-2is no longer current) - Voice IDs: Don't invent a voice ID — a made-up UUID won't resolve. Real voice IDs are stable, so hardcoding a real one as a constant is fine and common; copy one from the playground or List Voices. Use List Voices to discover/choose a voice, not as a required call on every request
- Choosing an endpoint — bytes vs WebSocket: if the text is known up front (a fixed string, a button press), use
POST /tts/bytes— it streams audio back as it's generated and is simpler. Reach for the WebSocket only when the input text arrives incrementally (e.g. piping an LLM's token stream) — the continuations case. Don't default to WebSockets; compare them in TTS endpoints - Output audio format: See TTS output audio format for containers/encodings/sample rates (
wav+pcm_s16le@ 44.1 kHz is a safe, self-contained default;mp3carries no separateencoding)
Speech-to-text with Ink (transcribing audio)
- Choosing an STT model: see STT models for current models and supported languages
- Choosing an API endpoint: see Compare STT Endpoints
- Input audio: see STT input encodings for supported formats (self-contained files like
.wavcarry their own header) - Before you write any STT code: read Common STT Pitfalls
- Don't assume model or API behavior without grounding it in the docs — small client-side mistakes cause obscure but severe accuracy degradation
- Common client-side errors:
- Stripping or inserting whitespace in transcripts (read the model's text verbatim — no
.strip(), no normalization) - Improperly concatenating transcript pieces
- Not following the API spec
- Stripping or inserting whitespace in transcripts (read the model's text verbatim — no
Cartesia Python SDK
pip install cartesia
Replace /heads/main/ with /tags/vX.X.X/ (e.g. /tags/v3.2.0/) to source code specific to your SDK version.
Cartesia TypeScript / JavaScript SDK
npm i @cartesia/cartesia-js
Replace /heads/main/ with /tags/vX.X.X/ (e.g. /tags/v3.2.0/) to source code specific to your SDK version.
When to use which path
| Goal | Path |
| App or backend calling REST/WebSocket | Python SDK, JS/TS SDK, or native API requests / fetch |
| IDE agent with MCP | Hosted https://mcp.cartesia.ai/mcp + docs fallback |
| Deployed voice agent, Line, telephony | cartesia-line |
| OpenClaw bootstrap | https://cartesia.sh/openclaw.md then docs / llms.txt |
Quick start (HTTP TTS, one-shot)
Shape only: confirm field names and enums against the API reference for your Cartesia-Version:
curl -X POST "https://api.cartesia.ai/tts/bytes" \
-H "Authorization: Bearer $CARTESIA_API_KEY" \
-H "Cartesia-Version: 2026-03-01" \
-H "Content-Type: application/json" \
-d '{
"model_id": "sonic-3",
"transcript": "Hello from Cartesia.",
"voice": { "id": "f786b574-daa5-4673-aa0c-cbe3e8534c02" },
"output_format": {
"container": "wav",
"encoding": "pcm_s16le",
"sample_rate": 44100
},
"language": "en"
}' \
--output /tmp/out.wavMental model (for LLMs)
- Sonic = TTS model used to generate speech
- Ink = STT model used to transcribe audio
- Line = separate product: you deploy your Python agent; Cartesia runs STT/TTS/telephony around it, different from "call TTS API from my server."
- Concurrency / quota: Handle
429-class and structuredconcurrency_limited/quota_exceededper API errors.
Language vs locale vs accent
Do not collapse these:
- language — coarse code (
en,es) - locale — language-region bucket (
en-US,en-GB) - accent — a specific voice identity inside a locale
One locale can have many accents. en-US includes General American and Southern American. Country cannot pick a unique accent. Prefer catalog IDs from the API over display names when the client will persist or send a value back.
Related material in this repo
- Line voice agents: cartesia-line
- Link hub: references/resources.md
Common mistakes
- Overriding the SDK's
Cartesia-Version: with an SDK, don't set or override the version — it pins one it's tested against; upgrade the SDK to move versions. Only raw HTTP/WS callers send the date themselves, and then keep one date everywhere (wrong date → subtle breakage or legacy error shapes). - API keys in frontend code: use short-lived access tokens minted by your backend.
- Wrong auth header style: examples use
Authorization: Bearer; match current docs, not old snippets. - Stale SDK / model code from memory: training data lags the API. Model IDs drift (e.g.
sonic-2), and the JS SDK's namedimport { CartesiaClient }is deprecated and won't run in browsers — useimport Cartesia from "@cartesia/cartesia-js"(or the default import). Confirm models against the models docs and SDK usage against the linked README / examples. - Using this skill for
cartesia deploy/ Line: switch to cartesia-line.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

