How to Use Gemini With OpenClaw

Google's Gemini models give OpenClaw more than chat: image, video and music generation, text-to-speech, live voice and Google Search grounding, all from one API key. This guide covers the setup, the right model names, and how to switch on each of these features.

Quick answer

Create a key in Google AI Studio, run openclaw onboard --auth-choice gemini-api-key, then pick a model with openclaw models set google/gemini-3.1-pro-preview. Check what's available with openclaw models list --provider google.

Three options

Ways to connect Gemini to OpenClaw

recommended

AI Studio API key

  • Works on any computer or VPS
  • Unlocks every Gemini feature in OpenClaw
  • New Gemini models appear without an OpenClaw update
  • Watch your usage and billing in Google AI Studio
Google Cloud

Vertex AI

  • For gateways already running on Google Cloud
  • Signs in with Application Default Credentials, so no key to store
  • Uses its own model list, separate from AI Studio
advanced

Gemini CLI runtime

  • Runs Gemini turns through Google's gemini program
  • Still needs an AI Studio API key
  • No "Login with Google" option for new setups
No more Google sign-in through Gemini CLI or Antigravity

Google ended consumer Gemini CLI "Login with Google" access on June 18, 2026, and Antigravity's terms don't allow third-party tools. OpenClaw no longer creates these sign-ins. Existing working profiles still run, but if one breaks, replace it with an AI Studio API key.

Setup picker

Which Gemini setup fits you?

Where does OpenClaw run?
Do you already have a Gemini CLI login?
Recommendation
    See the steps
    Recommended

    Set up Gemini with an AI Studio API key

    1

    Create a key

    Go to aistudio.google.com/apikey and create a key. A Google Cloud Console key restricted to the Gemini API also works.

    2

    Run onboarding

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

    OpenClaw accepts both GEMINI_API_KEY and GOOGLE_API_KEY. If the gateway runs as a background service, put the key in ~/.openclaw/.env so the service can see it.

    3

    Pick a model and verify

    Terminal
    openclaw models list --provider google
    openclaw models set google/gemini-3.1-pro-preview
    openclaw models status --probe

    With a key in place, OpenClaw reads Google's live model list, so new Gemini 3 Pro, Flash and Flash-Lite versions show up without waiting for an OpenClaw release.

    Google Cloud

    Use Gemini through Vertex AI

    If your gateway already runs on Google Cloud, use the google-vertex provider. It signs in with Google Cloud Application Default Credentials instead of an AI Studio key.

    Terminal (Google Cloud SDK)
    gcloud auth application-default login   # skip on a VM with a service account
    openclaw models list --provider google-vertex

    Vertex has its own fixed model list, separate from AI Studio's live list, so pick a model from the command above. See OpenClaw's provider docs for Vertex details.

    Advanced

    Run Gemini through the Gemini CLI

    This option runs Gemini turns through Google's own gemini program, but still signs in with your AI Studio key. Do the API-key setup above first.

    1

    Install Gemini CLI

    Terminal
    # Homebrew
    brew install gemini-cli
    
    # or npm
    npm install -g @google/gemini-cli
    2

    Select the CLI runtime for your model

    ~/.openclaw/openclaw.json (JSON5)
    {
      agents: {
        defaults: {
          model: { primary: "google/gemini-3.1-pro-preview" },
          models: {
            "google/gemini-3.1-pro-preview": {
              agentRuntime: { id: "google-gemini-cli" },
            },
          },
        },
      },
    }

    Keep normal google/* model names. Old google-gemini-cli/* names still work but are kept only for compatibility.

    Models

    Choose a Gemini model

    These model names appear in the OpenClaw docs. Your list may include newer ones, so always check openclaw models list --provider google.

    UseModel referenceNotes
    Main assistantgoogle/gemini-3.1-pro-previewThe docs' default example. google/gemini-3.1-pro also works.
    Fast, lower costgoogle/gemini-3.5-flashExample Flash model in the docs
    Open modelgoogle/gemma-4-26b-a4b-itGemma 4, with thinking mode
    Imagesgoogle/gemini-3.1-flash-imageDefault. Also gemini-3-pro-image
    Videogoogle/veo-3.1-fast-generate-preview4, 6 or 8 second clips
    Musicgoogle/lyria-3-clip-previewAlso lyria-3-pro-preview
    Retired model

    google/gemini-3-pro-preview was retired on March 9, 2026. Use google/gemini-3.1-pro-preview. Re-running openclaw onboard --auth-choice gemini-api-key updates an old default for you. For prices, see Google's Gemini API pricing.

    Make it yours

    Gemini feature builder

    Turn on the Gemini features you want

    Pick a chat model and tick the extras. Copy the result into ~/.openclaw/openclaw.json, then run openclaw gateway restart.

    ~/.openclaw/openclaw.json (JSON5)

    Your API key stays in ~/.openclaw/.env as GEMINI_API_KEY. It isn't part of this config.

    Beyond chat

    Images, video, music and voice

    🖼 Images

    Up to 4 images per request, and editing with up to 5 input images. Size, aspect ratio and resolution controls.

    🎬 Video

    Veo text-to-video and image-to-video in 16:9 or 9:16, at 720P or 1080P. Clips are 4, 6 or 8 seconds, with no audio.

    🎵 Music

    Lyria with lyrics or instrumental. Outputs MP3, plus WAV on Lyria 3 Pro. Accepts up to 10 reference images.

    🔊 Text-to-speech

    Default voice Kore. Gemini 3.8 TTS supports two-speaker dialogue and tags such as <laugh>.

    🎙 Live voice

    Real-time voice for Voice Call, Google Meet, Talk and Discord through the Gemini Live API.

    👁 Understanding

    Reads images, transcribes audio and understands video you send to your assistant.

    Example: two-voice speech with Gemini 3.8 TTS.

    ~/.openclaw/openclaw.json (JSON5)
    {
      tts: {
        auto: "always",
        provider: "google",
        providers: {
          google: {
            model: "gemini-3.8-flash-tts",
            speakerVoice: "Kore",
            speakers: [
              { speaker: "Puck", voice: "Puck", style: "bright" },
              { speaker: "Kore", voice: "Kore", style: "whispered" },
            ],
          },
        },
      },
    }

    Voice notes are converted to Opus with ffmpeg, so install it on the gateway machine. Want the assistant in a call? See the Discord guide.

    Reasoning

    Thinking with Gemini

    In a chat with your assistant
    /think adaptive   # let Google decide how much to think
    /think high       # think harder
    /think off        # Gemma 4: keeps thinking disabled
    • Gemini 3 and 3.1 use Google's thinkingLevel. OpenClaw converts its own thinking settings for you.
    • /think adaptive keeps Google's dynamic thinking. Gemini 2.5 gets Google's "dynamic" setting.
    • Gemini 2.5 Pro only works with thinking on. OpenClaw removes any "thinking off" value before sending.
    Heavy use

    Key rotation and context caching

    Hitting rate limits? Give OpenClaw several Gemini keys. It tries the next one when a key is rate limited.

    1. OPENCLAW_LIVE_GEMINI_KEYA single override
    2. GEMINI_API_KEYSSeveral keys, separated by commas
    3. GEMINI_API_KEYThe standard key
    4. GEMINI_API_KEY_1, GEMINI_API_KEY_2…Numbered keys, with GOOGLE_API_KEY as a final fallback

    Reusing a large prompt? Point OpenClaw at a Gemini context cache you created:

    JSON5
    {
      agents: {
        defaults: {
          models: {
            "google/gemini-2.5-pro": {
              params: { cachedContent: "cachedContents/prebuilt-context" },
            },
          },
        },
      },
    }

    The optional stateless Interactions route (api: "google-interactions") doesn't support cachedContent. More on backups: model setup and fallbacks.

    Troubleshooting

    Fix common Gemini problems

    gemini-3-pro-preview not found

    It was retired. Run openclaw models set google/gemini-3.1-pro-preview, or re-run the Gemini key setup.

    Works in terminal, not as a service

    The background service can't see your shell's GEMINI_API_KEY. Add it to ~/.openclaw/.env and restart the gateway.

    Gemini CLI login stopped working

    OpenClaw can't repair Google sign-in profiles. Add an AI Studio key and keep the CLI runtime on that key.

    gemini: command not found

    Install Gemini CLI with Homebrew or npm install -g @google/gemini-cli and make sure it's on the gateway's PATH.

    New model missing

    Run openclaw models list --provider google. A failed refresh keeps the last good list. Vertex uses a separate fixed list.

    Rate limited (429)

    Add more keys with GEMINI_API_KEYS, or add a fallback model from another provider.

    More fixes: troubleshooting guide.

    FAQ

    Gemini and OpenClaw questions

    How do I connect Gemini to OpenClaw?

    Create a key in Google AI Studio, then run openclaw onboard --auth-choice gemini-api-key. Pick a model with openclaw models set google/gemini-3.1-pro-preview and check it with openclaw models list --provider google.

    Can I sign in to Gemini with my Google account instead of a key?

    Not for new setups. Google ended consumer Gemini CLI Login with Google access on June 18, 2026, and OpenClaw no longer creates Gemini CLI or Antigravity sign-ins. Use an AI Studio API key, or Vertex AI on Google Cloud.

    Which Gemini model should I use with OpenClaw?

    The OpenClaw docs use google/gemini-3.1-pro-preview as the main example, with google/gemini-3.5-flash as a faster option. Run openclaw models list --provider google to see every model your key can use.

    Can OpenClaw make images and videos with Gemini?

    Yes. The Google plugin generates images with Gemini image models, videos with Veo and music with Lyria. Set them as defaults under agents.defaults.mediaModels.

    Does GOOGLE_API_KEY work instead of GEMINI_API_KEY?

    Yes. OpenClaw accepts both for the google provider. GOOGLE_API_KEY is also used as a fallback when rotating several Gemini keys.

    Should I use AI Studio or Vertex AI?

    Use an AI Studio key for most setups. Choose the google-vertex provider when your gateway already runs on Google Cloud and you want to use Application Default Credentials instead of an API key.

    Related guides