Skip to main content

Realtime Speech-to-Text

GET 

wss://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​

NameTypeRequiredDescription
model_idStringNoDefault scribe_v2_realtime. Must be a realtime STT model.
language_codeStringNoHint for recognition.
audio_formatStringNopcm_8000, pcm_16000, pcm_22050, pcm_24000, pcm_44100, pcm_48000, ulaw_8000.
commit_strategyStringNomanual or vad.
enable_loggingBooleanNoDefault true.
include_timestampsBooleanNoInclude word timings on transcripts.
include_language_detectionBooleanNoInclude language detection events.

Auth: Authorization: Bearer, xi-api-key, or (browser) ?authorization= / ?api_key=. Upgrade: websocket is required.

Request Headers​

NameTypeRequiredDescription
AuthorizationStringYesBearer <token> Knox API key. xi-api-key is also accepted.
UpgradeStringYesMust 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 segment
  • committed_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" }.

StatusWhen
400WebSocket path called without Upgrade: websocket.
401Missing or invalid API key.
402Insufficient credits.
403Token is not allowed to use this model.
404Resource not found.
422Validation error.
429Rate limit exceeded.
500Internal server error.