# Gemini CLI Setup ## Installation The Gemini CLI is an official tool from Google to interact with Gemini models from your terminal. ### Option 1: Local Installation (Recommended for this project) This project includes Gemini CLI as a local npm dependency. Simply run: ```shell npm install ``` Or use the setup script: ```shell bash setup.sh # Then select option 2: Install npm dependencies ``` The Gemini CLI will be available at `./node_modules/.bin/gemini`. To use it, either: - Run directly: `./node_modules/.bin/gemini` - Or use via npm script: `npx gemini` ### Option 2: Global Installation Install it globally using npm: ```shell sudo npm install -g @google/gemini-cli ``` This makes the `gemini` command available system-wide. ## Version Information This project uses Gemini CLI version `0.30.0-nightly.20260212.207ac6f2d`, which includes important fixes for headless mode detection (commit `6a2f2d3a91380985c9ada6d39219fb353b4291b2`). ## Authentication The Gemini CLI requires a Google AI API Key. You can get one from [Google AI Studio](https://aistudio.google.com/). ### Option 1: Environment Variable (Recommended) Set the `GEMINI_API_KEY` environment variable in your shell profile or `.env` file: ```shell 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`: ```json { "auth": { "apiKey": "your_api_key_here" } } ``` ## Usage ### Interactive Mode Simply run the command to start a chat: ```shell # If installed locally npx gemini # If installed globally gemini ``` ### Non-Interactive Mode Send a single prompt and exit: ```shell # If installed locally npx gemini --prompt "What is the capital of France?" # If installed globally gemini --prompt "What is the capital of France?" ``` ### Using a Specific Model ```shell # If installed locally npx gemini --model gemini-2.0-flash --prompt "Analyze this code..." # If installed globally gemini --model gemini-2.0-flash --prompt "Analyze this code..." ``` ## Quick Verification Check the version to ensure it is installed correctly: ```shell # If installed locally npx gemini --version # If installed globally gemini --version ``` Expected output: `0.30.0-nightly.20260212.207ac6f2d`