Integration guides

Gemini CLI

Google's command-line AI agent, speaking the native Gemini protocol; set a few environment variables to route requests to XylemNode.

Site / download
  1. 01

    Install and verify

    Install globally with npm (recommended); on macOS you can use Homebrew, or run it install-free with npx for a quick try. After installing, print the version to confirm.

    # npm (recommended, all platforms)
    npm install -g @google/gemini-cli
    
    # macOS Homebrew
    brew install gemini-cli
    
    # Run without installing
    npx @google/gemini-cli
    
    # Verify
    gemini --version
  2. 02

    Set environment variables

    Gemini CLI connects to custom services via environment variables — set three: endpoint, API key and default model. For the endpoint, the service domain is enough.

    # Windows (PowerShell / CMD)
    setx GOOGLE_GEMINI_BASE_URL "https://api.xylemnode.com"
    setx GEMINI_API_KEY "sk-your-key"
    setx GEMINI_MODEL "gpt-5.6-sol"
    
    # macOS / Linux
    export GOOGLE_GEMINI_BASE_URL="https://api.xylemnode.com"
    export GEMINI_API_KEY="sk-your-key"
    export GEMINI_MODEL="gpt-5.6-sol"
  3. 03

    Or use a .env file

    If you'd rather not set system variables, put these in a .env file that Gemini CLI loads on start. User-level applies everywhere; project-level applies only to that project.

    Windows
    %USERPROFILE%\.gemini\.env
    macOS / Linux
    ~/.gemini/.env
    Project-level
    <project-root>/.gemini/.env
    GOOGLE_GEMINI_BASE_URL=https://api.xylemnode.com
    GEMINI_API_KEY=sk-your-key
    GEMINI_MODEL=gpt-5.6-sol
  4. 04

    Launch and test

    Reopen the terminal and run gemini. You can also pick a model for the run with -m and do a non-interactive check with -p.

    gemini
    
    # Pick a model for this run / non-interactive check
    gemini -m gpt-5.6-sol -p "Reply with OK only"

Common questions

Gemini CLI still logs in with a Google account despite the environment variables — or won't switch back

The precedence is fixed: on the first run it walks you through a browser login and caches the credentials locally, so it stops asking. But whenever GEMINI_API_KEY exists in the environment or in a .env file, it uses that key straight away and never offers the login choice. So each direction has its own fix — still on OAuth when you wanted the relay usually means the key never reached the process (writing it with setx and not reopening the terminal is the classic case); unable to get back to a Google account means clearing GEMINI_API_KEY from the environment and from .env first, then clearing the cached credentials. Worth knowing: cc-switch configures Gemini through those same environment variables, which pins the CLI into API mode, and uninstalling cc-switch does not undo it.