本文へスキップ
Skillpedia
APIとサーバー(バックエンド)22k · #10263

gemini-live-api

できること

ストリーミングの音声、動画、テキストを扱う、リアルタイムのGeminiのクライアントのコードを生成します。Google Cloud上で音声や動画のアシスタントを作る開発者向けです。

使う場面

  • ✓Google Cloud上のGeminiに、リアルタイムの音声や動画のクライアントを作りたいとき。
  • ✓セッションの再開とトークンの更新に対応するLive APIのクライアントが必要なとき。
  • ✓接続を試すために、サンプルのフロントエンドとバックエンドがほしいとき。

スキルのリンク

https://github.com/google/skills/blob/main/skills/cloud/gemini-live-api/SKILL.md

コピーしてAI(Claude、ChatGPT、Cursor)に貼り付け、指示に従うよう頼んでください。

使い方

いちばん簡単な方法:メッセージをコピーしてAIに貼り付けるだけ。AIがスキルを読んで指示に従います。

貼り付け用メッセージ

このスキルを使って手伝ってください:https://github.com/google/skills/blob/main/skills/cloud/gemini-live-api/SKILL.md このリンクのSKILL.mdファイルを読んで、私の作業でその指示に従ってください。
こういうスキルを、AIが自分で見つけてくれたら?無料のSkillpedia MCPをインストール。1行で、作業の前に15,000+のスキルから探してくれます。1分でインストール →

AIへの頼み方の例

“マイクの音声をモデルに送り、その返答を再生するGemini Live APIのクライアントを作ってください。”

毎週5つの新しいスキル。1分で読めます。

仕組み

エージェントは、Googleのログインから得たトークンを使ってWebSocketの接続を開くクライアントのクラスを書き、メッセージを送受信し、セッションを再開します。テストのためのデモ用のフロントエンドとバックエンドも作ります。

技術的な内容(元のSKILL.md)

作者による元のテキスト(英語)をGitHubからそのまま表示しています。

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. `da
よくある質問

通常の、ライブではないGeminiの呼び出しにも使えますか?

いいえ。双方向のライブの接続専用です。

実行する前に何が必要ですか?

APIを有効にしたGoogle Cloudプロジェクトと、Application Default Credentialsの設定です。

UIを作らずに試せますか?

はい。テストに使えるデモ用のフロントエンドとバックエンドも生成します。

詳細

作者による元の説明

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.

repo: google/skills

人気

GitHubのスター
22k
ランキング
#10263
ライセンス
Apache-2.0
更新日
2026/11/2

このスキルは役に立ちますか?

0

ログイン して投票しましょう。

コメント

  • …

このリポジトリの他のスキル

似ているスキル