The Gemini CLI is Google's open-source, terminal-based AI agent. It's free to start with a personal Google account and drops straight into your project directory, making it an easy on-ramp to agentic coding.
Install with npm
The CLI is distributed on npm and needs a modern Node runtime.
node --version # needs Node 20 or newer
npm install -g @google/gemini-cli
gemini --versionYou can also run it without installing via npx @google/gemini-cli.
Sign in
Launch gemini and choose Google account login for the free tier, or set an API
key from Google AI Studio for higher limits and scripting.
gemini # interactive: sign in with Google
# or use an API key:
export GEMINI_API_KEY="..." # from Google AI StudioChoose a model
Different models trade speed for capability. Set a default so every session uses the one you want.
gemini --model gemini-2.5-pro # highest capability
gemini --model gemini-2.5-flash # faster and cheaperAdd project context
Like other agents, Gemini reads a project instructions file — GEMINI.md — so
it respects your conventions.
# Guidelines
- This is a Spring Boot service on Java 21.
- Prefer constructor injection.
- Do not modify database migration files.Takeaways
- Install globally with npm on Node 20+, or run it with
npx. - Google-account login unlocks a free tier; use an API key for automation.
- A
GEMINI.mdfile gives the agent your project's ground rules.
Pick flash for quick iteration and switch to pro when a task needs deeper
reasoning — you can change models mid-session.