Skip to main content

Overview

Gemini CLI Interface Gemini CLI is Google’s official command-line tool for interacting with Gemini models in the terminal. By integrating Gemini CLI with EvoLink API, you can go beyond official model limits and access EvoLink’s broader model set, including Gemini, GPT, and Claude series models, through one entry point.

Prerequisites

Before configuring, make sure you have:

1. Install Node.js and npm

Why needed? Node.js is the runtime environment for CLI tools (like installing WeChat on your phone to chat, you need to install Node.js on your computer to run CLI tools). If already installed: Run node -v and npm -v to check version. If v20+, skip this step. First-time installation:
node -v
npm -v
Node.js and npm version verification
  • Log in to EvoLink Dashboard
  • Find API Keys in the dashboard, click ‘Create New Key’ button, then copy the generated Key
  • API Key usually starts with sk-

How to Open Terminal

  • Method 1: Press Win + R, type cmd or powershell, then press Enter
  • Method 2: Search for “Command Prompt” or “PowerShell” in the Start menu
  • Method 3: Hold Shift and right-click in a folder, select “Open PowerShell window here”

Step 1: Install Gemini CLI

1. Install command

npm install -g @google/gemini-cli
Expected result: Download info scrolling, ending with added XX packages (takes 1-3 minutes). If error occurs: permission denied means Windows needs “Run as administrator” PowerShell, macOS/Linux add sudo before command.

2. Verify Installation

gemini --version
Success indicator: Shows version number (e.g., 1.x.x). Gemini CLI Version ⚠️ Important: Gemini CLI configuration is slightly more complex than other tools, requiring modification of installation files. If you’re new to programming, consider using Claude CLI or Codex CLI first (simpler configuration).

1. Find installation directory

npm root -g
You’ll see a path like:
  • Windows: C:\Users\YourUsername\AppData\Roaming\npm\node_modules
  • macOS: /usr/local/lib/node_modules
  • Linux: /usr/lib/node_modules
Find Gemini CLI installation directory

2. Modify API endpoint

Modify 2 files: File location File 1: {install_dir}\@google\gemini-cli\node_modules\@google\genai\dist\node\index.mjs Find line ~11222:
// Before
initHttpOptions.baseUrl = `https://generativelanguage.googleapis.com/`;

// After
initHttpOptions.baseUrl = `https://code.evolink.ai/`;
Modify mjs file File 2: {install_dir}\@google\gemini-cli\node_modules\@google\genai\dist\node\index.cjs Find line ~11244, make the same change. Modify cjs file

3. Configure API Key

Temporary (current session only)
$env:GEMINI_API_KEY = "your-evolink-api-key"
Permanent
[Environment]::SetEnvironmentVariable("GEMINI_API_KEY", "your-evolink-api-key", "User")
Restart the terminal for changes to take effect.Verify Configuration
echo $env:GEMINI_API_KEY
If it outputs your API Key, the configuration is successful.Check environment variable

Step 3: Start Using Gemini CLI

1. Enter working directory

cd <your-working-directory>
Note: Replace <your-working-directory> with actual path

2. Single query mode

gemini "Who are you"

3. Interactive mode

gemini
Gemini CLI Interface Success indicators:
  • See AI response text (several lines)
  • No errors like 401, 403, API Key invalid
If you see errors:
  • 401 Unauthorized: API Key not set or invalid → Check environment variable
  • 403 Forbidden: Insufficient API Key permissions → Verify API endpoint modification
  • Network error: Network issue → Check connection

FAQ

1. What is Gemini CLI and what is it used for?

Gemini CLI is Google’s official command-line tool for interacting with Gemini models in the terminal. With EvoLink configuration, you can also access GPT, Claude, and other models.

2. How do I verify installation and configuration on first use?

Run these commands in sequence:
  • node -v and npm -v: Confirm Node.js and npm are installed
  • gemini --version: Confirm Gemini CLI is installed
  • gemini "Who are you": Confirm API configuration is correct

3. What’s the difference between interactive mode and single command mode?

  • Interactive mode: Run gemini to enter continuous conversation for multi-turn interactions
  • Single command mode: Run gemini "question" to get a single response and exit

4. Will Gemini CLI automatically read or upload my local files and code?

No. Gemini CLI only reads file content when you explicitly reference or authorize it. It’s recommended to use it in a dedicated project folder.

5. How do I use Gemini CLI to analyze local file content?

In interactive mode, you can reference files by:
  • Typing the file path for Gemini to read
  • Dragging files into the terminal window

6. Does Gemini CLI support Chinese input and output?

Yes, fully supported.

7. No output after execution—what could be the cause?

Common causes include:
  • Network connection issues
  • Invalid API Key or insufficient balance
  • Incorrect API endpoint configuration
  • Firewall or proxy blocking requests

8. Why don’t my API endpoint or environment variable changes take effect?

  • Restart your terminal or command line window
  • Confirm GEMINI_API_KEY environment variable is set correctly
  • Confirm API endpoint files are modified correctly (need to modify .mjs and .cjs files in node_modules)

9. What causes 401/403 errors?

  • 401 error: GEMINI_API_KEY not set or invalid
  • 403 error: Insufficient permissions or expired key
  • Verify API endpoint is https://code.evolink.ai/

10. What scenarios is Gemini CLI suited for?

Suited for:
  • Code writing, debugging, and refactoring
  • Quick Q&A in command-line environments
  • File content analysis
  • Automation script integration
Not suited for:
  • Complex GUI interactions
  • Real-time collaborative editing
  • Large-scale batch file processing

11. How do I switch models?

Type /model in interactive mode. Gemini CLI Switch Model Available models:
  • gemini-2.5-pro
  • gemini-2.5-flash
  • gemini-3-pro-preview
  • gemini-3-flash-preview

12. How do I upload images?

  • Option 1: Reference the image path
  • Option 2: Drag and drop an image into the terminal
All methods require user action—Gemini CLI will not automatically read or upload local images.

Notes

Run Gemini CLI in a dedicated project folder. Avoid running it in sensitive directories (such as system folders or directories containing credentials). Gemini CLI operates starting from the current working directory.