Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Vertex AI: Gemini API access denied – 400 Bad Request "not allowed to use Publisher Model"

Hi everyone,

I'm trying to access Gemini models (e.g. `gemini-pro`) via the Vertex AI API in a Google Cloud project. I’m using a service account with proper credentials, and everything is set up correctly, including authentication and region (`europe-west4`).

However, I consistently get this error:
Client error: `POST https://europe-west4-aiplatform.googleapis.com/v1/projects/gemini-dsgvo/locations/europe-west4/publi...` resulted in a `400 Bad Request` response: { "error": { "code": 400, "message": "Project `XXX the project number XXXX` is not allowed to use Publisher Model `projects/g (truncated...)

1 1 84
1 REPLY 1

Hello @Leonardo1970,

To resolve your Gemini API 400 error, first verify your project has explicit access to Gemini models, as some require allowlisting. Ensure your service account has the Vertex AI User role and confirm billing is active. Double-check the model path format (publishers/google/models/gemini-pro) and test in us-central1 if regional availability is an issue. 

Please try to confirm the configs below:

  • Correct IAM roles (aiplatform.user)
  • Proper model path syntax
  • Billing/quota status
  • Regional availability (try us-central1)
  • Project allowlisting for Gemini

I hope the above answer helped! If problems persist, contact Google Cloud support with the full error for project-specific enablement.

 

Best regards,

Suwarna