# Gemini 2.5 Flash Live Model id on AIHubMix: `gemini-2.5-flash-live` Create an API key: https://console.aihubmix.com/?utm_source=llms-agent&utm_medium=model-llms > Gemini 2.5 Flash Live is Google's multimodal AI model for real-time interactions, supporting low-latency voice conversations and able to understand user input by combining text, images, or video. - Developer: Google - Session kind: Gemini Live — a native Google BidiGenerateContent WebSocket, not an HTTP request - Supports: voice (text or audio in, spoken audio out) - Input modalities: text, image, audio, video - Pricing: see https://aihubmix.com/model/gemini-2.5-flash-live (billed per modality: text and audio tokens) ## Endpoint (base URL: https://aihubmix.com) - `GET wss://aihubmix.com/ws/google.ai.generativelanguage.v1beta.GenerativeService.BidiGenerateContent?model=gemini-2.5-flash-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-2.5-flash-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-2.5-flash-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()) ``` 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 - `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-2.5-flash-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-2.5-flash-live/llms.txt