← All articles
AI Tools1 min read

Getting Started with the Gemini CLI

Google's Gemini CLI is an open-source terminal agent with a generous free tier. Here's how to install it, sign in, and pick a model.

S

Swapnika Voora

Author

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.

install.sh
node --version        # needs Node 20 or newer
npm install -g @google/gemini-cli
gemini --version

You 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.

auth.sh
gemini                       # interactive: sign in with Google
# or use an API key:
export GEMINI_API_KEY="..."  # from Google AI Studio

Choose a model

Different models trade speed for capability. Set a default so every session uses the one you want.

model.sh
gemini --model gemini-2.5-pro     # highest capability
gemini --model gemini-2.5-flash   # faster and cheaper

Add project context

Like other agents, Gemini reads a project instructions file — GEMINI.md — so it respects your conventions.

GEMINI.md
# 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.md file 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.

#gemini#google#cli#setup

More in AI Tools