Where can i find the error format doc

[
  {
    "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.generativelanguage.v1main.GenerativeService.StreamGenerateContent",
            "service": "generativelanguage.googleapis.com"
          }
        }
      ]
    }
  }
]

When I called Gemini’s OpenAI-compatible interface, I received the above error response due to an invalid key. I would like to confirm the data format of the error return and where I can find the relevant documentation, tks.

Hi @robin_zhang1 , Welcome to the AI Forum!!!

Thanks for sharing the error response. The 401 error code with the message “API keys are not supported by this API. Expected OAuth2 access token or other authentication credentials that assert a principal.” indicates a potential mismatch between the endpoint you are calling and the authentication method you are using.

Could you confirm if you are trying to use Google AI studio or Vertex AI? If possible, please share the base URL.

Hi there! Thanks for contributing. From your error.details.metadata.method, it looks like you are trying to hit version “v1main” Please change your version to either ‘v1’ or ‘v1beta’. ‘v1main’ is not a supported version.