Connect Gemini CLI

Route Gemini CLI through AnyInt's Gemini-compatible gateway with an API key.

Gemini CLI supports a custom Gemini API origin when using API-key authentication. AnyInt exposes the Gemini Developer API under the /gemini gateway root.

Before You Start

  1. Install or update Gemini CLI from the official Gemini CLI repository.
  2. Create an AnyInt API key.
  3. Choose a Gemini-compatible model ID from the model catalog.

Configure the Gateway

Gemini CLI reads GEMINI_API_KEY for API-key authentication and the base-URL variable shown below for the API origin.

bash
export ANYINT_API_KEY="your_api_key"
export GEMINI_API_KEY="$ANYINT_API_KEY"
export GOOGLE_GEMINI_\
BASE_URL="https://api.anyint.ai/gemini"
export GEMINI_MODEL="YOUR_MODEL_ID"

Start the CLI and choose Use Gemini API key when prompted:

bash
gemini

Verify and Troubleshoot

  • A 401 response means the AnyInt key was not supplied or is inactive.
  • A model error means GEMINI_MODEL does not name a Gemini-compatible model available to the key.
  • Remove conflicting Google Cloud authentication variables while isolating an API-key setup problem.
  • Keep .env files containing keys out of source control. Gemini CLI also supports a user-level .gemini/.env file when you need persistent local configuration.

See the official Gemini CLI configuration and authentication documentation for current variable behavior.