Generated banner for Gemini Live API
Generated logo for Gemini Live API

Gemini Live API

GoogleOfficialPublished by Google

  • Skill
  • Tool integration
  • Software development
  • Apache-2.0
  • Low risk

From the author

Generates a Gemini LiveAPI client service class in the user's chosen programming language. Use when the user wants to build, scaffold, or integrate a client that connects to the Gemini Enterprise LiveAPI websocket endpoint, handles session setup/resumption, bearer token refresh, and sending/receiving `ClientMessage`/`ServerMessage` protos. Don't use for general (non-live, non-bidirectional) Gemini API usage such as one-shot `generateContent`, embeddings, image/video generation, or fine-tuning — use the `gemini-api` skill for those.
— the description by Google

AutoGineer summary

Written by AutoGineer from the skill’s own files, not by the author

This skill provides a structured approach to generating a client service class for the Gemini Enterprise LiveAPI. It facilitates bidirectional streaming over WebSockets, handling session setup, authentication via Application Default Credentials, and the exchange of ClientMessage and ServerMessage protocol buffers. The skill also generates a demo application to validate the client, including support for audio, video, and text modalities, as well as handling interrupt signals and transcription streams.

What it does

  • Generates a client service class for the Gemini LiveAPI in the user's preferred language.
  • Implements WebSocket connection management with session setup and resumption logic.
  • Handles bearer token authentication using Application Default Credentials.
  • Provides async methods for sending realtime data and client content.
  • Creates a demo frontend and backend service to test multimodal interactions.
  • Includes documentation on how to run and test the generated client and UI.

When to use it

  • When building a client that requires bidirectional, low-latency communication with the Gemini LiveAPI.
  • When you need to handle continuous audio or video input streams.
  • When you need to implement session management, including resumption and token refreshing.
  • When you need a reference implementation for processing ServerMessage and ClientMessage protocol buffers.

Advantages

  • Automates the scaffolding of complex WebSocket-based client services.
  • Ensures adherence to the required LiveAPI wire-level protocol.
  • Provides a ready-to-use demo for validating multimodal input and output.
  • Encapsulates authentication and session lifecycle management logic.

Usage examples

“Generate a Python client for the Gemini LiveAPI.”
The agent creates a Python class with async methods for WebSocket communication, sets up a virtual environment, and provides a demo service to test the connection.
“How do I handle model interruptions in my LiveAPI client?”
The agent provides the implementation logic for monitoring the serverContent message for the interrupted flag and clearing stale audio buffers.

Install

  1. Download the skill as a ZIP:

    https://autogineer.com/agent-skills/google/gemini-live-api/download
  2. Unzip it into the cross-client skills folder of your project:

    mkdir -p .agents/skills && unzip gemini-live-api.zip -d .agents/skills

Documentation by Google

LiveAPI Service Skill

This skill provides instructions for generating a LiveAPI client service class that connects to the Gemini Enterprise Live API over WebSockets. The generated client handles bidirectional streaming, bearer-token authentication via Application Default Credentials (ADC), transparent session resumption, and ClientMessage / ServerMessage proto exchange.

The skill also produces a demo frontend + backend service so the user can interactively validate the generated client (text, audio, video, transcription, and interrupt handling).

Attribution

MUST READ: Before executing any gcloud, REST API, or MCP command, you MUST read Usage Attribution. For commands executed directly in the terminal (never in generated scripts, Terraform, or user code), prefix gcloud with CLOUDSDK_METRICS_REQUEST_ATTRIBUTION="agent-skills/1.0 (skill:gemini-live-api)" and append agent-skills/1.0 (skill:gemini-live-api) to User-Agent headers.

Prerequisites

Before running the generation flow, ensure the following are available on the host:

  • A Google Cloud project with the Vertex AI / Gemini Enterprise Agent Platform APIs enabled.

  • Application Default Credentials configured on the host running the generated client:

    gcloud auth application-default login
  • A destination output folder supplied by the user (e.g. /tmp/liveapi_out) where the generated code, environment, and demo will be written. Never mutate the host's system Python environment.

  • The user's chosen implementation language (Python is the default and reference language for this skill).

Reference Files

Provided files in references/ (do not treat these as standalone skills — they are loaded on demand):

  • client_server_messages.md: Public reference for the ClientMessage / ServerMessage schemas used by the Live API.

  • client_server_messages.proto: The proto definition generated from client_server_messages.md.

  • session_manager.md: Describes how to correctly handle sessions, buffering, and resumption on disconnection.

Steps

Step 1: Copy the reference files

Copy client_server_messages.md, client_server_messages.proto, and session_manager.md from this skill's references/ folder into the user's destination output folder. These files become the source of truth for the generated client.

Step 2: Reconcile with the public documentation

Examine the public documents linked from client_server_messages.md. If there are any discrepancies between the public documents and the copied client_server_messages.md / client_server_messages.proto, update the copies in the destination folder so the generated client compiles and runs against the current server contract.

Step 3: Implement the client class

Implement a class in the user's chosen language that:

  • Imports the local client_server_messages.proto types (ClientMessage, ServerMessage).

  • Opens a WebSocket connection to the Live API endpoint.

  • Exposes async methods so the user can send and receive data to/from the model.

For languages that require an isolated runtime (e.g. Python), create an isolated environment (e.g. venv) inside the destination folder and generate a bash script (e.g. setup.sh) that recreates the environment and installs dependencies. Never install into the system interpreter or the user's global site-packages, and never instruct the user to run sudo pip install.

Initialization parameters

The user provides the following at construction time:

  • project_id

  • location

  • model_id

  • config: a ClientMessage with the setup field populated.

Authentication

Obtain a bearer token via Application Default Credentials, attach it to the WebSocket connect request as Authorization: Bearer <token>, refresh the token before or upon expiry, and reuse the refreshed token on every reconnection (including go_away and unexpected disconnects). Do not hard-code a long-lived API key as the only auth mechanism.

Public async API

The class MUST expose the following async methods, gated on receipt of a setup_complete ServerMessage before sending:

  • send_realtime_data(data): send realtime input. data is a ClientMessage carrying a realtime_input field.

  • send_client_content(data): send non-realtime, turn-based content that contributes to history. data is a ClientMessage carrying a client_content field.

  • receive(): yield ServerMessage instances parsed from the WebSocket stream.

Do not expose synchronous blocking variants as the primary API surface.

Step 4: Write a test file

Once the client is implemented, generate a test file that initializes the connection and exercises sending text, audio, and video data and receiving the responses. Ask the user for any information required to run the test (project, model, media samples).

Step 5: Generate how_to_run.md

Provide a how_to_run.md in the destination folder that documents the generated class. Include full examples showing how to build ClientMessage payloads for every supported modality, how to send them, and how to receive data from the model.

Step 6: Generate a demo frontend + backend service

Create scripts that deploy the implementation as a service with both a frontend UI and a backend service (any language). The service MUST reuse the ClientMessage / ServerMessage protos from Step 1 for wire traffic. Through the UI the user should be able to:

  • Start a new connection / close the current connection.

  • Select the model to use.

  • Select input sources (audio and/or video from camera or screenshot) and stream them to the model.

  • Send a text message to the model.

  • Hear model audio and see the interleaved model and user transcription / conversation history.

While implementing audio and transcription playback, follow the guidance in Live API best practices.

Handling the interrupt signal

When a ServerMessage's server_content arrives with interrupted: true, the UI MUST:

  • Ensure played audio and its corresponding transcription remain time-aligned.

  • Immediately stop the currently playing model audio and stop appending to the in-progress transcription bubble.

  • Clear the unplayed audio buffer and any pending unrendered transcription so stale content does not bleed into the next turn.

  • Start new chat bubbles for the next user and model turns.

Handling the transcription finished signal

For streamed input_transcription / output_transcription chunks, append to the currently active bubble while finished is unset, and close that bubble and start a fresh one when finished is observed. Route input_transcription text to user-role bubbles and output_transcription text to model-role bubbles.

Step 7: Generate how_to_test_with_ui.md

Write how_to_test_with_ui.md describing how to launch and use the demo service. It MUST include:

  • The exact shell command(s) or script invocation(s) to start the backend service.

  • The exact shell command(s) or script invocation(s) to start the frontend UI.

  • The host and port (e.g. http://localhost:PORT) the user should open in their browser.

  • How to start a session, select a model, choose input sources (mic, camera, screen), send a text message, and observe model audio and transcription in the UI.

Validation Checklist

Before considering the generation complete, verify each item:

  • [ ] client_server_messages.md, client_server_messages.proto, and session_manager.md were copied into the destination folder.

  • [ ] The generated client imports the local proto-generated ClientMessage and ServerMessage types.

  • [ ] The client connects to the Live API WebSocket at wss://{location}-aiplatform.googleapis.com/ws/google.cloud.aiplatform.v1beta1.LlmBidiService/BidiGenerateContent (regional endpoint required; Live API models do not support the global endpoint), and formats the setup model field as projects/{project_id}/locations/{location}/publishers/google/models/{model_id}.

  • [ ] Authentication uses ADC-provided bearer tokens sent as Authorization: Bearer <token>, is refreshed before expiry, and reattached on every reconnect.

  • [ ] Public async methods send_realtime_data, send_client_content, and receive are present, correctly typed, and gated on setup_complete.

  • [ ] Transparent session resumption is enabled (session_resumption.transparent = true), the latest new_handle is tracked, sent-message indexing starts at 1, the buffer is pruned via last_consumed_client_message_index, and buffered messages are replayed on reconnect (including on go_away and WebSocket close codes 1000 / 1006).

  • [ ] If using python, an isolated environment (e.g. venv) plus a setup.sh and requirements.txt (or equivalent) exist inside the destination folder; no changes were made to system or user-global Python.

  • [ ] how_to_run.md and how_to_test_with_ui.md are present, and the demo UI reuses the same ClientMessage / ServerMessage protos.

  • [ ] Interrupt handling and transcription finished handling behave as described above.

  • [ ] The client does not target generativelanguage.googleapis.com and does not authenticate via API key in a query string.

Files

references/client_server_messages.md

Live API ClientMessage and ServerMessage Reference

This document describes the wire-level WebSocket protocol for the Gemini Enterprise Agent Platform Live API (BidiGenerateContent*).

Docs: https://docs.cloud.google.com/gemini-enterprise-agent-platform/reference/models/multimodal-live

The service exposes the RPC BidiGenerateContent. Search the corresponding website for more information.


1. Connection

Endpoints
BackendWebSocket URI
Gemini Enterprise Agent Platformwss://{LOCATION}-aiplatform.googleapis.com/ws/google.cloud.aiplatform.v1beta1.LlmBidiService/BidiGenerateContent
Gemini Enterprise Agent Platform (global)wss://aiplatform.googleapis.com/ws/google.cloud.aiplatform.v1beta1.LlmBidiService/BidiGenerateContent
Auth
  • Authorization: Bearer <ADC token> (or API key in Express mode).

Frames

All frames are JSON-serialized protobuf messages of either ClientMessage (client → server) or ServerMessage (server → client). Each frame is exactly one WebSocket text message.


2. Top-level structure (oneof)

ClientMessage and ServerMessage are both oneof envelopes — each frame sets exactly one of the listed fields.

ClientMessage (you → server)
FieldTypeWhen to use
setupBidiGenerateContentSetupFirst frame only. Configures the session.
clientContentBidiGenerateContentClientContentAppend to conversation history; turn-based input. Interrupts the model.
realtimeInputBidiGenerateContentRealtimeInputContinuous, low-latency audio/video/text input. Not added to history.
toolResponseBidiGenerateContentToolResponseReply to a server-issued toolCall.
ServerMessage (server → you)
FieldTypeMeaning
setupCompleteBidiGenerateContentSetupCompleteSent once after setup is accepted. Gate further sends on this.
serverContentBidiGenerateContentServerContentStreamed model output (audio/text), turn lifecycle.
toolCallBidiGenerateContentToolCallModel is requesting tool execution.
toolCallCancellationBidiGenerateContentToolCallCancellationCancels previously-issued tool calls (e.g. on user interruption).
usageMetadataUsageMetadataToken / duration accounting.
goAwayGoAwayConnection will be terminated soon.
sessionResumptionUpdateSessionResumptionUpdateResume handle for reconnects.

Audio transcriptions are delivered inside serverContent (see § 9), not as separate top-level frames.


3. Lifecycle

Client                                  Server
  │                                       │
  ├── ClientMessage{ setup }  ──────────► │
  │                                       │
  │ ◄──────  ServerMessage{ setupComplete }
  │                                       │
  ├── realtimeInput / clientContent ────► │
  │   (audio frames, text, etc.)          │
  │                                       │
  │ ◄──────  serverContent (audio chunks, modelTurn parts ...)
  │ ◄──────  serverContent { generationComplete: true }
  │ ◄──────  serverContent { turnComplete: true }
  │                                       │
  │ ◄──────  toolCall { functionCalls[] }
  ├── toolResponse { functionResponses[] } ► │
  │                                       │
  │ ◄──────  serverContent ...
  │ ◄──────  goAway { timeLeft }   (eventually)
  │                                       │
  │       (close & reconnect using sessionResumptionUpdate.newHandle)

Rules:

  1. The first frame must be setup. Do not send anything else until you receive setupComplete.

  2. Use clientContent for turn-based, history-affecting messages (e.g. a typed user message). Sending it interrupts any current model generation.

  3. Use realtimeInput for continuous audio/video. It does not go into history. Turn boundaries come from VAD (or from explicit activityStart/activityEnd if VAD is disabled).

  4. Reply to toolCall with toolResponse (never with clientContent).

  5. On goAway, reconnect using the most recent sessionResumptionUpdate.newHandle.


4. BidiGenerateContentSetup (setup)

Initial-and-only-once configuration for the session.

FieldTypeNotes
modelstring (required)projects/{p}/locations/{l}/publishers/google/models/{m}.
generationConfigGenerationConfigUnsupported sub-fields here: responseLogprobs, responseMimeType, logprobs, responseSchema, stopSequence, routingConfig, audioTimestamp.
systemInstructionContentText-only parts.
tools[]repeated ToolFunction declarations and built-ins (Search, code execution).
sessionResumptionSessionResumptionConfig{ handle?: string, transparent?: bool }. Provide handle to resume; omit to start a new resumable session.
contextWindowCompressionContextWindowCompressionConfig{ triggerTokens?: int64, slidingWindow?: { targetTokens?: int64 } }.
realtimeInputConfigRealtimeInputConfigSee below.
inputAudioTranscriptionAudioTranscriptionConfig{}.
outputAudioTranscriptionAudioTranscriptionConfig{}.
RealtimeInputConfig
FieldTypeNotes
automaticActivityDetectionAutomaticActivityDetectionUnset → server-side VAD enabled by default.
activityHandlingenumSTART_OF_ACTIVITY_INTERRUPTS (default) | NO_INTERRUPTION.
turnCoverageenumDefault TURN_INCLUDES_ALL_INPUT. Also TURN_INCLUDES_ONLY_ACTIVITY, TURN_INCLUDES_AUDIO_ACTIVITY_AND_ALL_VIDEO.
AutomaticActivityDetection
FieldTypeNotes
disabledboolIf true, you must send activityStart / activityEnd yourself.
startOfSpeechSensitivityenumSTART_SENSITIVITY_HIGH | LOW.
endOfSpeechSensitivityenumEND_SENSITIVITY_HIGH | LOW.
prefixPaddingMsint32Min speech duration to commit start-of-speech.
silenceDurationMsint32Min silence to commit end-of-speech.
GenerationConfig — Live-API-relevant subset

Fields most often used in setup.generationConfig:

FieldTypeNotes
responseModalities[]repeated enumTEXT | AUDIO. Pick one per session (mixing not supported). Default AUDIO.
temperaturefloat0.0–2.0.
topP, topK, maxOutputTokensvariousStandard sampling / length controls.
speechConfigSpeechConfigVoice / language — only effective when responseModalities=[AUDIO]. See below.
mediaResolutionenumMEDIA_RESOLUTION_LOW | MEDIUM | HIGH. Controls token-cost vs. quality of input images / video frames.
thinkingConfigThinkingConfig{ thinkingBudget?: int }. Only on models that support thinking (e.g. Gemini 2.5 Flash). Set thinkingBudget: 0 to disable.

Unsupported in Live setup.generationConfig: responseLogprobs, responseMimeType, logprobs, responseSchema, stopSequence, routingConfig, audioTimestamp.

SpeechConfig

Controls the voice the model speaks with. Only meaningful when responseModalities includes AUDIO.

FieldTypeNotes
voiceConfigVoiceConfigSingle-speaker voice. The Live API supports only single-speaker output.
languageCodestringBCP-47 (e.g. en-US, de-DE, ja-JP). Output language. Native-audio models auto-detect / switch on their own; for non-native-audio models, set this explicitly. See Languages supported.

Note on multi-speaker output: A Live API session has exactly one prebuiltVoiceConfig.voiceName. To approximate multiple speakers in a Live session, use prompt engineering inside systemInstruction or clientContent to have the single voice play different roles.

VoiceConfig
FieldTypeNotes
prebuiltVoiceConfigPrebuiltVoiceConfigSelects a named built-in voice.
PrebuiltVoiceConfig
FieldTypeNotes
voiceNamestringName of the prebuilt voice. 30 voices supported. See Voices supported below for the full list and references.
Voices supported

The Live API supports 30 prebuilt voices. Names are case-sensitive.

VoiceStyleVoiceStyleVoiceStyle
ZephyrBrightPuckUpbeatCharonInformative
KoreFirmFenrirExcitableLedaYouthful
OrusFirmAoedeBreezyCallirrhoeEasy-going
AutonoeBrightEnceladusBreathyIapetusClear
UmbrielEasy-goingAlgiebaSmoothDespinaSmooth
ErinomeClearAlgenibGravellyRasalgethiInformative
LaomedeiaUpbeatAchernarSoftAlnilamFirm
SchedarEvenGacruxMaturePulcherrimaForward
AchirdFriendlyZubenelgenubiCasualVindemiatrixGentle
SadachbiaLivelySadaltagerKnowledgeableSulafatWarm

Reference (authoritative voice list):

The available set may vary per model (e.g. native-audio vs. half-cascade models). If a voice is rejected during setup, the WebSocket closes instead of returning setupComplete.

Languages supported

The Live API supports 24 BCP-47 languages for speechConfig.languageCode:

ar-EG, bn-BD, de-DE, en-IN (bundled with hi-IN), en-US, es-US, fr-FR, hi-IN, id-ID, it-IT, ja-JP, ko-KR, mr-IN, nl-NL, pl-PL, pt-BR, ro-RO, ru-RU, ta-IN, te-IN, th-TH, tr-TR, uk-UA, vi-VN.

Reference: https://docs.cloud.google.com/gemini-enterprise-agent-platform/models/live-api/configure-language-voice#languages-supported

Native-audio models (e.g. gemini-live-2.5-flash-native-audio) can switch languages mid-conversation; for those, languageCode is optional and the model auto-detects. For non-native-audio models, set it explicitly.

Examples

Basic prebuilt voice:

{
  "setup": {
    "model": "...",
    "generationConfig": {
      "responseModalities": ["AUDIO"],
      "speechConfig": {
        "voiceConfig": {
          "prebuiltVoiceConfig": { "voiceName": "Aoede" }
        }
      }
    }
  }
}

Voice + output language pinned to German:

{
  "setup": {
    "model": "...",
    "generationConfig": {
      "responseModalities": ["AUDIO"],
      "speechConfig": {
        "voiceConfig": { "prebuiltVoiceConfig": { "voiceName": "Charon" } },
        "languageCode": "de-DE"
      }
    }
  }
}

Notes - speechConfig is silently ignored if responseModalities is ["TEXT"]. - voiceName is case-sensitive and model-specific. Sending an unknown name typically fails the setup (you'll see the WebSocket close instead of setupComplete). - speechConfig.languageCode controls output TTS language. - The Live API is single-speaker only.


5. BidiGenerateContentClientContent (clientContent)

Turn-based input. Append to history and (optionally) trigger generation.

FieldTypeNotes
turns[]repeated ContentConversation history + the latest user request.
turnCompleteboolIf true, server starts generating immediately.

Sending clientContent while the model is speaking interrupts it. Do not use clientContent to deliver FunctionResponses — use toolResponse.


6. BidiGenerateContentRealtimeInput (realtimeInput)

Continuous, low-latency input. Does not populate history. End-of-turn is derived from VAD (or activity events).

FieldTypeNotes
audioBlobTyped realtime audio. PCM
: : : 16-bit, 16 kHz mono input :
: : : (audio/pcm;rate=16000). :
videoBlobTyped realtime video frame
: : : (image/jpeg/png/webp), :
: : : should be sent at 1 fps. :
textstringRealtime text input.
mediaChunks[]repeated BlobDeprecated. Combined
: : : audio/video chunks. Prefer :
: : : the typed audio / video :
: : : / text fields instead. :
audioStreamEndboolMic turned off. Only valid
: : : with auto-VAD enabled. :
activityStartActivityStart (empty)Only when auto-VAD is
: : : disabled. :
activityEndActivityEnd (empty)Only when auto-VAD is
: : : disabled. :

Audio formats

  • Input: audio/pcm;rate=16000 (16 kHz, 16-bit signed PCM, mono, little-endian).

  • Output: 24 kHz, 16-bit signed PCM, mono.


7. BidiGenerateContentToolResponse (toolResponse)

FieldTypeNotes
functionResponses[]repeatedMatch FunctionCall.id from
: : FunctionResponse : the server. id is optional. :

8. BidiGenerateContentSetupComplete (setupComplete)

FieldTypeNotes
sessionIdstringServer-assigned session identifier.

Receipt of this message is the gate for sending any other client frame.


9. BidiGenerateContentServerContent (serverContent)

Primary streaming-output channel.

FieldTypeNotes
modelTurnContentStreamed model output parts (text and/or inlineData audio).
generationCompleteboolModel has finished generating; playback may still be flushing.
turnCompleteboolLogical end of turn.
interruptedboolGeneration was interrupted by client input — drop any queued audio playback.
groundingMetadataGroundingMetadataWhen grounding (e.g. Google Search) is used.
inputTranscriptionTranscription{ text?: string } — transcription of the user's spoken input. Requires inputAudioTranscription set in setup.
outputTranscriptionTranscription{ text?: string } — transcription of the model's spoken output. Requires outputAudioTranscription set in setup.

Playback note: audio chunks arrive inside modelTurn.parts[].inlineData with mimeType audio/pcm;rate=24000. Concatenate as they stream. On interrupted: true, flush the playback queue.


10. BidiGenerateContentToolCall (toolCall)

FieldTypeNotes
functionCalls[]repeated FunctionCallEach has id, name, args. Reply with a matching FunctionResponse.id.

11. BidiGenerateContentToolCallCancellation (toolCallCancellation)

FieldTypeNotes
ids[]repeated stringIDs of previously-issued tool calls to cancel. Typically caused by user interruption. Stop the work; do not send toolResponse for these.

12. GoAway, SessionResumptionUpdate, UsageMetadata

GoAway
FieldTypeNotes
timeLeftDuration (string)Time until the connection terminates with ABORTED. Reconnect using the latest SessionResumptionUpdate.newHandle.
SessionResumptionUpdate
FieldTypeNotes
newHandlestringHandle to resume; empty if resumable=false.
resumableboolWhether the session is currently resumable.
lastConsumedClientMessageIndexint64Set only when SessionResumptionConfig.transparent=true — enables transparent reconnect.
UsageMetadata
FieldType
totalTokenCountint32
textCountint32
imageCountint32
videoDurationSecondsint32
audioDurationSecondsint32

13. End-to-end JSON examples

Setup
{
  "setup": {
    "model": "projects/my-proj/locations/us-central1/publishers/google/models/gemini-3.8-live",
    "generationConfig": {
      "responseModalities": ["AUDIO"],
      "speechConfig": {
        "voiceConfig": { "prebuiltVoiceConfig": { "voiceName": "Aoede" } }
      }
    },
    "systemInstruction": {
      "parts": [{ "text": "You are a concise voice assistant." }]
    },
    "realtimeInputConfig": {
      "automaticActivityDetection": { "disabled": false }
    },
    "sessionResumption": {},
    "outputAudioTranscription": {}
  }
}
Setup complete (server)
{ "setupComplete": { "sessionId": "abc-123" } }
Streaming user audio (realtime)
{
  "realtimeInput": {
    "audio": {
      "mimeType": "audio/pcm;rate=16000",
      "data": "<base64-pcm-bytes>"
    }
  }
}
Typed user message (turn-based)
{
  "clientContent": {
    "turns": [{ "role": "user", "parts": [{ "text": "Hello!" }] }],
    "turnComplete": true
  }
}
Streaming model output (server)
{
  "serverContent": {
    "modelTurn": {
      "role": "model",
      "parts": [{
        "inlineData": {
          "mimeType": "audio/pcm;rate=24000",
          "data": "<base64-pcm-bytes>"
        }
      }]
    }
  }
}
Tool call / response
// Server → client
{
  "toolCall": {
    "functionCalls": [
      { "id": "call_42", "name": "get_weather", "args": { "city": "Paris" } }
    ]
  }
}

// Client → server
{
  "toolResponse": {
    "functionResponses": [
      {
        "id": "call_42",
        "name": "get_weather",
        "response": { "tempC": 18, "summary": "Partly cloudy" }
      }
    ]
  }
}
GoAway + resumption
{ "goAway": { "timeLeft": "10s" } }
{ "sessionResumptionUpdate": { "newHandle": "ses_xyz", "resumable": true } }

Reconnect with:

{ "setup": { "model": "...", "sessionResumption": { "handle": "ses_xyz" } } }

14. Full input examples — audio, video, text

There are two distinct ways to send user input. Pick one based on intent:

| | Part 1 — Realtime input | Part 2 — Add-context |

: : (realtimeInput) : input (clientContent) : | --------------------- | ------------------------ | ------------------------- | | Goal | Stream live mic / camera | Append a discrete turn to | : : continuously : the conversation : | Latency | Lowest possible; | Normal request/response | : : sub-second : : | Added to history? | No (transient | Yes (persistent | : : signals) : conversation) : | Turn boundary | VAD (auto), or explicit | Explicit turnComplete: | : : activityStart/End : true : | Effect on model | Streamed; auto-triggers | Setting turnComplete | : : a turn when VAD fires : triggers generation; : : : : interrupts any : : : : ongoing model output : | Field carriers | audio / video / | turns[].parts[].text / | : : text : inlineData / fileData : | Typical use | Live voice + screen | Typed chat, uploading an | : : sharing, push-to-talk : image/clip, replaying : : : : history on resume :

You may use both in the same session — e.g. send a clientContent system nudge once, then continue streaming realtimeInput. But within a single logical user turn, pick one.

The two parts below give every supported variant for audio, video, and text in each mode.


Part 1 — Realtime input (realtimeInput)

Continuous, low-latency input that does not populate conversation history. End-of-turn comes from server-side VAD by default, or from explicit activityStart / activityEnd events when auto-VAD is disabled in setup.

1.A Realtime audio

Required format: PCM, 16-bit signed, 16 kHz, mono, little-endian, base64 encoded. MIME type: audio/pcm;rate=16000. Send one frame per chunk (~20–100 ms is typical).

1.A.1 Continuous mic
{
  "realtimeInput": {
    "audio": {
      "mimeType": "audio/pcm;rate=16000",
      "data": "<base64 PCM chunk>"
    }
  }
}

When the mic turns off (and server-side VAD is enabled), commit end-of-stream:

{ "realtimeInput": { "audioStreamEnd": true } }
1.A.2 Manual VAD (auto-VAD disabled)

Required setup:

{
  "setup": {
    "model": "...",
    "realtimeInputConfig": { "automaticActivityDetection": { "disabled": true } }
  }
}

Then explicitly frame each utterance:

{ "realtimeInput": { "activityStart": {} } }
{ "realtimeInput": { "audio": { "mimeType": "audio/pcm;rate=16000", "data": "..." } } }
{ "realtimeInput": { "audio": { "mimeType": "audio/pcm;rate=16000", "data": "..." } } }
{ "realtimeInput": { "activityEnd":   {} } }

1.B Realtime video

Video = a stream of sampled image frames (should be sent at 1 fps). Each frame is JPEG / PNG / WebP. The model does not consume an encoded container (mp4/webm) — sample frames client-side and send each as an inline image.

1.B.1 Continuous camera
{
  "realtimeInput": {
    "video": {
      "mimeType": "image/jpeg",
      "data": "<base64 JPEG frame>"
    }
  }
}

1.C Realtime text

{ "realtimeInput": { "text": "Switch to a calmer tone." } }

1.D Combined realtime audio + video (+ text)

Typical "talk-to-the-screen" flow. Send each modality in its own frame:

{ "realtimeInput": { "video": { "mimeType": "image/jpeg",          "data": "<frame_t0>" } } }
{ "realtimeInput": { "audio": { "mimeType": "audio/pcm;rate=16000", "data": "<pcm_t0>"   } } }
{ "realtimeInput": { "video": { "mimeType": "image/jpeg",          "data": "<frame_t1>" } } }
{ "realtimeInput": { "audio": { "mimeType": "audio/pcm;rate=16000", "data": "<pcm_t1>"   } } }
{ "realtimeInput": { "text":  "Focus on the chart in the upper-right." } }
{ "realtimeInput": { "audio": { "mimeType": "audio/pcm;rate=16000", "data": "<pcm_t2>"   } } }
{ "realtimeInput": { "audioStreamEnd": true } }

1.E Realtime quick reference

ModalityField
Audio chunkrealtimeInput.audio (audio/pcm;rate=16000)
Video framerealtimeInput.video (image/jpeg/png/webp)
TextrealtimeInput.text
Combined audio+videorealtimeInput.mediaChunks[] (deprecated —
: : prefer the typed audio / video fields) :
Mic-off signalrealtimeInput.audioStreamEnd: true
Manual turn boundaryrealtimeInput.activityStart / activityEnd
: : (auto-VAD disabled) :

Part 2 — Add-context input (clientContent)

Discrete, history-bearing turns. Use this when you want the message to be permanently part of the conversation context the model sees on subsequent turns. Setting turnComplete: true triggers generation immediately and interrupts any ongoing model output.

Do not use clientContent to reply to a toolCall — use toolResponse.

2.A Add-context text

2.A.1 Single user turn
{
  "clientContent": {
    "turns": [
      { "role": "user", "parts": [{ "text": "What's the capital of France?" }] }
    ],
    "turnComplete": true
  }
}
2.A.2 Multi-turn history (e.g. on resume)
{
  "clientContent": {
    "turns": [
      { "role": "user",  "parts": [{ "text": "Hi, my name is Sam." }] },
      { "role": "model", "parts": [{ "text": "Nice to meet you, Sam!" }] },
      { "role": "user",  "parts": [{ "text": "What's my name?" }] }
    ],
    "turnComplete": true
  }
}
2.A.3 Streamed turn (don't generate yet — more parts coming)
{ "clientContent": { "turns": [{ "role": "user", "parts": [{ "text": "Once upon" }] }] } }
{ "clientContent": { "turns": [{ "role": "user", "parts": [{ "text": " a time..." }] }], "turnComplete": true } }

2.B Add-context audio

A pre-recorded clip delivered as a discrete history-bearing turn.

2.B.1 Audio clip alone
{
  "clientContent": {
    "turns": [{
      "role": "user",
      "parts": [{
        "inlineData": {
          "mimeType": "audio/pcm;rate=16000",
          "data": "<base64 of full clip>"
        }
      }]
    }],
    "turnComplete": true
  }
}
2.B.2 Audio clip with accompanying text prompt
{
  "clientContent": {
    "turns": [{
      "role": "user",
      "parts": [
        { "text": "Transcribe this and summarize:" },
        { "inlineData": { "mimeType": "audio/pcm;rate=16000", "data": "..." } }
      ]
    }],
    "turnComplete": true
  }
}

2.C Add-context video / image

2.C.1 Single image
{
  "clientContent": {
    "turns": [{
      "role": "user",
      "parts": [
        { "text": "What's in this picture?" },
        { "inlineData": { "mimeType": "image/jpeg", "data": "<base64 image>" } }
      ]
    }],
    "turnComplete": true
  }
}
2.C.2 Multiple frames as a single turn (sampled clip)
{
  "clientContent": {
    "turns": [{
      "role": "user",
      "parts": [
        { "text": "Here are 3 frames from a video. What's happening?" },
        { "inlineData": { "mimeType": "image/jpeg", "data": "<frame_0>" } },
        { "inlineData": { "mimeType": "image/jpeg", "data": "<frame_1>" } },
        { "inlineData": { "mimeType": "image/jpeg", "data": "<frame_2>" } }
      ]
    }],
    "turnComplete": true
  }
}
2.C.3 Image by URI (fileData)
{
  "clientContent": {
    "turns": [{
      "role": "user",
      "parts": [
        { "text": "Describe this image." },
        { "fileData": { "mimeType": "image/jpeg", "fileUri": "gs://my-bucket/cat.jpg" } }
      ]
    }],
    "turnComplete": true
  }
}

2.D Combined add-context multimodal turn

Text + image + audio in a single user turn:

{
  "clientContent": {
    "turns": [{
      "role": "user",
      "parts": [
        { "text": "Compare what I'm saying with what I'm showing:" },
        { "inlineData": { "mimeType": "image/jpeg",          "data": "<image>" } },
        { "inlineData": { "mimeType": "audio/pcm;rate=16000", "data": "<clip>"  } }
      ]
    }],
    "turnComplete": true
  }
}

2.E Add-context quick reference

ModalityFieldNotes
Textturns[].parts[].textOne or more text
: : : parts per turn. :
Inline audioturns[].parts[].inlineDataFull clip, base64.
: : (audio/pcm;rate=16000) : :
Inline image / videoturns[].parts[].inlineDataMultiple parts allowed
: frame : (image/jpeg/png/webp) : for sampled clips. :
Remote fileturns[].parts[].fileDataGCS URI
: : (fileUri) : :
Trigger generationturnComplete: trueOmit to keep streaming
: : : more parts. :
History orderturns[] ordered oldest →role is "user" or
: : newest : "model". :

15. Common pitfalls

  • Sending data before setupComplete — server will close the connection.

  • Mixing clientContent and realtimeInput for the same logical turn — pick one mode. clientContent interrupts ongoing generation.

  • Ignoring interrupted: true — leftover queued audio will play over the user's next utterance.

  • Replying to toolCall with clientContent — must be toolResponse.

  • Forgetting FunctionResponse.id — request rejected.

  • Wrong audio format — input must be 16 kHz PCM, output is 24 kHz PCM.

  • No reconnect handling — sessions have a max duration; always honor goAway and persist the latest SessionResumptionUpdate.newHandle.

Requirements and compatibility

Works with: Claude Code, Claude apps, OpenAI Codex, GitHub Copilot, Cursor, Gemini CLI, Kiro, OpenCode, Goose, Amp, Roo Code, JetBrains Junie, Factory Droid, Devin (ex-Windsurf), Mistral Vibe, OpenHands, Letta

“Works with” means the tool reads the open Agent Skills format; a skill written for one tool may use features others lack.

Needs: Needs an API key, Needs a command-line tool, Needs Python

Security

What our scanner noticed· Low risk

  • Instructions that use the network

A static scan is not a guarantee. Skills are third-party content: review a skill before you let an agent use it.

Attribution and licence

Published by
Google
Publisher
Google (Official)
Source
google/skills · skills/cloud/gemini-live-api · commit 2194d3b
Licence
Apache License 2.0 (redistribution allowed)
  • LICENSE (added by AutoGineer from LICENSE)
  • ATTRIBUTION.md (written by AutoGineer)
Synced

AutoGineer is not affiliated with or endorsed by Google or Google.

Download ZIP

The ZIP holds the skill’s files, its licence files and an ATTRIBUTION.md. Download gemini-live-api.zip