google/gemini-live-api
>- 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.
npx skills add https://github.com/google/skills --skill gemini-live-api
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).
Before running the generation flow, ensure the following are available on the
host:
APIs enabled.
client:
gcloud auth application-default login
/tmp/liveapi_out)where the generated code, environment, and demo will be written. Never
mutate the host's system Python environment.
reference language for this skill).
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 fromclient_server_messages.md.
session_manager.md: Describes how to correctly handle sessions, buffering,and resumption on disconnection.
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.
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.
Implement a class in the user's chosen language that:
client_server_messages.proto types (ClientMessage,ServerMessage).
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.
The user provides the following at construction time:
project_idlocationmodel_idconfig: a ClientMessage with the setup field populated.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.
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 ClientMessagecarrying a realtime_input field.
send_client_content(data): send non-realtime, turn-based content thatcontributes to history. data is a ClientMessage carrying a
client_content field.
receive(): yield ServerMessage instances parsed from the WebSocketstream.
Do not expose synchronous blocking variants as the primary API surface.
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).
how_to_run.mdProvide 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.
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:
stream them to the model.
conversation history.
While implementing audio and transcription playback, follow the guidance in
interrupt signalWhen a ServerMessage's server_content arrives with interrupted: true, the
UI MUST:
in-progress transcription bubble.
stale content does not bleed into the next turn.
finished signalFor 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.
how_to_test_with_ui.mdWrite how_to_test_with_ui.md describing how to launch and use the demo
service. It MUST include:
service.
http://localhost:PORT) the user should open intheir browser.
screen), send a text message, and observe model audio and transcription in
the UI.
Before considering the generation complete, verify each item:
client_server_messages.md, client_server_messages.proto, andsession_manager.md were copied into the destination folder.
ClientMessageand ServerMessage types.
wss://{location}-aiplatform.googleapis.com/ws/google.cloud.aiplatform.v1beta1.LlmBidiService/BidiGenerateContent
(or the wss://aiplatform.googleapis.com/... global variant), and formats
the setup model field as
projects/{project_id}/locations/{location}/publishers/google/models/{model_id}.
Bearer <token>`, is refreshed before expiry, and reattached on every
reconnect.
send_realtime_data, send_client_content, andreceive are present, correctly typed, and gated on setup_complete.
(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).
venv) plus a setup.shand 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 demoUI reuses the same ClientMessage / ServerMessage protos.
finished handling behave asdescribed above.
generativelanguage.googleapis.com anddoes not authenticate via API key in a query string.
Take google/gemini-live-api from the repository into ~/.claude/skills for personal
use, or into .claude/skills inside a project.
The agent identifies a skill by the name field in its header. Two skills with the
same name cannot sit side by side — one of them will be ignored.
The instructions reference pip.
Without those the skill loads but fails at the first command.