Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

README.md

@richizo/openclaw-gemini-cli

npm version License: MIT

OpenClaw provider plugin that routes Gemini LLM calls through the locally installed Gemini CLI (gemini binary) instead of calling the Google Generative AI API directly.

No API key needed in OpenClaw. Authentication is handled entirely by the Gemini CLI, which uses your existing Google account login.

Prerequisites

# Install Gemini CLI
npm install -g @google/gemini-cli

# Authenticate (opens browser)
gemini

Installation

openclaw plugins install @richizo/openclaw-gemini-cli

Configuration

Enable the plugin in your ~/.openclaw/openclaw.json:

{
  "agents": {
    "defaults": {
      "model": {
        "primary": "gemini-cli/gemini-2.5-flash"
      },
      "models": {
        "gemini-cli/gemini-2.5-flash": {},
        "gemini-cli/gemini-2.5-pro": {}
      }
    }
  },
  "plugins": {
    "entries": {
      "gemini-cli": { "enabled": true }
    }
  }
}

Advanced config

"gemini-cli": {
  "enabled": true,
  "config": {
    "command": "/path/to/gemini",   // default: "gemini" (resolved from PATH)
    "timeoutMs": 120000             // default: 120000 (2 min)
  }
}

Models

Model ID Description
gemini-cli/gemini-2.5-flash Gemini 2.5 Flash via CLI
gemini-cli/gemini-2.5-pro Gemini 2.5 Pro via CLI (reasoning)

Features

Real-time streaming

Unlike a naive subprocess wrapper, this plugin streams stdout chunks as text_delta events in real time. This keeps the OpenClaw runner stream alive and surfaces partial output as it arrives — preventing the hard request timeout that would occur if the entire response were buffered until process exit.

Correct model routing

The plugin always passes -m <modelId> to the CLI, ensuring the requested model (flash vs. pro) is used instead of whatever the CLI's own default is configured as. This prevents silent fallbacks to unavailable models.

Non-TTY compatibility

The gemini binary blocks on stdin when no TTY is attached (the default for subprocess spawning). The plugin uses stdio: ["ignore", "pipe", "pipe"] to prevent this hang.

How it works

The plugin spawns gemini -m <model> -p "<prompt>" as a subprocess, streams stdout chunks as text_delta events, and emits done when the process exits.

OpenClaw agent  →  gemini-cli plugin  →  gemini subprocess  →  Google (via CLI auth)

License

MIT — see LICENSE