Reference

Authentication

API keys, where each surface takes them, and what a missing or wrong key gets back.

View as Markdown

API keys#

Every request to the router carries one of your org’s API keys: tcr_ followed by 43 characters.

  • Sign-up creates one; create more in the dashboard under API keys. A writer or admin of your org can reveal and copy a key again there at any time.
  • Every key in an org shares its cache, provider keys and retention. Use one per agent or environment, so you can revoke one alone.
  • A new key works at once. A deleted key is refused within a few seconds, including on connections already open.
  • Keep keys server-side, in your agent’s secrets. Never ship one in a browser or a mobile app.

To check a key, list your stored provider keys with it:

Shell
curl https://api.ttscacherouter.dev/v1/provider-keys \  -H "Authorization: Bearer $TTS_CACHE_ROUTER_API_KEY"

Where to send it#

The router's own endpoints take it as a bearer token. The drop-ins take it wherever the provider's API takes its key, so the provider's clients work unchanged.

EndpointHeader
/v1/stream (WebSocket)Authorization: Bearer tcr_…
/v1/audio/speechAuthorization: Bearer tcr_…
/v1/provider-keysAuthorization: Bearer tcr_…
/vaakini/…Authorization: Bearer tcr_…
/sarvam/…api-subscription-key: tcr_…
/raya/…X-API-Key: tcr_…
/elevenlabs/…xi-api-key: tcr_…
/openai/…Authorization: Bearer tcr_…
/deepgram/…Authorization: Token tcr_…
/xai/…Authorization: Bearer tcr_…
/soniox/…Authorization: Bearer tcr_…
/smallestai/…Authorization: Bearer tcr_…
/cartesia/…X-API-Key: tcr_… or Authorization: Bearer tcr_…
/gemini/…x-goog-api-key: tcr_… or the ?key=tcr_… query parameter
/60db/ws/ttsThe ?apiKey=tcr_… query parameter

GET /v1/models, GET /openapi.json and GET /healthz need no key. In the LiveKit plugin, the key is api_key= or TTS_CACHE_ROUTER_API_KEY; in a provider’s own plugin or SDK, it goes where the provider key went.

Provider keys#

Your Vaakini, Sarvam, Raya, ElevenLabs, OpenAI, Deepgram, xAI, Soniox, Smallest AI, Cartesia, Gemini and 60db keys stay with your org, not in your requests. Maya Open-Source, which we host, takes none.

Store one key per provider under Provider keys, or with PUT /v1/provider-keys/{provider} (see the REST API). The router uses it to call that provider for your org’s requests only. It’s stored encrypted and never returned, only its last four characters. Saving doesn’t check it with the provider: a wrong key surfaces as the provider’s refusal on your first request. Maya Open-Source runs on our own GPU and needs no key; a request for it never gets provider_key_missing.

When a key is refused#

WhereA missing, wrong or deleted API key gets
/v1/streamHTTP 403 at the handshake. A key deleted while a connection is open: an unauthorized error at its next start.
/v1/audio/speechHTTP 401, unauthorized.
/v1/provider-keysHTTP 401, unauthenticated.
Vaakini drop-inVaakini's own refusal: HTTP 401 unauthorized, at the WebSocket handshake too.
Sarvam drop-inSarvam's own refusal: HTTP 403 invalid_api_key_error, at the WebSocket handshake too.
Raya drop-inRaya's own refusal: HTTP 401 Unauthorized.
ElevenLabs drop-inElevenLabs' own refusal: HTTP 400 invalid_api_key (401 with no key at all); on a WebSocket, that error message and close 1008.
OpenAI drop-inOpenAI's own refusal: HTTP 401, code invalid_api_key (null with no key at all).
Deepgram drop-inDeepgram's own refusal: HTTP 401 INVALID_AUTH, at the WebSocket handshake too.
xAI drop-inxAI's own refusal: HTTP 400 (401 with no key at all), at the WebSocket handshake too.
Soniox drop-inSoniox's own refusal: HTTP 401 unauthenticated; on the WebSocket, that error message right after the connection opens, then a close.
Smallest AI drop-inSmallest AI's own refusal: HTTP 401 unauthorized, at the WebSocket handshake too.
Cartesia drop-inCartesia's own refusal: HTTP 401 Unauthorized, in the shape of your Cartesia-Version, at the WebSocket handshake too.
Gemini drop-inGoogle's own refusal: HTTP 400 API_KEY_INVALID (403 PERMISSION_DENIED with no key at all).
60db drop-in60db's own refusal: the WebSocket closes with code 1008, Invalid API key.

An org with no key stored for the provider gets provider_key_missing, or on the drop-ins the provider’s own refusal with a message that links to the dashboard. See Errors.