Output
Response Format
The API returns JSON objects containing transcription results in real-time.
Success Response
Complete Segment
{
"uid": "client-identifier",
"segments": [
{
"start": "0.000",
"end": "2.500",
"text": "Hello world, this is a test.",
"completed": true,
"segment_id": "seg_001",
"rev": 1
}
],
"language": "en",
"language_probability": 0.95
}Partial Segment
{
"uid": "client-identifier",
"segments": [
{
"start": "0.000",
"end": "1.200",
"text": "Hello",
"completed": false,
"segment_id": "seg_001",
"rev": 1
}
]
}Response Fields
| Field | Type | Description |
|---|---|---|
| uid | string | Client identifier for the session |
| segments | array | Array of transcription segments |
| segments[].start | string | Start time in seconds (3 decimals) |
| segments[].end | string | End time in seconds (3 decimals) |
| segments[].text | string | Transcribed text content |
| segments[].completed | boolean | true if final, false if partial |
| segments[].segment_id | string | Unique segment identifier |
| segments[].rev | integer | Revision number |
| language | string | Detected or specified language |
| language_probability | float | Confidence score (0–1) |
Understanding Segment Updates
You'll receive transcription results in real-time as the audio is processed:
- Partial segments (
completed: false) as speech is being processed - Complete segments (
completed: true) when speech boundaries are detected - Updated segments with the same
segment_idbut higherrevnumber if corrections are made
Example flow:
// First update (partial)
{ "segment_id": "seg_001", "text": "Hello", "completed": false, "rev": 1 }
// Second update (still partial, more text)
{ "segment_id": "seg_001", "text": "Hello world", "completed": false, "rev": 2 }
// Final update (complete)
{ "segment_id": "seg_001", "text": "Hello world", "completed": true, "rev": 3 }Working with Results
Display only completed segments:
def on_message(ws, message):
result = json.loads(message)
if result.get('segments'):
for segment in result['segments']:
if segment['completed']:
print(f"[{segment['start']}s - {segment['end']}s]: {segment['text']}")Track segment revisions:
const segments = new Map();
function handleResult(result) {
if (result.segments) {
result.segments.forEach(segment => {
const existing = segments.get(segment.segment_id);
if (!existing || segment.rev > existing.rev) {
segments.set(segment.segment_id, segment);
}
});
}
}Check language detection confidence:
if result.get('language_probability'):
prob = result['language_probability']
lang = result['language']
if prob > 0.9:
print(f"Confident detection: {lang}")
elif prob > 0.7:
print(f"Moderate confidence: {lang} ({prob:.2%})")
else:
print(f"Low confidence: {lang} ({prob:.2%})")