aider icon indicating copy to clipboard operation
aider copied to clipboard

Question : Using Gemini 2

Open shaareable opened this issue 1 year ago • 4 comments

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.

image

Version and model info

Aider v0.70.0 Windows 11 Pro

shaareable avatar Jan 07 '25 23:01 shaareable

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.

paul-gauthier avatar Jan 08 '25 01:01 paul-gauthier

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

DivineAlways avatar Jan 08 '25 06:01 DivineAlways

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

ilyagvoz avatar Mar 28 '25 00:03 ilyagvoz

Still doesn't work after regenerating the API key

pistachiomuncher avatar Aug 18 '25 10:08 pistachiomuncher