Go to file
Abhi dd53e5c96a
Show session summary on exit for ctrl+c x 2. Fix exit UI (#963)
2025-06-11 20:08:32 -04:00
.gcp refactor: rename gemini-code to gemini-cli (#822) 2025-06-07 14:27:22 -07:00
.gemini toggle off (#809) 2025-06-07 00:06:15 -07:00
.github Update package-lock.json (#738) 2025-06-04 04:05:39 +00:00
.vscode refactor: rename gemini-code to gemini-cli (#822) 2025-06-07 14:27:22 -07:00
docs add excludeTools flag to settings.json config (#957) 2025-06-11 14:32:23 -07:00
eslint-rules feat: add custom eslint rule for cross-package imports (#77) 2025-04-21 08:02:11 -07:00
packages Show session summary on exit for ctrl+c x 2. Fix exit UI (#963) 2025-06-11 20:08:32 -04:00
scripts fixes to proxy on macos: prevent curl from hanging during wait-for-proxy by adding ipv6 support and timeout (#947) 2025-06-11 11:31:38 -07:00
.gitignore refactor: rename gemini-code to gemini-cli (#822) 2025-06-07 14:27:22 -07:00
.npmrc refactor: rename gemini-code to gemini-cli (#822) 2025-06-07 14:27:22 -07:00
.prettierrc.json Run `npm run format` 2025-04-17 15:29:34 -07:00
CONTRIBUTING.md fixes to proxy on macos: prevent curl from hanging during wait-for-proxy by adding ipv6 support and timeout (#947) 2025-06-11 11:31:38 -07:00
Dockerfile restricted networking for all sandboxing methods, new seatbelt profiles, updated docs, fixes to sandbox build, debugging through sandbox (#891) 2025-06-10 08:58:37 -07:00
GEMINI.md Docs: Enhance "Writing Tests" section in GEMINI.md (#688) 2025-06-02 21:46:20 -07:00
LICENSE add LICENSE (#25) 2025-04-18 10:30:07 -07:00
Makefile Makefile for convenience (#833) 2025-06-07 22:22:32 -07:00
README.md TEST: reviewers (#959) 2025-06-11 22:09:33 +00:00
esbuild.config.js fix version set for cli and slash commands (#892) 2025-06-11 08:25:26 -05:00
eslint.config.js fix(deps): externalize tree-sitter (#840) 2025-06-08 02:05:55 -07:00
learnings.md Ignore folders files (#651) 2025-06-04 04:40:46 +00:00
package-lock.json Restore Checkpoint Feature (#934) 2025-06-11 15:33:09 -04:00
package.json Windows: Refactor Shell Scripts to Node.js for Cross-Platform Compatibility (#784) 2025-06-09 12:19:42 -07:00
tsconfig.json Fix: Prevent hang in large directories by using BFS for getFolderStru… (#470) 2025-05-22 10:47:21 -07:00

README.md

Gemini CLI

Gemini CLI CI

This repository contains the Gemini CLI tool.

Quickstart

  1. Install Node 18+
  2. Set your API key: export GEMINI_API_KEY="YOUR_API_KEY" (Get an API key)
  • For future sessions you can add this to your shell's configuration file, or use a .env file in your project's hierarchy
  1. Run with: npx https://github.com/google-gemini/gemini-cli#early-access
  2. Enjoy

Examples

Once the CLI is running, you can start interacting with Gemini. Try a simple query:

> How can I build a web app?

Or ask it to perform a task using its tools:

> List files in the current directory.

API Key Setup

The Gemini CLI requires a Gemini API Key. It supports several ways to authenticate with Google's AI services. You'll need to configure one of the following methods:

  1. Gemini API Key:

    • Obtain your API key from Google AI Studio: https://aistudio.google.com/app/apikey
    • Set the GEMINI_API_KEY environment variable. You can do this temporarily in your current shell session:
      export GEMINI_API_KEY="YOUR_GEMINI_API_KEY"
      
      Or add it to your .env file (in project directory or user home) or shell's configuration file (like ~/.bashrc, ~/.zshrc, or ~/.profile) for persistence:
      echo 'export GEMINI_API_KEY="YOUR_GEMINI_API_KEY"' >> ~/.bashrc # Or your preferred shell config file
      source ~/.bashrc # Reload the config
      
      Replace "YOUR_GEMINI_API_KEY" with your actual key.
  2. Google API Key (Vertex AI Express Mode):

    • This key can be a general Google Cloud API key enabled for the Gemini API or Vertex AI.
    • Set the GOOGLE_API_KEY and GOOGLE_GENAI_USE_VERTEXAI environment variables:
      export GOOGLE_API_KEY="YOUR_GOOGLE_API_KEY"
      export GOOGLE_GENAI_USE_VERTEXAI=true
      
  3. Vertex AI (Project and Location):

    • Ensure you have a Google Cloud Project and have enabled the Vertex AI API.
    • Set up Application Default Credentials (ADC). For more details, refer to the official Google Cloud ADC documentation:
      gcloud auth application-default login
      
    • Set the GOOGLE_CLOUD_PROJECT, GOOGLE_CLOUD_LOCATION, and GOOGLE_GENAI_USE_VERTEXAI environment variables:
      export GOOGLE_CLOUD_PROJECT="YOUR_PROJECT_ID"
      export GOOGLE_CLOUD_LOCATION="YOUR_PROJECT_LOCATION" # e.g., us-central1
      export GOOGLE_GENAI_USE_VERTEXAI=true
      

Next Steps

Congratulations! You've successfully set up and run the Gemini CLI.

Gemini APIs

This project leverages the Gemini APIs to provide AI capabilities. For details on the terms of service governing the Gemini API, please refer to the Gemini API Terms of Service.