Hello,
I am experiencing a persistent issue with the @google/gemini-cli tool on Windows. While the CLI installs correctly and local commands like --help work, any command that attempts to connect to the Gemini API fails with a 400 error.
Environment:
- Operating System: Windows
Steps to Reproduce:
-
Installed
@google/gemini-clilocally in a dedicated project folder usingnpm install @google/gemini-cli. -
Configured the CLI with a valid Gemini API key and model name.
Expected Behavior: The CLI should be able to connect to the Gemini API and return a response. For example, npx gemini "hello world" should generate text.
Actual Behavior: The command fails with the following error:
Error when talking to Gemini API Full report available at: C:\Users\...\AppData\Local\Temp\gemini-client-error-....json
The error log points to a 400 Bad Request with the message: GenerateContentRequest.model: unexpected model name format.
Troubleshooting Steps Taken: We have tried the following troubleshooting steps without success:
-
Global vs. Local Installation: Initially, the CLI was installed globally. It was then completely uninstalled (including clearing the
npmcache) and reinstalled locally in a dedicated folder. The issue persists in both cases. -
API Key Configuration:
-
Set the
GEMINI_API_KEYenvironment variable. -
Created a
.gemini/settings.jsonfile in the project directory with the API key and model name.
-
-
Model Configuration:
-
Set the
GEMINI_MODELenvironment variable. -
Specified the model in the
.gemini/settings.jsonfile. -
Tried different model names, including
gemini-proandgemini-1.5-flash.
-
-
Verification:
-
The
npx gemini --helpcommand works correctly. -
The issue only occurs with commands that require API interaction.
-
The API key has been verified to be correct and active.
-
Despite these efforts, the issue remains unresolved. It seems there might be a problem with how the CLI handles authentication or API requests on Windows.
Any help or guidance you could provide would be greatly appreciated.
Thank you.