AGTCloud API Docs
GuidesAPI ReferenceIntegrations and resourcesUpdate and help
Realtime

Realtime transcription

Continuously send audio over Realtime WebSocket and receive incremental and final transcripts.

Continuously send audio over WebSocket and receive text deltas and final segment results for captions, meeting notes and voice input.

ModelUsage
gpt-live-transcribeContinuously returns text deltas during audio input; suitable for realtime captions, without detected languages
gpt-transcribeStarts transcription after a speech segment is committed. Final results may include detected languages; returns an empty array when detection is unreliable
WSS
wss://api.agtcloud.cn/v1/realtime?model=MODEL_ID

Connection parameters

Session configuration

After session.created, send session.update with these fields in the session object. Wait for session.updated before sending audio.

Prepare and commit audio

ItemRequirement
Input formatPCM16 little-endian, 24 kHz, mono. Send raw audio without WAV or other container headers
Audio chunks20–100 ms per chunk is recommended; 100 ms is 4,800 bytes. A single append event must not exceed 15 MiB
Commit methodSet turn_detection: null; after input_audio_buffer.append, send input_audio_buffer.commit when the speech segment ends
Segmentation with gpt-live-transcribeDoes not support server_vad or semantic_vad; detect speech end on the client and commit manually
Discard the current segmentSend input_audio_buffer.clear and wait for input_audio_buffer.cleared; do not commit an empty buffer
Final resultAggregate deltas by item_id and replace temporary text with completed.transcript. Do not concatenate different speech segments by completion-event arrival order

Convert common audio formats to the raw PCM required by the examples:

ffmpeg -i input.mp3 -f s16le -acodec pcm_s16le -ac 1 -ar 24000 audio.pcm

The examples send 100 ms chunks and close after the current speech segment completes. Set API_KEY and MODEL_ID, install the WebSocket library for the selected language, and pass the PCM file path as an argument. For continuous microphone input, repeatedly append and commit speech segments.

Transcription hints and latency

FieldHow to set
promptBriefly describe the business scenario, recording environment and context
keywordsHints for proper names, abbreviations or products. Each item must not contain <, >, carriage returns or line breaks; hints do not guarantee verbatim output
languagesExpected language list, such as zh-cn and en. Supports common ISO 639-1, some ISO 639-3 and Chinese regional codes; do not also set language
delaygpt-live-transcribe latency levels: minimal, low, medium, high, xhigh. Higher levels can use more context; they do not represent fixed milliseconds
noise_reductionnear_field for headsets, far_field for distant microphones, and null to disable noise reduction

These transcription settings are under session.audio.input. gpt-live-transcribe does not return word-level timestamps, speaker labels or transcription confidence.

Event Reference

Inspect fields and complete JSON by event. Use deltas for live display and final results for storage. Read returned usage from usage; its presence does not determine transcription success.

Event direction
Category
Event

session.update

Update supplied session fields and wait for session.updated acknowledgment.

Troubleshooting

SymptomResolution
Handshake failureCheck the platform WSS address, Bearer Key and model ID; do not duplicate /v1
No final textCheck that non-empty audio was appended and commit was sent; verify sample rate, bit depth, byte order and mono configuration
Transcription parameters rejectedCheck session.type, field nesting, keyword characters and language codes. Disable server VAD for gpt-live-transcribe
Audio speed or recognition is incorrectConvert again to raw 24 kHz PCM16 little-endian audio and remove container headers
Speech segments appear out of orderCorrelate using item_id, previous_item_id and the application's commit order, not completion-event arrival order
One segment failed transcriptionSave the failed Item ID and original segment; decide whether to resend that segment only
Connection lostStop sending and reconnect with bounded retries. Recreate the session and handle unacknowledged audio according to application records to avoid duplicate transcription

Native browser WebSocket cannot set an Authorization Header. Browser products should connect to the platform through a trusted backend and keep long-lived Keys on the server.

Official references