Setup guide

Provider setup guide

Browse setup steps and troubleshooting by tool.

Provider setup guide/Gemini CLI Configuration

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.

What this tool is and what it is used for

Google GeminiTerminal toolsGoogle loginGemini API Key

Select the authentication method first

MethodWho it is suitable forDescription
Google loginIndividual Users and BeginnersRun Gemini and log in as prompted
Gemini API KeyUsers Who Already Have a Google AI Studio KeyPut the Key into GEMINI_API_KEY
Vertex AIEnterprise or Cloud Project UsersConfigure 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

How to Proceed After a Successful Test

  1. First, run the Gemini CLI in an empty directory; do not directly open important projects.
  2. Ask only one fixed short question to confirm the model can reply normally.
  3. Then let it read a test file and clearly request not to modify the file.
  4. 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.
  5. If you have switched AI providers or CC-Switch, test again after reopening the terminal.
PhenomenonPriority checkHandle
Still Require Google LoginIs 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 InvalidIs GEMINI_API_KEY from Google AI Studio / Gemini?Do not enter OpenAI or Claude Keys into Gemini
Model UnavailableIs 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.