Realtime API
Realtime API
WSS /v1/realtime?model={model}&intent={intent}
WebSocket endpoint for real-time bidirectional audio streaming. Proxies to OpenAI's Realtime API.
Connection
const ws = new WebSocket(
"wss://api.osmapi.com/v1/realtime?model=gpt-realtime",
{
headers: {
"Authorization": "Bearer $OSM_API_KEY"
}
}
);Note: The gateway adds the
OpenAI-Beta: realtime=v1header automatically.
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Yes | gpt-realtime or gpt-realtime-mini |
intent | string | No | transcription for transcription-only mode |
Models
| Model | Text Price | Audio Price |
|---|---|---|
gpt-realtime | $4/$16 per 1M tokens | $32/$64 per 1M audio tokens |
gpt-realtime-mini | $1/$4 per 1M tokens | $8/$16 per 1M audio tokens |
Transcription Mode
For streaming transcription only (no conversation):
const ws = new WebSocket(
"wss://api.osmapi.com/v1/realtime?model=gpt-realtime&intent=transcription"
);Authentication
Pass your OSM API key as a Bearer token in the WebSocket connection headers.
See the Realtime feature guide for detailed usage examples.
How is this guide?