Docs Guides
Guide

Gemini CLI Relay Setup

Gemini CLI is Google's open-source command-line AI tool that brings Gemini into your terminal. With a relay (proxy), you can use it on restricted networks.

Overview

Gemini CLI is Google's open-source command-line AI tool that brings Gemini into your terminal. With a relay (proxy), you can use it on restricted networks.

Why Gemini CLI?

  • Gemini 2.5 Pro: 1M-token context window
  • Built-in tools: Google Search grounding, files, shell, web fetch
  • Extensible: MCP for custom integrations
  • Terminal-first: Built for CLI developers
  • Open source: Apache 2.0

Installation

Quick install

Run with npx (no install)

# Official repo npx https://github.com/google-gemini/gemini-cli
json

Install globally with npm

npm install -g @google/gemini-cli
json

Homebrew (macOS/Linux)

brew install gemini-cli
json

Requirements

  • Node.js 20+
  • macOS, Linux, or Windows

Configure a relay (proxy)

1. Environment variables

# API key export GEMINI_API_KEY=sk-xxxxx # Relay base URL export GOOGLE_GEMINI_BASE_URL=https://api.digislash.com # CMD set GEMINI_API_KEY=sk-xxxxx set GOOGLE_GEMINI_BASE_URL=https://api.digislash.com
json
Note: You can also add these to .bashrc, .zshrc, or another shell rc file.

Quick start

Basic usage

Current directory

gemini
json

Multiple directories

gemini --include-directories ../lib,../docs
json

Specific model

gemini -m gemini-2.5-flash
json

Non-interactive / scripts

Text response:

gemini -p "Explain this repository architecture"
json

Structured JSON:

gemini -p "Explain this repository architecture" --output-format json
json

Quick examples

New project

cd new-project/ gemini > Write a Discord bot that answers from my FAQ.md
json

Existing code

git clone https://github.com/google-gemini/gemini-cli cd gemini-cli gemini > Summarize all changes from yesterday
json

Main features

Code understanding & generation

  • Query and edit large codebases
  • Generate apps from PDFs, images, or sketches
  • Debug with natural language

Automation & integration

  • Automate tasks like PR queries or complex rebases
  • Connect capabilities via MCP servers
  • Run non-interactively in scripts

Advanced

  • Built-in Google Search for live info
  • Conversation checkpoints
  • Customize behavior with GEMINI.md

Common commands

Explore a codebase

> Describe the main components of this architecture > What security mechanisms exist? > Write a step-by-step onboarding guide for new developers
json

Work with existing code

> Draft an implementation for GitHub issue #123 > Help migrate this repo to the latest Java. Start with a plan
json

Automate workflows

> Make slides of the last 7 days of git history grouped by feature and teammate > Build a fullscreen wallboard of our hottest GitHub issues
json

System interaction

> Convert all images here to PNG and rename by EXIF date > Organize my PDF invoices by spend month
json

GitHub integration

Use the Gemini CLI GitHub Action:

  • Pull request review: automated review with contextual feedback
  • Issue triage: auto-label and prioritize issues
  • On-demand help: mention @gemini-cli in issues/PRs
  • Custom workflows: automated, scheduled, and on-demand flows

Troubleshooting

  1. Confirm env vars: echo $GEMINI_API_KEY echo $GOOGLE_GEMINI_BASE_URL
  2. Check network / relay: curl -I https://api.digislash.com
  3. Read error output
  4. SOCKS proxy format example: socks5://<user>:<pass>@<proxy>:<port>
  5. Report a bug from the CLI: /bug

Release channels

Preview

New preview every Tuesday 23:59 UTC:

npm install -g @google/gemini-cli@preview
json

Stable

New stable every Tuesday 20:00 UTC:

npm install -g @google/gemini-cli@latest
json

Nightly

Daily at 00:00 UTC:

npm install -g @google/gemini-cli@nightly
json

MCP servers

In ~/.gemini/settings.json configure MCP servers:

> @github list my open pull requests > @slack post today's commit summary to #dev > @database run a query for inactive users
json
  • Official roadmap
  • NPM package registry
  • GitHub Issues
  • Security advisories

Uninstall

Follow the official uninstall guide.