Speech-to-speech API · v1
Build realtime voice on one contract.
VoiceOpenRouter gives your server one provider-independent session API, a stable realtime event protocol, and explicit usage boundaries.
Quickstart
Create a session, attach the returned WebSocket, and stream public PCM audio.
curl https://api.voiceopenrouter.com/v1/voice/sessions \
-H "Authorization: Bearer $VR_SK" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: demo-session-001" \
-d '{
"model": "xai/grok-voice-latest",
"mode": "speech_to_speech"
}'List models
Choose a model id from GET /v1/models.
Create a session
Reserve the bounded preauthorization and receive a realtime URL.
Attach and stream
Connect with vor-realtime-v1 and send JSON events.
The public contract
These invariants are shared across the HTTP and realtime surfaces.
Bearer auth
Authenticate HTTP and WebSocket requests with the same server-side VR_SK.
Raw PCM audio
Use 24 kHz mono PCM16LE. Audio frames are base64 inside JSON events.
Create then attach
Create a session before upgrading /v1/realtime?session_id=... .
Stable events
Use vor-realtime-v1 event types and terminal response.done usage fields.
Reference map
Jump directly to the surface you are implementing.
Compatibility boundary
Local and provider environments have different evidence levels.
- The public contract never exposes a provider URL, key, event protocol, or binary header.
- Local/mock behavior proves contract behavior, not provider availability or production readiness.
- The legacy direct realtime path remains only as a compatibility alias for existing callers.