Skip to content
Rapid Router
← API reference

Voice pipeline

Part of the Rapid Router API reference. One OpenAI-compatible endpoint, https://rapidrouter.ai/api/v1, in front of every model in the catalog.

09Voice pipeline

One call, audio in, spoken answer out. POST /v1/voice/chat transcribes your audio, runs the transcript through the chat model of your choice, and speaks the reply back, returning the transcript, the reply text and the reply audio as base64 in a single response. Send the audio as a multipart/form-data file or as base64 JSON; audio up to 15MB, non-stream only.

curl https://rapidrouter.ai/api/v1/voice/chat \
  -H "Authorization: Bearer $RAPIDROUTER_API_KEY" \
  -F "file=@question.mp3;type=audio/mpeg" \
  -F "model=google/gemini-flash-latest" \
  -F "voice=tara" \
  -F "system=Answer in one short sentence."

# Optional fields: tts_model, stt_model, max_tokens,
# response_format (mp3, wav, ...), language (Sarvam TTS).

Models. model is the chat model (any chat model in the catalog). stt_model and tts_model pick specific media models from GET /v1/media/models; leave them out and the cheapest configured model of each kind is used. voice and response_format pass through to the TTS stage.

Billing. Each stage bills itself through its normal path, so your usage log shows three lines: the STT call per minute (or per request), the chat call per token, and the TTS call per character of the reply. The response's usage reports each stage's cost and the total. If a stage fails, the error code names it (voice_stt_failed, voice_chat_failed, voice_tts_failed) and error.billed_stages lists the stages that were already billed; audio that transcribes to silence answers 422 with only the STT stage billed.

A bidirectional realtime WebSocket voice API (stream audio in, stream audio out) is planned; this endpoint is the request-response version.