Client setup

Gemini CLI Setup Guide

Install Gemini CLI, configure the ZhenAPI endpoint and credentials, and verify your command-line connection.

Install Gemini CLI and connect to ZhenAPI to use Gemini models.

Gemini CLI is the official Google AI assistant for the terminal. Follow this guide to install and configure it.

⚠️ Note:Before you start, complete the Node.js installation guide.

Step 1: Install Gemini CLI

CMD / PowerShell
1npm install -g @google/gemini-cli

Verify installation

TERMINAL
1gemini --version

If a version number appears, installation succeeded.

Step 2: Configure environment variables

Set these three environment variables to connect Gemini CLI to ZhenAPI:

  • GOOGLE_GEMINI_BASE_URL -- API endpoint
  • GEMINI_API_KEY -- Your API key
  • GEMINI_MODEL -- Model to use

Temporary settings (current session)

POWERSHELL
1$env:GOOGLE_GEMINI_BASE_URL = "https://api.zhenapi.ai"2$env:GEMINI_API_KEY = "YOUR_API_KEY"3$env:GEMINI_MODEL = "gemini-3.8-flash"

Persistent settings

POWERSHELL
1[System.Environment]::SetEnvironmentVariable("GOOGLE_GEMINI_BASE_URL", "https://api.zhenapi.ai", [System.EnvironmentVariableTarget]::User)2[System.Environment]::SetEnvironmentVariable("GEMINI_API_KEY", "YOUR_API_KEY", [System.EnvironmentVariableTarget]::User)3[System.Environment]::SetEnvironmentVariable("GEMINI_MODEL", "gemini-3.8-flash", [System.EnvironmentVariableTarget]::User)
💡 Replace YOUR_API_KEY with an API key copied from the Dashboard page. Change GEMINI_MODEL to select a different model.

Step 3: Start using the client

After configuration, run this from your project directory:

TERMINAL
1gemini

Gemini CLI analyzes the code in the current directory and provides coding assistance.

Test command

Noninteractive prompt:

TERMINAL
1gemini -p "Hello"

For more information, see the Google AI documentation .