Skip to main content

Gemini CLI setup

Gemini CLI is Google’s coding assistant for the terminal. Connect it to TokenReply with your API key, no Google account needed. Official documentation

Before you start

Installation

npm install -g @google/gemini-cli
gemini --version

Configuration

Gemini CLI reads its settings from ~/.gemini/. You’ll create two files there:

Step 1: create the config folder

mkdir -p ~/.gemini && cd ~/.gemini

On Windows, the folder is %USERPROFILE%\.gemini\.

Step 2: create the .env file

GOOGLE_GEMINI_BASE_URL=https://api.tokenreply.com
GEMINI_API_KEY=sk-xxx
GEMINI_MODEL=gemini-2.5-pro

Replace sk-xxx with your API key. Models lists the Gemini models you can use.

Step 3: create settings.json

{
  "ide": {
    "enabled": true
  },
  "security": {
    "auth": {
      "selectedType": "gemini-api-key"
    }
  }
}

Use API key sign-in

Setting selectedType to "gemini-api-key" makes Gemini CLI use your API key instead of a Google sign-in.

Start Gemini CLI

cd your-project
gemini

Troubleshooting

Asked to sign in with Google

  • Check that selectedType is "gemini-api-key" in settings.json
  • Check that GEMINI_API_KEY holds your key in .env

Connection failed

  • Check that GOOGLE_GEMINI_BASE_URL is https://api.tokenreply.com, without /v1
  • Check that your key’s Channel setting includes Gemini models

Where the config files live

  • macOS / Linux: ~/.gemini/
  • Windows: %USERPROFILE%\.gemini\

Related guides