Realtime Speech-to-Text
GETwss://api.knoxstudio.ai/v1/speech-to-text/realtime
Low-latency streaming transcription (~150ms). Default model scribe_v2_realtime at $0.44/hour. GET and POST accept the WebSocket upgrade. Plain HTTP returns 400. Do not put credentials in JSON bodies; Knox strips xi-api-key.
Request
Query Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| model_id | String | No | Default scribe_v2_realtime. Must be a realtime STT model. |
| language_code | String | No | Hint for recognition. |
| audio_format | String | No | pcm_8000, pcm_16000, pcm_22050, pcm_24000, pcm_44100, pcm_48000, ulaw_8000. |
| commit_strategy | String | No | manual or vad. |
| enable_logging | Boolean | No | Default true. |
| include_timestamps | Boolean | No | Include word timings on transcripts. |
| include_language_detection | Boolean | No | Include language detection events. |
Auth: Authorization: Bearer, xi-api-key, or (browser) ?authorization= / ?api_key=. Upgrade: websocket is required.
Request Headers
| Name | Type | Required | Description |
|---|---|---|---|
| Authorization | String | Yes | Bearer <token> Knox API key. xi-api-key is also accepted. |
| Upgrade | String | Yes | Must be websocket. |
Client messages
{
"message_type": "input_audio_chunk",
"audio_base_64": "<base64 pcm>",
"commit": false,
"sample_rate": 16000
}
Set commit: true (or send a commit message) when commit_strategy=manual. VAD commits automatically.
Server messages
partial_transcript— interim text for the current segmentcommitted_transcript— stable text for that segment
Billing starts after committed audio is observed.
Example
const ws = new WebSocket(
"wss://api.knoxstudio.ai/v1/speech-to-text/realtime?model_id=scribe_v2_realtime&audio_format=pcm_16000&commit_strategy=vad"
);
ws.onopen = () => {
ws.send(JSON.stringify({
message_type: "input_audio_chunk",
audio_base_64: pcmChunk,
commit: false,
sample_rate: 16000
}));
};
Error Responses
Validation uses HTTP 422:
{
"detail": [
{
"loc": ["body", "field"],
"msg": "…",
"type": "value_error"
}
]
}
Other errors use { "detail": "message" }.
| Status | When |
|---|---|
400 | WebSocket path called without Upgrade: websocket. |
401 | Missing or invalid API key. |
402 | Insufficient credits. |
403 | Token is not allowed to use this model. |
404 | Resource not found. |
422 | Validation error. |
429 | Rate limit exceeded. |
500 | Internal server error. |