Gemini CLI Configuration
Gemini CLI is Google's terminal AI tool. It is suitable for using Gemini in the command line for Q&A, code understanding, and project assistance.
Official information Downloads and documentation are subject to the official site.
What this tool is and what it is used for
Google GeminiTerminal toolsGoogle loginGemini API Key
Select the authentication method first
| Method | Who it is suitable for | Description |
|---|---|---|
| Google login | Individual Users and Beginners | Run Gemini and log in as prompted |
| Gemini API Key | Users Who Already Have a Google AI Studio Key | Put the Key into GEMINI_API_KEY |
| Vertex AI | Enterprise or Cloud Project Users | Configure according to Google Cloud projects and permissions |
How to Test the API Key
Temporary testing in PowerShell
$env:GEMINI_API_KEY = "YOUR_GEMINI_API_KEY" gemini Temporary testing in Terminal
GEMINI_API_KEY="YOUR_GEMINI_API_KEY" gemini Interactive Login
gemini How to Proceed After a Successful Test
- First, run the Gemini CLI in an empty directory; do not directly open important projects.
- Ask only one fixed short question to confirm the model can reply normally.
- Then let it read a test file and clearly request not to modify the file.
- If you want to use the API Key long-term, save the authentication method to your local environment or configuration according to the official Gemini CLI documentation.
- If you have switched AI providers or CC-Switch, test again after reopening the terminal.
| Phenomenon | Priority check | Handle |
|---|---|---|
| Still Require Google Login | Is the current authentication method the Google login process? | Complete authentication first according to Gemini CLI's own prompts; do not mix API Key and login process troubleshooting |
| Key Invalid | Is GEMINI_API_KEY from Google AI Studio / Gemini? | Do not enter OpenAI or Claude Keys into Gemini |
| Model Unavailable | Is the model name from the Gemini list? | Do not enter OpenAI / Claude model names into Gemini CLI |
What to Pay Attention to in AI provider Configuration
Gemini CLI and the OpenAI-compatible provider are not the same thing. Only when the provider explicitly writes the configuration method for Gemini CLI, Google Gemini, or Vertex AI should you follow their tutorial.
Do not enter the regular OpenAI Base URL into Gemini CLI. OpenAI, Claude, and Gemini are three different protocols. If the provider provides separate addresses in the backend, you must enter the one corresponding to the tool.
Gemini CLI official documentation View installation, command, and configuration entry points.
Gemini CLI Authentication Documentation Check Google login, Gemini API Key, and Vertex AI.
