Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.gradium.ai/llms.txt

Use this file to discover all available pages before exploring further.

Most voice API migrations come down to the same small swap: point your existing request code at Gradium, send your Gradium API key in the x-api-key header, and use a Gradium voice_id or model setting. Your app can keep the same shape:
  • POST when you already have the full input.
  • WebSocket when you want streaming input or low-latency output.
  • Audio bytes or streamed chunks come back in the same places your current provider integration already handles them.
If you already wrapped ElevenLabs, Cartesia, or Deepgram behind a small provider adapter, migrating is usually just changing the URL, auth header, and a few field names.

Simple POST example

For a complete text block, send one HTTP request and write the audio response to a file:
curl -L -X POST https://api.gradium.ai/api/post/speech/tts \
  -H "x-api-key: your_api_key" \
  -H "Content-Type: application/json" \
  -d '{"text": "Hello from Gradium.", "voice_id": "YTpq7expH9539ERJ", "output_format": "wav", "only_audio": true}' \
  > output.wav
That is the whole path for one-shot TTS: request body in, audio bytes out. For the full schema, see Text-to-Speech REST.

Simple WebSocket example

For streaming TTS, connect to the Gradium WebSocket, send setup once, then send text:
wscat -c "wss://api.gradium.ai/api/speech/tts" \
  -H "x-api-key: your_api_key"
After the connection opens, send:
{"type":"setup","voice_id":"YTpq7expH9539ERJ","model_name":"default","output_format":"wav"}
{"type":"text","text":"Hello from Gradium."}
{"type":"end_of_stream"}
Gradium streams audio messages back with base64-encoded audio chunks. For the full message contract, see Text-to-Speech WebSocket.

Provider guides

ElevenLabs to Gradium

Swap ElevenLabs TTS endpoints for Gradium REST and WebSocket endpoints.

Cartesia to Gradium

Move Cartesia Sonic TTS calls to Gradium with the same request flow.

Deepgram to Gradium

Replace Deepgram STT or TTS endpoints with the equivalent Gradium endpoints.

What usually changes

AreaChange
Base URLUse https://api.gradium.ai/api for REST and wss://api.gradium.ai/api for WebSockets.
AuthSend x-api-key: your_api_key.
TTS voicePass a Gradium voice_id in the request body or WebSocket setup message.
TTS outputUse output_format, for example wav, pcm, or opus.
Streaming startSend a Gradium setup message first on WebSocket connections.
Streaming endSend {"type":"end_of_stream"} when you are done sending input.

Speech-to-text endpoints

If you are migrating an STT integration, use the same idea with the STT routes:
FlowGradium endpoint
Complete audio filePOST https://api.gradium.ai/api/post/speech/asr
Live audio streamwss://api.gradium.ai/api/speech/asr
See Speech-to-Text REST and Speech-to-Text WebSocket for the message formats.