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-clijsonInstall globally with npm
npm install -g @google/gemini-clijsonHomebrew (macOS/Linux)
brew install gemini-clijsonRequirements
- 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.comjsonNote: You can also add these to.bashrc,.zshrc, or another shell rc file.
Quick start
Basic usage
Current directory
geminijsonMultiple directories
gemini --include-directories ../lib,../docsjsonSpecific model
gemini -m gemini-2.5-flashjsonNon-interactive / scripts
Text response:
gemini -p "Explain this repository architecture"jsonStructured JSON:
gemini -p "Explain this repository architecture" --output-format jsonjsonQuick examples
New project
cd new-project/ gemini > Write a Discord bot that answers from my FAQ.mdjsonExisting code
git clone https://github.com/google-gemini/gemini-cli cd gemini-cli gemini > Summarize all changes from yesterdayjsonMain 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 developersjsonWork with existing code
> Draft an implementation for GitHub issue #123 > Help migrate this repo to the latest Java. Start with a planjsonAutomate workflows
> Make slides of the last 7 days of git history grouped by feature and teammate > Build a fullscreen wallboard of our hottest GitHub issuesjsonSystem interaction
> Convert all images here to PNG and rename by EXIF date > Organize my PDF invoices by spend monthjsonGitHub 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-cliin issues/PRs - Custom workflows: automated, scheduled, and on-demand flows
Troubleshooting
- Confirm env vars:
echo $GEMINI_API_KEY echo $GOOGLE_GEMINI_BASE_URL - Check network / relay:
curl -I https://api.digislash.com - Read error output
- SOCKS proxy format example:
socks5://<user>:<pass>@<proxy>:<port> - Report a bug from the CLI:
/bug
Release channels
Preview
New preview every Tuesday 23:59 UTC:
npm install -g @google/gemini-cli@previewjsonStable
New stable every Tuesday 20:00 UTC:
npm install -g @google/gemini-cli@latestjsonNightly
Daily at 00:00 UTC:
npm install -g @google/gemini-cli@nightlyjsonMCP 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 usersjsonRelated resources
- Official roadmap
- NPM package registry
- GitHub Issues
- Security advisories
Uninstall
Follow the official uninstall guide.
