Providers

Google (Gemini)

Google pluginは、Google AI Studioを通じてGeminiモデルへのアクセスを提供し、さらに 画像生成、メディア理解(画像/音声/動画)、テキスト読み上げ、Gemini Grounding経由のWeb検索も提供します。

  • プロバイダー: google
  • 認証: GEMINI_API_KEY または GOOGLE_API_KEY
  • API: Google Gemini API
  • ランタイムオプション: provider/model agentRuntime.id: "google-gemini-cli" は、 モデル参照を正規の google/* のまま保ちながら、Gemini CLI OAuthを再利用します。

はじめに

希望する認証方法を選び、セットアップ手順に従ってください。

APIキー

最適な用途: Google AI Studioを通じた標準的なGemini APIアクセス。

  • オンボーディングを実行する

    bash
    openclaw onboard --auth-choice gemini-api-key

    またはキーを直接渡します。

    bash
    openclaw onboard --non-interactive \  --mode local \  --auth-choice gemini-api-key \  --gemini-api-key "$GEMINI_API_KEY"
  • デフォルトモデルを設定する

    json5
    {  agents: {    defaults: {      model: { primary: "google/gemini-3.1-pro-preview" },    },  },}
  • モデルが利用可能であることを確認する

    bash
    openclaw models list --provider google
  • Gemini CLI (OAuth)

    最適な用途: 別のAPIキーの代わりに、PKCE OAuthによる既存のGemini CLIログインを再利用する場合。

  • Gemini CLIをインストールする

    local の gemini コマンドが PATH で利用可能である必要があります。

    bash
    # Homebrewbrew install gemini-cli # or npmnpm install -g @google/gemini-cli

    OpenClawは、一般的なWindows/npmレイアウトを含め、Homebrewインストールとグローバルnpmインストールの両方をサポートします。

  • OAuthでログインする

    bash
    openclaw models auth login --provider google-gemini-cli --set-default
  • モデルが利用可能であることを確認する

    bash
    openclaw models list --provider google
    • デフォルトモデル: google/gemini-3.1-pro-preview
    • ランタイム: google-gemini-cli
    • エイリアス: gemini-cli

    Gemini 3.1 ProのGemini APIモデルIDは gemini-3.1-pro-preview です。OpenClawは利便性のために短い google/gemini-3.1-pro をエイリアスとして受け付け、プロバイダー呼び出しの前に正規化します。

    環境変数:

    • OPENCLAW_GEMINI_OAUTH_CLIENT_ID
    • OPENCLAW_GEMINI_OAUTH_CLIENT_SECRET

    (または GEMINI_CLI_* バリアント。)

    google-gemini-cli/* モデル参照はレガシー互換エイリアスです。新しい 設定では、local のGemini CLI実行を使いたい場合、google/* モデル参照と google-gemini-cli ランタイムを使用してください。

    機能

    機能 サポート
    チャット補完 はい
    画像生成 はい
    音楽生成 はい
    テキスト読み上げ はい
    リアルタイム音声 はい(Google Live API)
    画像理解 はい
    音声文字起こし はい
    動画理解 はい
    Web検索(Grounding) はい
    Thinking/推論 はい(Gemini 2.5+ / Gemini 3+)
    Gemma 4モデル はい

    Web検索

    バンドルされた gemini Web検索プロバイダーは、Gemini Google Search groundingを使用します。 専用の検索キーを plugins.entries.google.config.webSearch に設定するか、 GEMINI_API_KEY の後に models.providers.google.apiKey を再利用させます。

    json5
    {  plugins: {    entries: {      google: {        config: {          webSearch: {            apiKey: "AIza...", // optional if GEMINI_API_KEY or models.providers.google.apiKey is set            baseUrl: "https://generativelanguage.googleapis.com/v1beta", // falls back to models.providers.google.baseUrl            model: "gemini-2.5-flash",          },        },      },    },  },}

    認証情報の優先順位は、専用の webSearch.apiKey、次に GEMINI_API_KEY、 次に models.providers.google.apiKey です。webSearch.baseUrl は任意であり、 オペレータープロキシや互換Gemini APIエンドポイント向けに存在します。省略した場合、 Gemini Web検索は models.providers.google.baseUrl を再利用します。プロバイダー固有のツール動作については Gemini検索 を参照してください。

    画像生成

    バンドルされた google 画像生成プロバイダーのデフォルトは google/gemini-3.1-flash-image-preview です。

    • google/gemini-3-pro-image-preview もサポート
    • 生成: リクエストあたり最大4枚の画像
    • 編集モード: 有効、入力画像は最大5枚
    • ジオメトリ制御: sizeaspectRatioresolution

    Googleをデフォルトの画像プロバイダーとして使用するには:

    json5
    {  agents: {    defaults: {      imageGenerationModel: {        primary: "google/gemini-3.1-flash-image-preview",      },    },  },}

    動画生成

    バンドルされた google pluginは、共有の video_generate ツールを通じて動画生成も登録します。

    • デフォルト動画モデル: google/veo-3.1-fast-generate-preview
    • モード: テキストから動画、画像から動画、単一動画参照フロー
    • aspectRatio16:99:16)と resolution720P1080P)をサポート。Veoは現在、音声出力をサポートしていません
    • サポートされる長さ: 4、6、または8秒(その他の値は最も近い許可値に丸められます)

    Googleをデフォルトの動画プロバイダーとして使用するには:

    json5
    {  agents: {    defaults: {      videoGenerationModel: {        primary: "google/veo-3.1-fast-generate-preview",      },    },  },}

    音楽生成

    バンドルされた google pluginは、共有の music_generate ツールを通じて音楽生成も登録します。

    • デフォルト音楽モデル: google/lyria-3-clip-preview
    • google/lyria-3-pro-preview もサポート
    • プロンプト制御: lyricsinstrumental
    • 出力形式: デフォルトは mp3、さらに google/lyria-3-pro-preview では wav
    • 参照入力: 最大10枚の画像
    • セッションに基づく実行は、action: "status" を含む共有タスク/ステータスフローを通じてデタッチされます

    Googleをデフォルトの音楽プロバイダーとして使用するには:

    json5
    {  agents: {    defaults: {      musicGenerationModel: {        primary: "google/lyria-3-clip-preview",      },    },  },}

    テキスト読み上げ

    バンドルされた google 音声プロバイダーは、Gemini API TTSパスを gemini-3.1-flash-tts-preview とともに使用します。

    • デフォルト音声: Kore
    • 認証: messages.tts.providers.google.apiKeymodels.providers.google.apiKeyGEMINI_API_KEY、または GOOGLE_API_KEY
    • 出力: 通常のTTS添付ではWAV、ボイスメモターゲットではOpus、Talk/テレフォニーではPCM
    • ボイスメモ出力: Google PCMはWAVとしてラップされ、ffmpeg で48 kHz Opusにトランスコードされます

    GoogleのバッチGemini TTSパスは、完了した generateContent レスポンス内で生成音声を返します。最も低レイテンシな音声会話には、バッチ TTSではなく、Gemini Live APIに基づくGoogleリアルタイム音声プロバイダーを使用してください。

    GoogleをデフォルトのTTSプロバイダーとして使用するには:

    json5
    {  messages: {    tts: {      auto: "always",      provider: "google",      providers: {        google: {          model: "gemini-3.1-flash-tts-preview",          speakerVoice: "Kore",          audioProfile: "Speak professionally with a calm tone.",        },      },    },  },}

    Gemini API TTSは、スタイル制御に自然言語プロンプトを使用します。 発話テキストの前に再利用可能なスタイルプロンプトを付加するには、audioProfile を設定します。 プロンプトテキストが名前付き話者を参照する場合は、speakerName を設定します。

    Gemini API TTSは、テキスト内の [whispers][laughs] のような表現力のある角括弧付き音声タグも受け付けます。 タグを表示されるチャット返信に出さずにTTSへ送信するには、[[tts:text]]...[[/tts:text]] ブロック内に入れます。

    text
    Here is the clean reply text. [[tts:text]][whispers] Here is the spoken version.[[/tts:text]]

    リアルタイム音声

    バンドルされた google pluginは、Voice CallやGoogle Meetなどのバックエンド音声ブリッジ向けに、 Gemini Live APIに基づくリアルタイム音声プロバイダーを登録します。

    設定 設定パス デフォルト
    モデル plugins.entries.voice-call.config.realtime.providers.google.model gemini-2.5-flash-native-audio-preview-12-2025
    音声 ...google.voice Kore
    温度 ...google.temperature (未設定)
    VAD 開始感度 ...google.startSensitivity (未設定)
    VAD 終了感度 ...google.endSensitivity (未設定)
    無音時間 ...google.silenceDurationMs (未設定)
    アクティビティ処理 ...google.activityHandling Google のデフォルト、start-of-activity-interrupts
    ターン範囲 ...google.turnCoverage Google のデフォルト、only-activity
    自動 VAD を無効化 ...google.automaticActivityDetectionDisabled false
    セッション再開 ...google.sessionResumption true
    コンテキスト圧縮 ...google.contextWindowCompression true
    API キー ...google.apiKey models.providers.google.apiKeyGEMINI_API_KEY、または GOOGLE_API_KEY にフォールバック

    Voice Call リアルタイム設定例:

    json5
    {  plugins: {    entries: {      "voice-call": {        enabled: true,        config: {          realtime: {            enabled: true,            provider: "google",            providers: {              google: {                model: "gemini-2.5-flash-native-audio-preview-12-2025",                speakerVoice: "Kore",                activityHandling: "start-of-activity-interrupts",                turnCoverage: "only-activity",              },            },          },        },      },    },  },}

    メンテナー向けのライブ検証では、 OPENAI_API_KEY=... GEMINI_API_KEY=... node --import tsx scripts/dev/realtime-talk-live-smoke.ts を実行します。 このスモークは OpenAI バックエンド/WebRTC パスも対象にします。Google 側では Control UI Talk で使われるものと同じ 制約付き Live API トークン形状を発行し、ブラウザー WebSocket エンドポイントを開き、初期セットアップペイロードを送信して、 setupComplete を待ちます。

    高度な設定

    Gemini キャッシュの直接再利用

    Gemini API の直接実行 (api: "google-generative-ai") では、OpenClaw は 設定済みの cachedContent ハンドルを Gemini リクエストに渡します。

    • モデルごと、またはグローバルのパラメーターを cachedContent またはレガシーの cached_content で設定します
    • 両方が存在する場合、cachedContent が優先されます
    • 値の例: cachedContents/prebuilt-context
    • Gemini のキャッシュヒット使用量は、上流の cachedContentTokenCount から OpenClaw の cacheRead に正規化されます
    json5
    {  agents: {    defaults: {      models: {        "google/gemini-2.5-pro": {          params: {            cachedContent: "cachedContents/prebuilt-context",          },        },      },    },  },}
    Gemini CLI の使用メモ

    google-gemini-cli OAuth プロバイダーを使用する場合、OpenClaw はデフォルトで Gemini CLI の stream-json 出力を使用し、最終的な stats ペイロードから使用量を正規化します。レガシーの --output-format json オーバーライドでは、引き続き JSON パーサーを使用します。

    • ストリーミングされた返信テキストは、アシスタントの message イベントから取得されます。
    • レガシー JSON 出力では、返信テキストは CLI JSON の response フィールドから取得されます。
    • CLI が usage を空のままにした場合、使用量は stats にフォールバックします。
    • stats.cached は OpenClaw の cacheRead に正規化されます。
    • stats.input がない場合、OpenClaw は stats.input_tokens - stats.cached から入力トークンを導出します。
    環境とデーモンのセットアップ

    Gateway がデーモン (launchd/systemd) として実行される場合、GEMINI_API_KEY がそのプロセスで利用可能であることを確認してください。たとえば、~/.openclaw/.env または env.shellEnv 経由で設定します。

    関連

    Was this useful?
    On this page

    On this page