Gemini CLI Setup Guide 2026 — Install and Configure Your API Key
Install Gemini CLI with npm and connect to the ngaicode Gemini API on macOS, Linux, or Windows. Includes a manual configuration example for gemini-4-neon.
About the product used in this article
This guide uses the Gemini API from ngaicode. You’ll receive an API key after ordering a Gemini plan. View Gemini plans and pricing or contact support on WhatsApp for help with setup or ordering.
1. Install and Configure Gemini CLI
1.1 Install Gemini CLI
If you already have Gemini CLI installed, skip to 1.2 Configure Key.
Install or update Node.js to v20.0.0 or later, then open your terminal.
1. Install Gemini CLI globally.
npm install -g @google/gemini-cli2. Verify that Gemini CLI is installed. The command should print a version number.
gemini --version1.2 Configure Key
Run the configuration command for your operating system and shell. The script backs up your existing configuration before updating it.
# macOS / Linux
curl -fsSL https://ngaicode.com/install/gemini/gemini-config-api.sh | bash# Windows PowerShell
irm https://ngaicode.com/install/gemini/gemini-config-api.ps1 | iex# Windows CMD
curl -fsSL https://ngaicode.com/install/gemini/gemini-config-api.bat -o "%TEMP%\gemini-config.bat" && "%TEMP%\gemini-config.bat"Manual Configuration
Open or create ~/.gemini/.env (%USERPROFILE%\.gemini\.env on Windows). Copy the settings below into the file, replacing any existing values for these three variables. Replace YOUR_NGAICODE_API_KEY with your key and save the file.
GEMINI_API_KEY=YOUR_NGAICODE_API_KEY
GOOGLE_GEMINI_BASE_URL=https://cc.getapihub.com
GEMINI_MODEL=gemini-4-neonReopen Gemini CLI. If it’s set to another sign-in method, run /auth and choose Use Gemini API key.
Using the Antigravity desktop app? Click here for the Antigravity setup guide.
2. Troubleshooting
Q: How Do I Check Key Usage?
Enter your API key on the Key Usage page to check your quota and available models.
Related Resources
Ready to Set Up Gemini CLI?
- Choose a plan on the ngaicode pricing page.
- Order and receive your API key through WhatsApp.
- Configure Gemini CLI by following Section 1.2.
