XRToken API Docs

Realtime voice conversations (WebSocket)

API Configuration
After saving, the Try It panel below sends real requests with this key.
Base: api.xrtoken.ai

Connect to wss://api.xrtoken.ai/v1/realtime?model=xai/grok-voice-3.0 after the channel is enabled. Server clients use Authorization: Bearer <key>; browsers use the WebSocket protocols ["xrtoken.bearer", "<key>"]. Never put a key in the URL.

Grok Voice 3.0 uses native xAI JSON events: send session.update with voice, instructions, and turn_detection: {"type":"server_vad"}, then send base64 PCM16 using input_audio_buffer.append. Default audio is 24 kHz mono. Receive response.output_audio.delta and response.output_audio_transcript.delta. Interruptions and client-side function tools are supported. Manual turns, session resumption and separately billed server-side tools are not supported in this release.

Automatic voice sessions are billed by duration including pauses, plus text conversation.item.create messages. Function results and audio items are exempt from the text fee. Funds are reserved before connecting and unused funds are released at settlement. max_duration_seconds is 1–600 (default 600); max_text_messages is 0–100 (default 20). The voice-only browser experience sets the text limit to 0. These gateway limits are not forwarded upstream. Missing credentials or pricing returns 503.

doubao-realtime continues to use the Volcengine binary protocol and token billing.

GET
/v1/realtime

Authorization

BearerAuth
AuthorizationBearer <token>

API key authentication (OpenAI format). Pass in the Authorization header:

Authorization: Bearer tr-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

In: header

Query Parameters

model*string
max_duration_seconds?integer
Default600
Range1 <= value <= 600
max_text_messages?integer
Default20
Range0 <= value <= 100

Response Body

application/json

application/json

curl -X get "https://api.xrtoken.ai/v1/realtime?model=string"
Empty
{
  "error": "invalid or missing API key",
  "type": "auth_error"
}
{
  "error": "insufficient balance -- please top up or upgrade your plan",
  "type": "billing_error"
}
Empty