Skip to main content
GPT Realtime Translate turns a live speech stream into speech in another language, with text transcripts alongside. Each session has one output language. It translates only: it has no conversations, tools, or response.create.

WSS

wss://api.modellix.ai/api/v1/live/openai/gpt-realtime-translate
For authentication, handshake errors, and close codes shared by all Live models, see the Live Overview.

Quick Start

Prepare a mono, 16-bit PCM WAV file at 24 kHz with at least a few seconds of speech and set MODELLIX_API_KEY. Save the following code as translate.py and run python translate.py speech.wav es. The script prints the translated text and saves the translated speech as raw PCM in translated.pcm.
Python

Client Messages

Send every message as a text JSON frame. Binary frames, non-JSON text, and non-object JSON close the connection with 1008 and reason invalid translation audio.

session.update

Send session.update after session.created. The session type and model cannot change. The following fields belong inside session.
string
Target language for translated audio and transcripts, such as es. Create one session per output language. OpenAI does not publish a full list of language codes in its translation guide.
object | null
Noise reduction with type (near_field for close-talking microphones, far_field for laptop or room microphones) and strength (0 to 1, default 1). Use null to turn it off.
null
Attached input transcription is not available through Modellix. Only null is accepted; any other value closes the connection with 1008. To transcribe speech, use GPT Live Transcribe or GPT Realtime Whisper on their own endpoints.

session.input_audio_buffer.append

Appends source audio. Keep sending throughout the session, including silence between phrases.
string
required
Base64-encoded raw 24 kHz, PCM16, mono, little-endian audio, with no container header. The decoded length must be even. Invalid base64 or an odd length closes the connection with 1008 and reason invalid translation audio; the audio is not forwarded.OpenAI recommends 200 ms chunks, which is 9,600 bytes before encoding.

session.close

Tells the service to flush pending input and output. Stop sending audio first, then keep reading until session.closed. Closing the WebSocket earlier can drop output, and Modellix does not forward audio sent after session.close.

Server Messages

Server events are forwarded unchanged.
event
The first event on a connection. Wait for it before sending session.update.
event
The session configuration after a session.update.
event
Translated audio. delta is base64-encoded. format is pcm16, sample_rate defaults to 24000, channels defaults to 1, and elapsed_ms is optional.
event
Translated text in delta, with optional elapsed_ms. A very short clip can return translated audio with no transcript text.
event
The final event after session.close. It carries no usage. If the socket closes before this event, treat the session as incomplete.
event
An upstream error with error.message, error.type, error.code, and error.param.

Billing

This model reports no usage in its events, so Modellix bills the audio you send. Seconds are the decoded bytes successfully forwarded upstream, divided by 48,000, and are charged from the per-minute price without rounding up to a whole minute. Unit prices and invoices follow the console.
  • Silence counts, gaps do not. Silence you send is audio. Time when you send nothing is free, even with the connection open.
  • Not billed. Audio rejected with 1008, a frame that fails to reach the upstream, audio sent after session.close, and sessions with no audio.
  • Not used for billing. elapsed_ms, output audio length, and connection time.
  • Multiple records per session. Modellix seals a billing record for every 60 seconds of input audio. The remainder is settled when the session closes. If the session ends without session.closed, that remainder is recorded as incomplete and is still billed.
You can inspect usage and the charged amount in the console’s Live request records.

Sessions and Limits

  • WebSocket only. WebRTC, browser client secrets, and other upstream HTTP endpoints are not available through Modellix.
  • Rooms with several speakers need about one session per active speaker track and target language.
  • Other event types are forwarded unchanged and validated by the upstream. Only audio in session.input_audio_buffer.append counts toward billing.
  • Modellix closes any connection at its maximum connection duration with code 4408.
See the OpenAI translation guide, the client events reference, and the server events reference for protocol details.