Skip to main content
Keep your existing adapter shape: audio in still produces transcript events, and text in still produces audio bytes or chunks. Move the implementation to Gradium endpoints, x-api-key auth, Gradium voice_id values, and Gradium message types. For realtime STT, Gradium adds semantic VAD, adaptive delay, and explicit flush handling for turn-taking.

Endpoint Swap

Auth Mapping

Gradium Speech-to-Text POST

For pre-recorded audio, keep sending the audio bytes in the request body and switch the URL. Gradium streams newline-delimited JSON messages back.
Gradium
Gradium’s response is NDJSON. Build the transcript by collecting text messages and pairing them with end_text when you need segment end timestamps.

Speech-to-Text WebSocket

Gradium’s direct WebSocket protocol sends audio in JSON messages with base64 payloads:
Gradium messages
Set input_format to match the audio you send: pcm, wav, opus, ulaw_8000, alaw_8000, or another supported Gradium format.

STT Feature Mapping

Gradium Text-to-Speech POST

Gradium uses voice_id in the JSON body and returns raw audio bytes when only_audio is true, so your existing file-write or playback code can usually remain unchanged.
Gradium

Text-to-Speech WebSocket

For streaming TTS, use Gradium setup, text, and end_of_stream messages:
Gradium messages

TTS Feature Mapping

Adapter Checklist

  • Replace provider URLs with matching Gradium endpoints.
  • Change auth to x-api-key, or use browser-safe tokens for client apps.
  • For STT, map query params into setup and json_config.
  • For STT WebSocket, wrap audio bytes as base64 JSON messages.
  • For TTS, replace provider voice/model names with a Gradium voice_id.
  • For TTS WebSocket, send a Gradium setup message before text.
  • Replace provider finality fields with Gradium end_text, step, and flushed handling.
  • Keep provider-specific features such as diarization behind adapter capability checks.

Next steps

Gradium STT WebSocket guide

Real-time audio streaming, semantic VAD, and flush.

Turn-taking recipe

Replace endpointing and speech-final logic with Gradium VAD.

Gradium TTS WebSocket guide

Streaming text-to-speech over WebSocket.

WebSocket Lifecycle

Setup, ready, input, flush, end, multiplexing, and errors.