Overview
Gemini CLI is Google’s open-source command-line AI agent for developers. It connects directly to Gemini models and can understand your codebase, generate code, run commands, and assist with complex development tasks. By configuring Gemini CLI to use FoxAPI, you can access Gemini models through FoxAPI’s API infrastructure.Prerequisites
FoxAPI API Key
An active FoxAPI API key with access to Gemini models.
Node.js 20+
Node.js v20 or later and npm are required for installing Gemini CLI.
Installation & Configuration
Set Your API Key
Add your FoxAPI API key to your shell profile (Then reload your shell configuration:
~/.bashrc, ~/.zshrc, etc.):- macOS / Linux
- Windows PowerShell
Modify the Base URL
Gemini CLI does not support custom base URLs through configuration. You need to modify two source files inside the installed package.First, find your npm global installation directory:Then modify the following two files:File 1:
{install_dir}/@google/gemini-cli/node_modules/@google/genai/dist/node/index.mjs (around line ~11222)File 2: {install_dir}/@google/gemini-cli/node_modules/@google/genai/dist/node/index.cjs (around line ~11244)In both files, find and replace:Verify the Connection
Run a test command to confirm everything is working:Available Models
| Model | Description |
|---|---|
gemini-2.5-pro | Most capable Gemini model for complex tasks |
gemini-2.5-flash | Fast and efficient for everyday coding tasks |
gemini-3-pro-preview | Next-gen Gemini Pro preview |
gemini-3-flash-preview | Next-gen Gemini Flash preview |
Troubleshooting
Authentication error
Authentication error
- Verify your FoxAPI API key is correct and starts with
sk-. - Ensure the
GEMINI_API_KEYenvironment variable is set properly. - Check that the key has sufficient balance and access to Gemini models.
Connection timeout or errors
Connection timeout or errors
- Verify the base URL modification was applied correctly in both files (
index.mjsandindex.cjs). - Check your network connection to
api.foxapi.cc. - Try using a VPN if your region has connectivity issues.
Changes lost after update
Changes lost after update
- After running
npm update -g @google/gemini-cli, the source files are overwritten. - Re-apply the base URL modification following Step 3 above.
Model not available
Model not available
- Confirm the model name matches the FoxAPI model list.
- Use
/modelin interactive mode to switch between available models.