MQL5-Google-Onedrive/docs/Gemini_CLI_setup.md
2026-02-13 03:50:20 +00:00

1.1 KiB

Gemini CLI Setup

Installation

The Gemini CLI is an official tool from Google to interact with Gemini models from your terminal.

Install it globally using npm:

sudo npm install -g @google/gemini-cli

Authentication

The Gemini CLI requires a Google AI API Key. You can get one from Google AI Studio.

Set the GEMINI_API_KEY environment variable in your shell profile or .env file:

export GEMINI_API_KEY="your_api_key_here"

Option 2: Settings File

You can also set the API key in the Gemini CLI settings file at ~/.gemini/settings.json:

{
  "auth": {
    "apiKey": "your_api_key_here"
  }
}

Usage

Interactive Mode

Simply run the command to start a chat:

gemini

Non-Interactive Mode

Send a single prompt and exit:

gemini --prompt "What is the capital of France?"

Using a Specific Model

gemini --model gemini-2.0-flash --prompt "Analyze this code..."

Quick Verification

Check the version to ensure it is installed correctly:

gemini --version