Skip to content

Deploy Gemini CLI

Configure Gemini CLI to use 3xCoder as its API endpoint.

Prerequisites

Step 1: Install Gemini CLI

bash
npm install -g @anthropic-ai/gemini-cli

Or use npx without installing:

bash
npx @anthropic-ai/gemini-cli

Verify installation:

bash
gemini --version

Step 2: Configure Gemini CLI

Gemini CLI can be configured using environment variables and a settings file.

Using Environment Variables

powershell
$env:GEMINI_API_KEY = "sk-your-api-key-here"
bash
export GEMINI_API_KEY="sk-your-api-key-here"

Using .env File

Create a .env file in your project directory or home directory:

bash
GEMINI_API_KEY=sk-your-api-key-here

Settings File

Windows

Edit %APPDATA%\gemini\settings.json:

json
{
  "baseUrl": "https://api.3xcoder.com/v1beta/models",
  "apiKey": "sk-your-api-key-here"
}

macOS

Edit ~/Library/Application Support/gemini/settings.json:

json
{
  "baseUrl": "https://api.3xcoder.com/v1beta/models",
  "apiKey": "sk-your-api-key-here"
}

Linux

Edit ~/.config/gemini/settings.json:

json
{
  "baseUrl": "https://api.3xcoder.com/v1beta/models",
  "apiKey": "sk-your-api-key-here"
}

Step 3: Verify

Run Gemini CLI:

bash
gemini

If configured correctly, Gemini CLI will connect through the 3xCoder relay.

Using CC-Switch

You can also configure Gemini CLI through CC-Switch:

  1. Run npx cc-switch@latest
  2. Select Gemini CLI as the target tool
  3. Set the base URL to https://api.3xcoder.com/v1beta/models
  4. Enter your API key
  5. Apply the configuration

Troubleshooting

gemini: command not found

  • Ensure Node.js is installed and npm global bin is in your PATH
  • Try npx @anthropic-ai/gemini-cli instead

Authentication errors

  • Verify your API key is correct
  • Make sure the key has access to Gemini models in your 3xCoder dashboard
  • Check that the base URL matches exactly: https://api.3xcoder.com/v1beta/models

Connection timeouts

  • Check your internet connection
  • Try: curl https://api.3xcoder.com/v1/models -H "Authorization: Bearer sk-your-key"
  • If behind a proxy, configure the HTTPS_PROXY environment variable

3xCoder — Unified AI API Endpoint