All guides

OfficialGemini / GoogleGoogle

Gemini CLI

Google's official terminal agent.

The quickest path is an API key from Google AI Studio set as GEMINI_API_KEY. You can also just launch it and log in with your Google account for the free tier.

Official docs

Setup steps

  1. 1

    Install the CLI

    Requires Node.js 20 or newer. Installs the global gemini command.

    bash
    npm install -g @google/gemini-cli
  2. 2

    Get an API key

    Create a free key in Google AI Studio and copy it.

    text
    https://aistudio.google.com/apikey
  3. 3

    Set the key

    Store it in the GEMINI_API_KEY environment variable. Add it to your shell profile to keep it across sessions.

    bash / zsh
    export GEMINI_API_KEY="your-api-key"
    PowerShell
    setx GEMINI_API_KEY "your-api-key"
  4. 4

    Start coding

    Run it inside your project folder to chat, read and edit code.

    bash
    gemini
Tip: No key needed to try it: run gemini and sign in with a Google account. For higher limits and API billing, use a GEMINI_API_KEY.
Pick a cheaper model or provider first, then plug its key and endpoint into the steps above. Compare prices · Browse providers