Persistent Vertex AI API 404 Error (Model Not Found) on New Projects

Hello community,

I'm trying to make a basic API call to Vertex AI to use the `gemini-1.0-pro` model from a Vercel serverless function, but I'm consistently getting a 404 error indicating the model is not found or my project does not have access.

The strange part is that this issue persists even on a brand new, clean Google Cloud project, which leads me to believe this is not a simple configuration error. I'm hoping someone in the community might have some insight.

**The Error:**

The exact error message returned by the API is:
```json
{
  "error": {
    "code": 404,
    "message": "Publisher Model 'projects/[PROJECT_ID]/locations/us-central1/publishers/google/models/gemini-1.0-pro' was not found or your project does not have access to it. Please ensure you are using a valid model version.",
    "status": "NOT_FOUND"
  }
}

content_copydownload

Use code with caution.

What I’ve Exhaustively Tried (Diagnostics):

To isolate the issue, I’ve run a full A/B test on two separate projects:

  1. Project A (Original - [PII Removed by Staff]):

    • Configured with a Service Account, JSON key, Vertex AI User role, enabled Vertex AI API, and linked to an active billing account.

    • Result: Consistent 404 error.

  2. Project B (New/Sterile - syro-fresh-start):

    • Created this project from scratch to rule out any misconfiguration.

    • Created a brand new Service Account (syro-vercel-agent) with the Vertex AI User role.

    • Enabled the Vertex AI API, IAM Credentials API, and Cloud Resource Manager API.

    • Linked it to the same active billing account.

    • Used a new, freshly generated JSON key for the Service Account.

    • Result: The exact same 404 error.

My Code:

The Node.js code is standard and uses google-auth-library. Here is the relevant logic:

Generated javascript

const { GoogleAuth } = require('google-auth-library');

// Authentication
const auth = new GoogleAuth({
  credentials: JSON.parse(process.env.GOOGLE_APPLICATION_CREDENTIALS_JSON),
  scopes: 'https://www.googleapis.com/auth/cloud-platform',
});

const client = await auth.getClient();
const accessToken = (await client.getAccessToken()).token;

// API Call
const project = 'syro-fresh-start';
const location = 'us-central1';
const model = 'gemini-1.0-pro';
const url = `https://${location}-aiplatform.googleapis.com/v1/projects/${project}/locations/${location}/publishers/google/models/${model}:predict`;

const response = await fetch(url, {
  method: 'POST',
  headers: {
    'Authorization': `Bearer ${accessToken}`,
    'Content-Type': 'application/json',
  },
  // ... body
});

content_copydownload

Use code with caution.JavaScript

My Conclusion & Question:

Since the error is identical across two independent and correctly configured projects, I believe the issue is not at the project level. It seems to point to a potential restriction or provisioning issue at the Google Cloud account level.

My questions for the community are:

  1. Has anyone encountered a similar persistent 404 error with Vertex AI on a brand new Google Cloud account/projects?

  2. Is there a known, undocumented activation step or waiting period for Vertex AI access on new accounts that I might be missing?

  3. Are there any other diagnostic steps you could suggest?

Thank you for any help or insights you can provide.

Hello @craneamente,

You’re using a deprecated model. You need to check the Google Models page to see which model is available and decide which one to use depending on their region and capabilities.

Hi @craneamente,

In addition to @LeoK, it’s true that you’re using retired models, which is why you’re encountering a 404 Error. I recommend you to check the latest stable models to ensure compatibility and proper access.