logo

Gemini CLI Configuration Guide

Installation Steps

1. Install Node.js

Visit the Node.js official website. We recommend downloading the LTS version on the left, which is the long-term support version and more stable.

2. Install Git

Visit the Git official website. The page will automatically recommend the version suitable for your operating system; click the button to download.

3. Install Gemini CLI

Open the cmd command line and install gemini-cli via npm:

npm install -g @google/gemini-cli

Configuration Steps

Configuration (.env)

Create configuration file (Windows: %USERPROFILE%\.gemini\.env, Mac/Linux: ~/.gemini/.env)

GOOGLE_GEMINI_BASE_URL=https://llmoxy.com
GEMINI_API_KEY=<LLMOXY_API_KEY>
GEMINI_MODEL=gemini-2.5-pro

Note: For API Key, please use a token from the Gemini/Vertex group.

Launch

gemini

Detailed Configuration Steps

1. Install Gemini CLI

Open PowerShell and run:

npm install -g @google/generative-ai-cli

Verify installation:

gemini --version

If the gemini command is not found, try the alternative package name:

npm install -g @google/gemini-cli

Open Terminal (press Command + Space, type Terminal, press Enter) and run:

npm install -g @google/generative-ai-cli

Verify installation:

gemini --version

If the gemini command is not found, try the alternative package name:

npm install -g @google/gemini-cli

Open Terminal and run:

npm install -g @google/generative-ai-cli

Verify installation:

gemini --version

If the gemini command is not found, try the alternative package name:

npm install -g @google/gemini-cli

2. Configure Gemini CLI (connect to LLMoxy)

Gemini CLI uses its own configuration directory; no need to edit Shell config files.

Create configuration directory

mkdir -Force "$env:USERPROFILE\.gemini"

Write environment variable configuration file

Create .env file (please replace API Key):

@"
GOOGLE_GEMINI_BASE_URL=https://llmoxy.com
GEMINI_API_KEY=Your LLMoxy API Key
GEMINI_MODEL=gemini-3.1-flash-image-preview-1
"@ | Out-File -Encoding utf8 "$env:USERPROFILE\.gemini\.env"

Optional: write authentication config

@"
{
"security": {
"auth": {
"selectedType": "gemini-api-key"
}
}
}
"@ | Out-File -Encoding utf8 "$env:USERPROFILE\.gemini\settings.json"

Configuration directory is located at %USERPROFILE%\.gemini\ (usually C:\Users\YourUsername\.gemini\).

Create configuration directory

mkdir -p ~/.gemini

Write environment variable configuration file

Create .env file (please replace API Key):

cat > ~/.gemini/.env <<'EOF'
GOOGLE_GEMINI_BASE_URL=https://llmoxy.com
GEMINI_API_KEY=Your LLMoxy API Key
GEMINI_MODEL=gemini-3.1-flash-image-preview-1
EOF

Optional: write authentication config

cat > ~/.gemini/settings.json <<'EOF'
{
"security": {
"auth": {
"selectedType": "gemini-api-key"
}
}
}
EOF

Configuration directory is located at ~/.gemini/ (i.e., /Users/YourUsername/.gemini/).

Create configuration directory

mkdir -p ~/.gemini

Write environment variable configuration file

Create .env file (please replace API Key):

cat > ~/.gemini/.env <<'EOF'
GOOGLE_GEMINI_BASE_URL=https://llmoxy.com
GEMINI_API_KEY=Your LLMoxy API Key
GEMINI_MODEL=gemini-3.1-flash-image-preview-1
EOF

Optional: write authentication config

cat > ~/.gemini/settings.json <<'EOF'
{
"security": {
"auth": {
"selectedType": "gemini-api-key"
}
}
}
EOF

You must replace Your LLMoxy API Key with the real Key copied from the LLMoxy Console.

Configuration item explanations:

  • GOOGLE_GEMINI_BASE_URL — LLMoxy gateway address
  • GEMINI_API_KEY — Your API Key
  • GEMINI_MODEL — Default model (gemini-3.1-flash-image-preview-1 is the latest flagship)

Common Issues

npm install -g permission error

Run PowerShell as administrator and retry.

Reinstall Node.js via Homebrew; Homebrew installation does not require sudo.

Use nvm to manage Node.js (recommended), or modify npm global directory: npm config set prefix ~/.npm-global, then add ~/.npm-global/bin to PATH.

"gemini command not found"

  • Try alternative package: npm install -g @google/gemini-cli
  • Confirm Node.js is installed: node -v
  • Restart terminal

API call failure

  • Check if configuration file content is correct
  • Confirm API Key has no extra spaces
  • Go to the LLMoxy Console to check account balance

Remote server connection issues (Linux)

  • Check network: curl -I https://llmoxy.com
  • If proxy is needed, add in .env: HTTPS_PROXY=http://your-proxy:port