Skip to main content
Use this guide to run Gemini CLI with CometAPI as the API endpoint. Official references:
Model availability changes over time. Check the CometAPI Models page for available Gemini models.

Prerequisites

Setup

1

Install Gemini CLI

Or via Homebrew (macOS / Linux):
Verify:
2

Set environment variables

Replace sk-your-cometapi-key with your actual CometAPI key.
3

Start Gemini CLI

On first launch, you’ll be prompted to choose a theme, confirm the safety notice, and trust the working directory.

Persist environment variables

To avoid re-exporting every session, add to your shell config:
Restart your terminal for changes to take effect.

Troubleshooting

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.