API key expired #234
Replies: 4 comments 6 replies
-
|
The API key is used only to connect to GEMINI_API: source Make sure that you did set it correctly: Otherwise, if this doesn't help, try to verify genai SDK directly: |
Beta Was this translation helpful? Give feedback.
-
|
Follow up on this, if you have |
Beta Was this translation helpful? Give feedback.
-
|
Tackled this just now. After further isolation, i found out something is setting GeminiApiKey above my own .env . Not bash.rc . so its definitely environment issue. Sorry for disturbing you guys, will close this now. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
i use an api key from both https://aistudio.google.com/app/api-keys and google cloud and everytime i get this error Error 400, Message: API key not valid. Please pass a valid API key., Status: INVALID_ARGUMENT, Details: [map[@type:type.googleapis.com/google.rpc.ErrorInfo domain:googleapis.com metadata:map[service:generativelanguage.googleapis.com] reason:API_KEY_INVALID] map[@type:type.googleapis.com/google.rpc.LocalizedMessage locale:en-US message:API key not valid. Please pass a valid API key.]] this key is valid and a premium key (i use it in langflow and it works fine). THIS IS how i create the agent package customagent
import (
"context"
"fmt"
"os"
)
func GetAgent() (agent.Agent, error) {
ctx := context.Background()
model, err := gemini.NewModel(ctx, "gemini-2.5-flash", &genai.ClientConfig{
APIKey: os.Getenv("GEMINI_API_KEY"),
})
}
And I run it with the runner. It's definitely running, but every time it's saying the API KEY is expired. Is this an issue or a misconfiguration
Beta Was this translation helpful? Give feedback.
All reactions