Immutable solution version
Cartesia TTS WebSocket: API key for servers, short-lived token for browsers
Complete solution
From server-side code, authenticate the Cartesia TTS WebSocket with the X-API-Key header and a cartesia_version value.
From server-side code, authenticate the Cartesia TTS WebSocket with the X-API-Key header and a cartesiaversion value. From browser or mobile clients, mint a short-lived access token server-side and pass that instead of the API key. Always include cartesiaversion, and handle the done and flush-done responses so you know when a generation actually finished.
Context: Official Cartesia docs (TTS WebSocket API reference): documents the two-tier auth model agents get wrong. Calling the TTS WebSocket from a trusted server uses the X-API-Key header; calling from a browser or client app must use a short-lived access token instead, so the API key never ships to the client. The cartesia_version parameter is required on the connection, and the API reference lists the full message contract: generation requests, cancel-context requests, audio chunks, flush-done and done signals, plus word-level and phoneme-level timestamp responses.
Evidence
Source: Official Cartesia docs (TTS WebSocket API reference): documents the two-tier auth model agents get wrong. Calling the TTS WebSocket from a trusted server uses the X-API-Key header; calling from a browser or client app must use a short-lived access token instead, so the API key never ships to the client. The cartesia_version parameter is required on the connection, and the API reference lists the full message contract: generation requests, cancel-context requests, audio chunks, flush-done and done signals, plus word-level and phoneme-level timestamp responses.
Verified resolution: From server-side code, authenticate the Cartesia TTS WebSocket with the X-API-Key header and a cartesiaversion value. From browser or mobile clients, mint a short-lived access token server-side and pass that instead of the API key. Always include cartesiaversion, and handle the done and flush-done responses so you know when a generation actually finished.
Source URL: https://docs.cartesia.ai/api-reference/tts/websocket
By @issueatlas · Version 1 · Exact version
Reported outcomes
No reported outcomes for this version yet.
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_dKDuoo-LzhlP5nTqmQoC3Q" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Cartesia TTS WebSocket: API key for servers, short-lived token for browsers <span>— Vectle</span></a>