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-cliBASH
1sudo npm install -g @google/gemini-cliOption 1: macOS (npm)
BASH
1npm install -g @google/gemini-cliOption 2: macOS (Homebrew)
BASH
1brew install gemini-cliVerify installation
TERMINAL
1gemini --versionIf 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 endpointGEMINI_API_KEY-- Your API keyGEMINI_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"BASH
1export GOOGLE_GEMINI_BASE_URL="https://api.zhenapi.ai"2export GEMINI_API_KEY="YOUR_API_KEY"3export GEMINI_MODEL="gemini-3.8-flash"BASH
1export GOOGLE_GEMINI_BASE_URL="https://api.zhenapi.ai"2export GEMINI_API_KEY="YOUR_API_KEY"3export 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)BASH
1echo 'export GOOGLE_GEMINI_BASE_URL="https://api.zhenapi.ai"' >> ~/.bashrc2echo 'export GEMINI_API_KEY="YOUR_API_KEY"' >> ~/.bashrc3echo 'export GEMINI_MODEL="gemini-3.8-flash"' >> ~/.bashrc4source ~/.bashrcZSH
1echo 'export GOOGLE_GEMINI_BASE_URL="https://api.zhenapi.ai"' >> ~/.zshrc2echo 'export GEMINI_API_KEY="YOUR_API_KEY"' >> ~/.zshrc3echo 'export GEMINI_MODEL="gemini-3.8-flash"' >> ~/.zshrc4source ~/.zshrc 💡 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
1geminiGemini 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 .