Question : Using Gemini 2
Issue
Bonjour!
I am hoping to be able to use the latest v2 Gemini. I have a subscription to Gemini Advance, a GCP account, and created an API key in Google AI Studio.
I am hoping to use the latest, since its free, gemini/gemini-exp-1206
I have to use setx and then restart the cmd. I have also tried to put it in a yml file.
However when trying to use it, I get this error:
litellm.AuthenticationError: vertex_ai_betaException - b'{\n "error": {\n "code": 400,\n "message": "API
key not valid. Please pass a valid API key.",\n "status": "INVALID_ARGUMENT",\n "details": [\n {\n
"@type": "type.googleapis.com/google.rpc.ErrorInfo",\n "reason": "API_KEY_INVALID",\n "domain":
"googleapis.com",\n "metadata": {\n "service": "generativelanguage.googleapis.com"\n }\n
},\n {\n "@type": "type.googleapis.com/google.rpc.LocalizedMessage",\n "locale": "en-US",\n
"message": "API key not valid. Please pass a valid API key."\n }\n ]\n }\n}\n'
The API provider is not able to authenticate you. Check your API key.
My GCP project tied to the key has billing enabled and APIs as well.
Version and model info
Aider v0.70.0 Windows 11 Pro
Thanks for trying aider and filing this issue.
Google is rejecting your key. You'll need to make sure you're giving aider a valid key.
So for me using .env doesn't work idk. But when I do export GEMINI_API_KEY=..... It's works for me then just change the model with /model Gemini/gemini-2-0-flash-exp then I ask what model is is and it says I'm a model train by Google. Hope's this works and helped
I had a similar issue before. What resolved it for me was generating a new API key and exporting it in the shell afresh. Related or not, that seems to have solved the problem for me. For some reason, an earlier API key was not being accepte
Still doesn't work after regenerating the API key