# Gemini 3.8 Live Model id on AIHubMix: `gemini-3.8-live` Create an API key: https://console.aihubmix.com/?utm_source=llms-agent&utm_medium=model-llms > Gemini 3.8 Live is a multimodal AI model from Google that delivers a low-latency, audio-to-audio voice interaction experience, enabling real-time conversations without inference delays. It supports interleaved reasoning, asynchronous and synchronous function calling, and built-in proactive audio processing capabilities. - Developer: Google - Session kind: Gemini Live — a native Google BidiGenerateContent WebSocket, not an HTTP request - Supports: voice (text or audio in, spoken audio out); video input (JPEG camera frames); a prebuilt talking avatar (MP4 video out) - Input modalities: text, image, audio, video - Pricing: see https://aihubmix.com/model/gemini-3.8-live (billed per modality: text, audio, image and video tokens) ## Endpoint (base URL: https://aihubmix.com) - `GET wss://aihubmix.com/ws/google.ai.generativelanguage.v1beta.GenerativeService.BidiGenerateContent?model=gemini-3.8-live` — Gemini Live over WebSocket (the v1 path `/ws/google.ai.generativelanguage.v1.GenerativeService.BidiGenerateContent` works too). - Auth: `x-goog-api-key: $AIHUBMIX_API_KEY` or `Authorization: Bearer $AIHUBMIX_API_KEY` on the handshake. Never `?key=` — it is rejected. - Model: `?model=gemini-3.8-live` in the URL, or the `X-Aihubmix-Model` header. The official Python SDK (google-genai) omits the model from the URL, so pass the header via `http_options` as shown below. - Frames are Google's native Live protocol: send `setup` first, wait for `setupComplete`, then `realtimeInput` / `clientContent`. Not supported for this model: `/v1/chat/completions`, `/v1/messages`, `/v1/responses` and `:generateContent` (400 "not supported in the generateContent API"), nor `/v1/realtime`, which is the OpenAI Realtime protocol (403 `realtime_channel_unavailable`). ## Example ### Voice Send one sentence, get a spoken reply (saved as `reply.wav`) plus its text transcript. ```python import asyncio import os import wave from google import genai MODEL = "gemini-3.8-live" client = genai.Client( api_key=os.environ["AIHUBMIX_API_KEY"], http_options={ "base_url": "https://aihubmix.com", # The SDK leaves the model out of the Live URL; the gateway reads it from this header. "headers": {"X-Aihubmix-Model": MODEL}, }, ) config = { "response_modalities": ["AUDIO"], # Also stream back a text transcript of the spoken reply. "output_audio_transcription": {}, } async def main(): async with client.aio.live.connect(model=MODEL, config=config) as session: await session.send_realtime_input(text="Hello, how are you?") # Reply audio is 16-bit PCM, 24 kHz, mono. with wave.open("reply.wav", "wb") as wf: wf.setnchannels(1) wf.setsampwidth(2) wf.setframerate(24000) async for message in session.receive(): content = message.server_content if content and content.output_transcription: print(content.output_transcription.text or "", end="", flush=True) if message.data: wf.writeframes(message.data) if content and content.turn_complete: break print() asyncio.run(main()) ``` ### Video Send JPEG frames (about 1 FPS, each up to ~190 KB) before asking. A single frame sent right before the question is not seen by the model. ```python import asyncio import os from google import genai from google.genai import types MODEL = "gemini-3.8-live" client = genai.Client( api_key=os.environ["AIHUBMIX_API_KEY"], http_options={ "base_url": "https://aihubmix.com", # The SDK leaves the model out of the Live URL; the gateway reads it from this header. "headers": {"X-Aihubmix-Model": MODEL}, }, ) config = { "response_modalities": ["AUDIO"], # Print a text transcript of the spoken reply. "output_audio_transcription": {}, } async def main(): # A camera frame: JPEG only, up to ~190 KB (768x768 is plenty). with open("frame.jpg", "rb") as f: frame = f.read() async with client.aio.live.connect(model=MODEL, config=config) as session: # Video is a stream of frames at about 1 FPS; send a few before asking. for _ in range(3): await session.send_realtime_input(video=types.Blob(data=frame, mime_type="image/jpeg")) await asyncio.sleep(1) await session.send_realtime_input(text="Describe what you see in one sentence.") async for message in session.receive(): content = message.server_content if content and content.output_transcription: print(content.output_transcription.text or "", end="", flush=True) if content and content.turn_complete: break print() asyncio.run(main()) ``` ### Avatar `response_modalities` must be exactly `["VIDEO"]`; only prebuilt avatars (`avatar_name`) are accepted. The reply arrives as `video/mp4` chunks (H.264 + AAC) — append them in order to get one playable MP4. ```python import asyncio import os from google import genai MODEL = "gemini-3.8-live" client = genai.Client( api_key=os.environ["AIHUBMIX_API_KEY"], http_options={ "base_url": "https://aihubmix.com", # The SDK leaves the model out of the Live URL; the gateway reads it from this header. "headers": {"X-Aihubmix-Model": MODEL}, }, ) config = { # A talking avatar needs exactly ["VIDEO"]. "response_modalities": ["VIDEO"], "avatar_config": {"avatar_name": "Ben"}, "speech_config": {"voice_config": {"prebuilt_voice_config": {"voice_name": "Puck"}}}, "output_audio_transcription": {}, } async def main(): async with client.aio.live.connect(model=MODEL, config=config) as session: await session.send_realtime_input(text="Hello, how are you?") # The avatar arrives as video/mp4 chunks (H.264 + AAC); appended in order they form one MP4. with open("avatar.mp4", "wb") as f: async for message in session.receive(): content = message.server_content if content and content.output_transcription: print(content.output_transcription.text or "", end="", flush=True) if content and content.model_turn: for part in content.model_turn.parts or []: if part.inline_data and (part.inline_data.mime_type or "").startswith("video/"): f.write(part.inline_data.data) if content and content.turn_complete: break print() asyncio.run(main()) ``` Install: `pip install google-genai`. For Node, use the `ws` package with the same URL, headers and camelCase frames (`setup`, `realtimeInput`). ## Response Gemini Live is an **event stream over one WebSocket**, not a JSON body. Read `serverContent` messages until `turnComplete`: - `serverContent.modelTurn.parts[].inlineData` — reply media: base64 PCM16 / 24kHz / mono audio, or `video/mp4` chunks for an avatar - `serverContent.outputTranscription.text` — text transcript of the spoken reply (when `outputAudioTranscription` is enabled in `setup`) - `serverContent.turnComplete` — the model finished this turn - `usageMetadata` — token usage per modality ## Errors Errors during the WebSocket handshake come back as a plain HTTP response with a JSON `error` body (`code` + `message`). Once the session is open, a rejected frame closes the socket. - 400 `missing_model_parameter` — neither `?model=` nor the `X-Aihubmix-Model` header was sent - 400 `query_api_key_not_supported` — the key was put in `?key=`; send it in `x-goog-api-key` or `Authorization: Bearer` instead (this is why the JavaScript `@google/genai` SDK, which uses `?key=`, does not work here — use a raw WebSocket) - 401 — the key is invalid or expired - 403 `insufficient_user_quota` — starting a Gemini Live session needs an available account balance of at least $10 (top up at https://console.aihubmix.com/?utm_source=llms-agent&utm_medium=model-llms) - 403 `realtime_payer_not_supported` — Gemini Live currently requires a personal API key billed to its owner Reference: https://docs.aihubmix.com/en/FAQs/HTTP-Codes.md ## More - Model page (same examples in Python and TypeScript): https://aihubmix.com/model/gemini-3.8-live - Site index for agents: https://aihubmix.com/llms.txt · Onboarding: https://aihubmix.com/agents.md --- Canonical version of this document: https://aihubmix.com/model/gemini-3.8-live/llms.txt