Canonical docs: https://apidoc.cometapi.com/integrations/gemini-cli
Use this guide to configure Gemini CLI with CometAPI credentials, base URL settings, and Gemini model IDs. Use this guide to run Gemini CLI with CometAPI as the API endpoint.
Official references:
Note Model availability changes over time. Check the CometAPI Models page for available Gemini models.
| Requirement | Details |
|---|---|
| Node.js | 22+ (LTS recommended) |
| OS | macOS, Linux, or Windows |
| CometAPI key | From your CometAPI Dashboard (starts with sk-) |
npm install -g @google/gemini-cliOr via Homebrew (macOS / Linux):
brew install gemini-cliVerify:
gemini --versionexport GEMINI_API_KEY="sk-your-cometapi-key"
export GOOGLE_GEMINI_BASE_URL="https://api.cometapi.com"Replace sk-your-cometapi-key with your actual CometAPI key.
cd your-project
geminiOn first launch, you'll be prompted to choose a theme, confirm the safety notice, and trust the working directory.
To avoid re-exporting every session, add to your shell config:
# Add to ~/.zshrc (macOS) or ~/.bashrc (Linux)
export GEMINI_API_KEY="sk-your-cometapi-key"
export GOOGLE_GEMINI_BASE_URL="https://api.cometapi.com"Restart your terminal for changes to take effect.
Verify GEMINI_API_KEY is set correctly. Run echo $GEMINI_API_KEY to check.
Network restrictions may block the connection. Try a system-wide proxy.
Gemini CLI requires Node.js 22+. Run node --version to check.
Run npm uninstall -g @google/gemini-cli.