Free Track

Google Gemini for Coding — Overview

Google ships its Gemini models through three surfaces you'll actually touch as a developer: the Gemini CLI (an agent that lives in your terminal), the Gemini API (what your own apps call), and Google AI Studio (a browser playground where you prototype and grab an API key). This free overview shows what each one is for, how to get the CLI running in under a minute, and why its free tier makes it an easy tool to keep in your back pocket next to Claude Code and Codex.

The one-sentence version: use Google AI Studio to experiment in the browser and get a key, use the Gemini API when you're writing code that calls a model programmatically, and use the Gemini CLI when you want an agent to read and edit a real project from your terminal — the same job Claude Code and Codex do.

Moving fast: Gemini model names, free-tier quotas, and pricing change often. Everything below is accurate as of writing; before you rely on a specific model or limit, check the current docs at www.geminicli.com/docs and ai.google.dev.

Three surfaces, three jobs

People say "Gemini" to mean very different things. Sorting them out first saves a lot of confusion:

SurfaceWhat it isReach for it when…
Gemini CLI An open-source AI agent that runs in your terminal, reads your local project, and can edit files, run commands, and use tools. You want hands-on help inside a real repo — refactors, bug hunts, "explain this codebase," scripted automation.
Gemini API The HTTP/SDK endpoint your own software calls to send prompts and get model responses back. You're building a product that needs a model — a chatbot, a summarizer, a backend feature.
Google AI Studio A browser-based playground at aistudio.google.com to try prompts, compare models, tune settings, and create an API key. You're prototyping a prompt, kicking the tires on a new model, or need to generate a GEMINI_API_KEY.

This overview — and the premium deep dive — focus on the Gemini CLI, because that's the one that competes directly with Claude Code and OpenAI's Codex CLI: an agent that works your codebase from the command line.

Install & first run

The fastest path needs nothing installed — if you have Node.js, npx pulls and runs the CLI for you:

npx @google/gemini-cli Run the latest Gemini CLI without installing anything (needs Node.js).
npx @google/gemini-cli

If you'll use it regularly, install it globally so gemini is always on your PATH:

npm install -g @google/gemini-cli Install the CLI globally via npm.
npm install -g @google/gemini-cli
brew install gemini-cli Install on macOS (or Linuxbrew) with Homebrew.
brew install gemini-cli

Prefer to live on the edge? The package publishes release channels — pin one with the usual npm @tag syntax:

npx @google/gemini-cli@nightly Channels: @latest (stable, weekly), @preview, and @nightly.
npx @google/gemini-cli@latest    # stable, cut weekly
npx @google/gemini-cli@preview   # early access
npx @google/gemini-cli@nightly   # bleeding edge

Once it's installed, launch the interactive agent from inside a project directory:

gemini Start an interactive session in the current folder.
cd my-project
gemini

Signing in: the free tier vs an API key

This is Gemini CLI's headline feature. On first launch it offers to sign you in with your Google account — a browser window opens, you approve, and you're running against a generous free tier with no key management and no credit card. As of writing that free tier allows roughly 60 requests per minute and about 1,000 requests per day — plenty for everyday coding.

Why this matters: most coding agents assume you'll paste in an API key and start paying per token. Gemini CLI lets you get real work done for free just by logging in with the Google account you already have. That's the single biggest reason to keep it installed alongside your primary tool.

Need higher limits, a specific project, or billing/quotas you control? Use an API key from Google AI Studio instead. Set it as an environment variable and the CLI picks it up automatically:

export GEMINI_API_KEY Authenticate with a key created at aistudio.google.com.
export GEMINI_API_KEY="your-key-from-ai-studio"
gemini

Teams already on Google Cloud can route through Vertex AI instead of the AI Studio endpoint by setting the Vertex environment variables:

Vertex AI auth Use Google Cloud / Vertex AI instead of an AI Studio key.
export GOOGLE_API_KEY="your-vertex-key"
export GOOGLE_GENAI_USE_VERTEXAI=true
gemini

Don't commit keys. Keep GEMINI_API_KEY in your shell profile or a .env that's git-ignored — never hard-code it into a repo. For casual use, the Google-login free tier sidesteps key handling entirely.

A taste of different ways to run it

The interactive session is only one mode. Here are a few distinct patterns you'll use — the premium Gemini CLI in Depth module drills into each with real workflows.

Ask a one-off question without opening a session

The -p (prompt) flag runs non-interactively and prints the answer, which is perfect for scripts:

gemini -p Non-interactive: one prompt in, one answer out.
gemini -p "Summarize what this repo does in three bullet points"

Pipe a file in and get a plain answer

stdin + gemini -p Feed a file through the agent from the shell.
cat error.log | gemini -p "What is the root cause here, in one paragraph?"

Pick a model for the job

Use fast, cheap Flash for quick tasks and reserve heavier Pro reasoning for hard ones:

gemini -m Select the model (e.g. gemini-2.5-flash) for this run.
gemini -m gemini-2.5-flash -p "Write a one-line commit message for the staged diff"

Give it more of your project as context

--include-directories Pull in sibling folders (comma-separated) beyond the current one.
gemini --include-directories ../lib,../docs -p "Do the docs match the code in ../lib?"

Get machine-readable output for automation

--output-format json Emit structured JSON your scripts can parse (also stream-json for streaming).
gemini -p "List the TODO comments in this repo" --output-format json

Slash commands inside a session

Once you're in an interactive session, slash commands manage the conversation. A few to know:

CommandWhat it does
/helpList available commands and shortcuts.
/chatManage the current chat/conversation.
/bugFile a bug report about the CLI.

There are more (the deep dive covers them) — type /help in any session to see the full, current set for your version.

Persistent project context: drop a GEMINI.md file in your repo and the CLI reads it every session — the same idea as Claude Code's CLAUDE.md or Codex's AGENTS.md. Put conventions, build commands, and "always do X" rules there so you stop repeating yourself.

When to reach for Gemini CLI

Great fit

  • You want a capable coding agent for free — just log in with Google.
  • Large codebases: Gemini models offer a very large context window (up to ~1M tokens as of writing).
  • You're already in the Google/Vertex ecosystem.
  • Quick, scriptable one-offs via gemini -p … --output-format json.

Maybe reach elsewhere

  • You've standardized your team on Claude Code or Codex workflows and want one tool.
  • You need a feature only another CLI has today — the tools leapfrog each other constantly.
  • Heavy sustained use may exceed the free tier; plan for a key or paid quota.

How it compares to Claude Code & Codex

All three are agentic terminal tools that read your project, edit files, and run commands. The concepts map almost one-to-one — if you know one, you can pick up the others quickly. Details shift constantly, so treat this as an orientation, not a scorecard.

ConceptGemini CLIClaude CodeOpenAI Codex CLI
Launch gemini claude codex
One-off / headless gemini -p "…" claude -p "…" codex exec "…"
Project context file GEMINI.md CLAUDE.md AGENTS.md
Pick a model -m gemini-2.5-flash /model -m / /model
Extend with tools MCP via ~/.gemini/settings.json MCP via claude mcp MCP via codex mcp
No-cost path Generous free tier with a Google login Included in Claude subscriptions Included in ChatGPT plans

The standout: Gemini CLI's free tier lets you try a serious coding agent with zero setup cost. Even if another tool is your daily driver, it's worth having gemini installed for a second opinion, big-context tasks, or when you've hit a rate limit elsewhere.

Pitfalls to avoid

Watch out for these:

  • Confusing the surfaces. An AI Studio key, the raw API, and the CLI are different things — don't try to "call the CLI from your app"; call the API from your app and use the CLI at your terminal.
  • Assuming the free tier is unlimited. It's generous but capped (~60/min, ~1,000/day as of writing). Heavy or automated use needs an API key or paid quota.
  • Grabbing Pro for everything. Default to fast, cheap Flash; only switch to Pro when a task genuinely needs deeper reasoning. The deep dive covers this trade-off.
  • Hard-coding keys. Keep GEMINI_API_KEY out of your repo and out of shared shell history.
  • Trusting stale model names. Model IDs and quotas change; verify against current docs before you script against a specific one.

Go deeper

Gemini CLI in Depth

This was the free taster. The premium module walks through the full toolkit: install channels and auth in detail (OAuth vs GEMINI_API_KEY vs Vertex), interactive vs -p scripting, every flag (-m, --include-directories, --output-format json|stream-json), the full slash-command set, writing a strong GEMINI.md, wiring MCP servers through ~/.gemini/settings.json, choosing Flash vs Pro, and a complete "Gemini CLI vs Claude Code" mapping — with copy-pasteable recipes throughout.

Unlock Gemini CLI in Depth →