GoogleCloudPlatform / generative-ai

Sample code and notebooks for Generative AI on Google Cloud, with Gemini on Vertex AI
https://cloud.google.com/vertex-ai/docs/generative-ai/learn/overview
Apache License 2.0
6.72k stars 1.8k forks source link

[Bug]: API Key created in `https://console.cloud.google.com/apis/credentials` cannot be used #719

Closed Mon-ius closed 3 months ago

Mon-ius commented 3 months ago

File Name

https://cloud.google.com/vertex-ai/generative-ai/docs/start/quickstarts/quickstart-multimodal#gemini-setup-environment-drest

What happened?

Do we must use gcloud auth print-access-token?

Relevant log output

It return `status: 401`, invalid_token\

Code of Conduct

holtskinner commented 3 months ago

You can't use API keys for Vertex AI, you must use IAM. gcloud auth print-access-token is one way of accessing.

Note: If you are familiar with Gemini API in Google AI Studio, note that Gemini API for Vertex AI uses Identity and Access Management instead of API keys to manage access.

Mon-ius commented 3 months ago

But the IAM will be expired which cannot build a robust and stable AI service from DEV side