Skip to main content
Vapi is a platform for building and deploying voice agents, handling telephony, web transport, LLM calls, and turn-taking. Gradium is not a built-in Vapi provider, so you connect it through Vapi’s custom endpoints: a custom-voice webhook for speech output and a custom-transcriber WebSocket for speech input. You run a small bridge service, and Vapi keeps managing the rest of the call.

Gradium TTS guide

Gradium WebSocket TTS setup and streaming behavior.

Gradium STT guide

Gradium WebSocket STT, VAD, and flushing.

Turn-taking

Tune semantic VAD horizons and thresholds.

Vapi dashboard

Sign up for Vapi and create an assistant.
You need a Vapi account and a Gradium API key. This page is the reference for the Gradium side of the integration: the endpoint contracts, the bridge code, and the tuning options.

How Gradium connects

You can use either side on its own. Keeping Vapi’s built-in transcriber while using Gradium for speech output is a valid setup, and vice versa.

Install

Set your Gradium API key in the environment:

Text to speech

Vapi posts one request per sentence, carrying the text and the sample rate it expects:
Read message.sampleRate and pass it straight through as Gradium’s output_format. Vapi expects raw 16-bit little-endian mono PCM at exactly the rate it asked for, streamed as it is produced.
Every sample rate Vapi requests has a matching Gradium PCM format, so no resampling is needed. See Limits for the full format list.
Point the assistant’s voice at the endpoint:

Speech to text

Vapi opens a WebSocket, sends a JSON start frame, then streams interleaved 16-bit PCM. When channels is 2, channel 0 carries the caller and channel 1 carries the assistant — forward only channel 0, or the agent transcribes its own speech.
Send partial transcripts as well as final ones — Vapi needs to see speech while it is happening for barge-in to work. Treat flushed as the end of the turn rather than finalizing the moment the VAD threshold is crossed, because Gradium is still holding audio in its decoding window. See Turn-Taking with Semantic VAD for tuning the horizon and threshold. Point the assistant’s transcriber at the bridge over wss:

Secure the endpoints

Both endpoints are public HTTP surfaces. Set a secret on the server object in the assistant config, and Vapi sends it as an X-Vapi-Secret header on every request. Reject anything that does not match:

Configuration

Reduce latency with multiplexing

Vapi posts one custom-voice request per sentence, so a fresh WebSocket per request pays connection setup several times per agent reply. Keep one connection open per sample rate and route concurrent requests over it with close_ws_on_eos: false and a per-request client_req_id. Recycle pooled connections before the session limit, and fall back to a single-use connection if a pooled socket closes before it produces audio. See Multiplexing for the full contract.

Let Gradium decide when the turn ends

By default Vapi runs its own endpointing on your partial transcripts, which can race Gradium’s VAD and make the assistant reply before the flushed final arrives. Hand the decision to Gradium with a custom endpointing model:
Vapi then posts a call.endpointing.request on every transcript update, and your server answers with how long to keep waiting based on the live Gradium session:
Clear your reference to the Gradium session when a call ends. If a finished session stays registered, the first endpointing requests of the next call are answered from stale turn state.

Long calls

A single Gradium session lasts up to 300 seconds. Reconnect the Gradium session transparently when one ends while keeping Vapi’s socket open, so calls of any length keep transcribing. See Limits.

When to use Vapi with Gradium

  • Telephony agents: let Vapi manage phone numbers, SIP, and call routing while Gradium handles speech.
  • Swapping speech providers: keep an existing Vapi assistant, LLM, and tools, and change only the voice or transcriber layer.
  • Custom voices: use an instantly cloned Gradium voice in a Vapi agent. See Voices.
  • Domain vocabulary: improve recognition of menu items, brand names, and product terms with Keyword Boosting and Text Rewriting Rules.