Skip to main content
Modellix Live is a WebSocket passthrough for real-time models such as Gemini Live. Open one connection, stream audio, video frames, and text in, and receive spoken or text replies as they are generated. Authentication, balance checks, and billing are handled by Modellix; the message format is the same as the upstream Live API.
Live is a long-lived WebSocket session. It does not use the async task flow of Media Models (https://api.modellix.ai task polling) or the HTTP request and response model of LLM (https://llm.modellix.ai).

What You Get

Native Live protocol

Frames are forwarded verbatim in both directions. Only setup.model is rewritten by the gateway, so official Live client code works with a URL and key change.

One API key

Authenticate with Authorization: Bearer using a Modellix key from the console—not a vendor credential.

Per-turn billing

Each completed turn is billed from the upstream token usage, split by input and output modality.

Multimodal input

Send text, 16 kHz PCM audio, and JPEG video frames in one session.

Base URL and Auth

Only the Authorization header is accepted. Do not pass the key in the URL query string.
Browsers cannot set custom headers on a WebSocket handshake. Connect from your backend, or from a client runtime that supports request headers.

Supported Models

Each model has its own page with a quick start, request parameters, returned messages, formats, limits, and examples.

Session Flow

1

Open the Connection

Connect with the Authorization header. If the handshake fails, you get an HTTP status instead of a WebSocket (see Handshake Errors).
2

Send Setup

The first frame must be a setup message and must arrive within 30 seconds. Configure response modalities, voice, system instruction, transcription, and session options here. Wait for setupComplete.
3

Stream Input

Send realtimeInput messages with text, audio, or video. Replies stream back as serverContent frames.
4

Turn Complete

When the model finishes, serverContent.turnComplete arrives together with usageMetadata. That turn is billed.
5

Close

Close the WebSocket normally (code 1000) when you are done.

Billing

  • Per turn. Each turnComplete produces one billing record. The record is based on the token usage reported for that turn.
  • By modality. Input text, image, video, and audio, and output text, audio, and video, are priced separately. Thinking tokens are billed at the output text rate. Unit prices and invoices follow the console.
  • Context is billed again each turn. The upstream model includes the accumulated conversation in each turn, so later turns in a long session cost more. Use context window compression for long sessions; see Sessions and Limits.
  • Incomplete turns. If a connection ends in the middle of a turn, the usage received so far is billed.
  • Balance. The session starts only with sufficient balance. If the balance runs out mid-session, the connection is closed with code 4402 after the current turn at the latest.

Errors

Handshake Errors

Failures before the WebSocket upgrade return an HTTP status with the same JSON error body as the Media API:
  • code (integer) equals the HTTP status code.
  • message (string) is formatted as "<Category>: <detail>".

Close Codes

After the connection is open, the server ends a session with a WebSocket close code and a short reason. Close codes sent by the upstream model are passed through to you.

Keepalive

The server sends a WebSocket ping every 30 seconds and closes a connection that stops answering. Standard WebSocket libraries reply with a pong automatically. Do not disable it, and keep your event loop responsive while playing audio.

Limits

  • Messages larger than 16 MiB are rejected with 1009.
  • Upload rate is limited per connection. Send video at 1 frame per second and audio in real time to stay far below the limit; exceeding it closes the connection with 1008.
  • Concurrent sessions are limited per team. Exceeding the limit returns 429 on the handshake.
  • A session that is idle still counts toward the concurrent limit. Close connections you no longer use.

Next Steps

Gemini 3.8 Live

Quick start, request parameters, returned messages, and examples.

Get an API Key

Create a Modellix API key in the console.