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
- Node.js 18+ (see Install Node.js)
- A TokenReply API key, created in API key management
Installation
npm install -g @google/gemini-cli
gemini --versionConfiguration
Gemini CLI reads its settings from ~/.gemini/. You’ll create two files there:
Step 1: create the config folder
mkdir -p ~/.gemini && cd ~/.geminiOn 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-proReplace 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
geminiTroubleshooting
Asked to sign in with Google
- Check that
selectedTypeis"gemini-api-key"insettings.json - Check that
GEMINI_API_KEYholds your key in.env
Connection failed
- Check that
GOOGLE_GEMINI_BASE_URLishttps://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
- Create and manage keys in API key management
- Look up URLs and headers in Base URL and authentication
- Switch Gemini CLI settings from a desktop app with CC-Switch
