x-api-key, and
use a Gradium voice_id. The playback path can usually stay the same.
Endpoint swap
Request mapping
For POST requests, the most important change is that Gradium takes the voice in the JSON body instead of the URL path:
Use the Gradium POST example
as the replacement request. It returns raw audio bytes when
only_audio is true, so existing “save the response body as audio”
code can stay the same.
WebSocket mapping
For streaming TTS, the Gradium lifecycle is:- Connect to
wss://api.gradium.ai/api/speech/tts. - Send a
setupmessage withvoice_id,model_name, andoutput_format. - Send one or more
textmessages. - Send
end_of_stream. - Read
audiomessages until Gradium sendsend_of_stream.
Checklist
- Replace the provider URL with the Gradium endpoint.
- Change auth to
x-api-key. - Move the voice id from the URL path into
voice_id. - Use a Gradium voice id from the voice library.
- Keep your existing audio write/playback path.
Gradium TTS REST guide
Full POST schema, response modes, and supported output formats.