I signed up for the google cloud promotion to get $300 credits in gemini enterprise, i created an api key in “Express Mode” following this steps Vertex AI in express mode overview | Generative AI on Vertex AI | Google Cloud Documentation
but when i try to log in i get:
Exception in thread “main” com.google.genai.errors.ClientException: 401 . API keys are not supported by this API. Expected OAuth2 access token or other authentication credentials that assert a principal. See Authentication for Google Cloud APIs and services | Google Cloud Documentation
I am using the latest genai java sdk exactly like this: Tutorial: Vertex AI API in express mode | Generative AI on Vertex AI | Google Cloud Documentation
But no go
Exception in thread “main” com.google.genai.errors.ClientException: 401 . API keys are not supported by this API. Expected OAuth2 access token or other authentication credentials that assert a principal. See Authentication for Google Cloud APIs and services | Google Cloud Documentation
at com.google.genai.errors.ApiException.throwFromResponse(ApiException.java:94)
at com.google.genai.HttpApiResponse.getBody(HttpApiResponse.java:37)
at com.google.genai.Models.processResponseForPrivateList(Models.java:6533)
at com.google.genai.Models.privateList(Models.java:6576)
at com.google.genai.Models.list(Models.java:7695)
at uno.anahata.asi.gemini.GeminiAiProvider.main(GeminiAiProvider.java:148)