x-api-key
auth, Gradium voice_id values, and Gradium WebSocket messages.
For realtime apps, Gradium also gives you STT semantic VAD and adaptive
delay controls in the same API surface.
Endpoint Swap
Auth Mapping
Gradium POST TTS
Gradium’s POST endpoint returns audio bytes whenonly_audio is
true, so the rest of your “write this response to a file or player”
code can stay the same.
Gradium
TTS Field Mapping
Gradium uses a compact
output_format string: wav, pcm, opus,
ulaw_8000, alaw_8000, or explicit PCM rates such as pcm_16000.
WebSocket TTS Migration
Gradium sendssetup first, then one or more text messages, then
end_of_stream. Use client_req_id when you need to correlate
concurrent logical requests on one socket.
Gradium messages
client_req_id and
close_ws_on_eos: false are optional. Use them when you want multiple
utterances on one socket.
TTS Feature Mapping
Gradium Streaming STT
Gradium STT uses JSON messages for direct WebSocket audio, with base64 payloads. It returnstext, end_text, step, flushed, and
end_of_stream messages.
Gradium STT
Adapter Checklist
- Replace provider URLs with matching Gradium endpoints.
- Remove provider API-version headers; Gradium does not require them.
- Change auth to
x-api-keyon servers or temporary?token=...for browser WebSockets. - Rename
transcripttotext. - Flatten
voice.idtovoice_id. - Convert structured
output_formatinto a Gradium format string. - For context-style routing, map the request identifier to
client_req_idwhen you need response correlation. - For STT direct WebSocket clients, base64 encode audio inside JSON messages.
Next steps
Gradium TTS WebSocket guide
Streaming setup messages, audio messages, flush, and timestamps.
Multiplexing
Replace context-style routing with
client_req_id.Browser WebSockets
Use short-lived tokens without exposing API keys.
Telephony audio
Map low-sample-rate PCM, mu-law, and A-law formats.