Skip to content

Org Account + Vertex Ai API KEY not working #19

@JuanKRuiz

Description

@JuanKRuiz

Hi,
I use my organization credentials to authenticate on Gemini CLi, it works perfectly.
Then according to documentation I configure .env file with this for enabling the extension.

GOOGLE_CLOUD_PROJECT_ID="gemini-vertex-ai-ABC123456"
NANOBANANA_GOOGLE_API_KEY="ABCDEFGHIJKLMNÑO"

But once I sent a command I get

 generate_diagram (nanobanana MCP Server) {"style":"technical","prompt":"chat application architecture","type":"a… │
│                                                                                                                      │
│    MCP error -32603: An unexpected error occurred: {"error":{"code":401,"message":"API keys are not supported by     │
│    this API. Expected OAuth2 access token or other authentication credentials that assert a principal. See           │
│    https://cloud.google.com/docs/authentication","status":"UNAUTHENTICATED","details":[{"@type":"type.googleapis.com │
│    /google.rpc.ErrorInfo","reason":"CREDENTIALS_MISSING","domain":"googleapis.com","metadata":{"method":"google.ai.g │
│    enerativelanguage.v1beta.GenerativeService.GenerateContent","service":"generativelanguage.googleapis.com"}}]}}
 An unexpected error occurred while trying to generate the diagram. The authentication failed because an API key was
  used, but this specific API requires an OAuth2 access token.

If I remove the NANOBANANA_GOOGLE_API_KEY then

generate_diagram (nanobanana MCP Server) {"prompt":"chat application architecture","style":"technical","type":"a… │
│                                                                                                                      │
│    MCP error -32603: ERROR: No valid API key found. Please set NANOBANANA_GEMINI_API_KEY, NANOBANANA_GOOGLE_API_KEY, │
│    GEMINI_API_KEY, or GOOGLE_API_KEY environment variable.                                                           │
│    For more details on authentication, visit:                                                                        │
│    https://github.com/google-gemini/gemini-cli/blob/main/docs/cli/authentication.md
✦ I am unable to generate the diagram. It seems there is an issue with the API key configuration. Please ensure that on
  of the following environment variables is set correctly: NANOBANANA_GEMINI_API_KEY, NANOBANANA_GOOGLE_API_KEY,
  GEMINI_API_KEY, or GOOGLE_API_KEY.

  For more detailed instructions on setting up authentication, you can visit the official documentation here:
  https://github.com/google-gemini/gemini-cli/blob/main/docs/cli/authentication.md

So it is a complete contradiction.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions