400 : API key not valid. Did something change in last 2 days?

I started getting 400 error in the last couple of days. I have been using it without problems before that. I tried with both Free and Paid keys, both are throwing the same error.
Also checked with a friend and he has the same issue.

export GEMINI_API_KEY=xxx

Doing a simple CURL →

“error”: {
“code”: 400,
“message”: “API key not valid. Please pass a valid API key.”,
“status”: “INVALID_ARGUMENT”,

yes, even i am getting the same error. It worked fine in the month of december 2024

I’ve run into the same issue yesterday. Even tried new keys, unrestricted.

I am attempting to use Gemini API for the first time and running into this issue as well with fresh API keys. Is this still a general problem?

I just now encountered this problem. It’s February 17, 2025. I haven’t used the Gemini API in a few weeks. I generated a new API key but that didn’t work either.

Same problem. First time using the Gemini API and I keep getting " [400 Bad Request] API key not valid. Please pass a valid API key. ", while the quick test below provided by Google AI Studio works well.

curl “https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash:generateContent?key=GEMINI_API_KEY
-H ‘Content-Type: application/json’
-X POST
-d ‘{
“contents”: [{
“parts”:[{“text”: “Explain how AI works”}]
}]
}’