Gemini CLI

Gemini CLI is a tool that lets you interact with Gemini models through a command-line interface.

You can view Help Guidearrow-up-right for more details.

Install Gemini CLI

Install Gemini CLI globally using npm:

npm install -g @google/gemini-cli

After installation, the gemini command will be available in your terminal.

Configuration

Gemini CLI reads its configuration from environment variables.

Step 1: Open (or create) the environment file

vim ~/.env

Step 2: Add the following configuration

# Base URL for Gemini requests routed through AI Gateway
GOOGLE_GEMINI_BASE_URL=https://gateway.theturbo.ai

# Your AI Gateway / AI Gateway API key
GEMINI_API_KEY=YOUR_API_KEY

# Default Gemini model
GEMINI_MODEL=gemini-2.5-flash

Replace YOUR_API_KEY with the API key generated after creating an AI Gateway instance.

Use Gemini CLI

Once configured, start Gemini CLI by running:

Gemini CLI will now send all requests through AI Gateway, allowing centralized access to Gemini models with unified authentication and management.

circle-info

Note

  • Make sure the environment variables are loaded in your shell session.

  • You can change the default model by updating the GEMINI_MODEL value.

  • Keep your API key secure and avoid committing it to source control.

Last updated