Gemini CLI
Use Gemini CLI with NanoGPT to access Gemini, GPT, Claude, and 400+ models through a single API key.Gemini CLI is Google’s official command-line interface for Gemini. The official CLI only targets Google endpoints, so use the community fork that adds OpenRouter and OpenAI-compatible support to point it at NanoGPT.
Step 1: Install the OpenRouter Fork
Prerequisites: Node.js 18 or newerThis fork is community maintained. If the branch name changes or is missing, check the repository README for the latest OpenRouter-compatible branch.
Step 2: Configure NanoGPT
Get API Key
- Go to NanoGPT API
- Create an account or log in
- Copy your API key (starts with
sk-nano-)
Step 3: Start Gemini CLI
From thegemini-cli folder, launch the CLI:
Models
Once connected, you can use any model listed on the NanoGPT pricing page, including:google/gemini-3-pro-previewgoogle/gemini-3-flash-previewopenai/gpt-5.2anthropic/claude-opus-4.5
Optional: Verify Your Connection
Troubleshooting
| Issue | Solution |
|---|---|
401 Unauthorized | Check your API key and ensure your account has credits |
Connection refused | Verify OPENROUTER_BASE_URL is set to https://nano-gpt.com/api/v1 |
Model not found | Confirm the model name at nano-gpt.com/pricing |
| CLI not recognizing variables | Restart your terminal or set the variables in the same session |