Search docs...

Start typing to search documentation

Gemini
Gemini CLI

Gemini CLI Integration

Use UnoRouter with the Gemini CLI and any Google GenAI-compatible client.

Overview

Gemini CLI is Google's open-source coding agent that edits files and runs commands from your terminal. Set UnoRouter as its base URL to reach every model through one OpenAI-compatible key instead of a Google-only account.

Quick Config

Paste these into the client. Your key auto-fills when signed in.

text
Base URL: https://api.unorouter.com
API Key: YOUR_API_KEY

Sign in to auto-fill your API key

Compatibility

Chat CompletionsStreamingTool callingImage input

Step-by-step setup

  1. 1
    Install Gemini CLI

    Install the Gemini CLI globally with npm. On Windows, run this inside WSL.

    bash
    npm install -g @google/gemini-cli

    Sign in to auto-fill your API key

  2. 2
    Set environment variables

    Create `~/.gemini/.env` with your UnoRouter API key. Set `GOOGLE_GEMINI_BASE_URL` to the bare base URL. The Gemini SDK appends its own path, so do not add `/v1`.

    bash
    # ~/.gemini/.env
    GEMINI_API_KEY=YOUR_API_KEY
    GOOGLE_GEMINI_BASE_URL=https://api.unorouter.com

    Sign in to auto-fill your API key

  3. 3
    Launch Gemini

    Run `gemini` in your project directory.

powershell
$env:GEMINI_API_KEY="YOUR_API_KEY"
$env:GOOGLE_GEMINI_BASE_URL="https://api.unorouter.com"

gemini

Sign in to auto-fill your API key

Recommended models

Free models that work here. Paste any model id into the client.

glm-5.3-search:freeglm-5.3-think-search:freeglm-5.3-thinking:freeglm-5.3:freeqwen-3.8-27b:free

Gotchas

  • A 404 means the base URL has a path on it. `GOOGLE_GEMINI_BASE_URL` must be the bare host with no `/v1` suffix; the SDK appends the rest.
  • On auth failure, confirm `GEMINI_API_KEY` in `~/.gemini/.env` is your UnoRouter key and that your shell reads the file.
Generate API KeyModels