Vertex AI PHP Client: 404 NOT_FOUND (Code 5) on gemini-1.5-flash with a fully configured project

Hello,

I’m unable to access any foundation models (e.g., gemini-1.5-flash-001) via the Vertex AI API using the official PHP client library. I consistently receive a NOT_FOUND (Code 5) error, even though my project appears to be perfectly configured.

The Error:
{
“message”: “Publisher Model projects/PROJECT_NUMBER/locations/us-central1/publishers/google/models/gemini-1.5-flash-001 was not found or your project does not have access to it.”,
“code”: 5,
“status”: “NOT_FOUND”
}

What I’ve Confirmed:

I have worked through extensive troubleshooting and can confirm the following setup is correct for my project (coshh-final, Number: 379929453785):

  • Billing: The project is linked to an active billing account (Free Trial with credits).

  • APIs Enabled: Both Vertex AI API and IAM Service Account Credentials API are enabled.

  • Permissions: I am using a Service Account that has been granted both the Vertex AI User and Service Account Token Creator roles for the project.

  • Connectivity: A diagnostic script on my web server proves it can successfully connect to and authenticate with the us-central1-aiplatform.googleapis.com endpoint. The error occurs after a successful connection.

  • Regions: The error persists in both europe-west2 and us-central1.

  • Models: The error occurs for both gemini-1.5-flash-001 and gemini-pro.

    The Code:

    I am using a minimal PHP script to test the connection, which is still failing with the same error.

    <?php require __DIR__ . '/vendor/autoload.php'; use Google\ApiCore\ApiException; use Google\Cloud\AIPlatform\V1\Client\PredictionServiceClient; use Google\Cloud\AIPlatform\V1\GenerateContentRequest; use Google\Cloud\AIPlatform\V1\Content; use Google\Cloud\AIPlatform\V1\Part; $credentialsPath = '/path/to/my/keyfile.json'; $projectId = '379929453785'; // My Project Number $region = 'us-central1'; $model = 'gemini-1.5-flash-001'; try { $client = new PredictionServiceClient(['credentials' => $credentialsPath, 'apiEndpoint' => "{$region}-aiplatform.googleapis.com"]); $endpoint = sprintf('projects/%s/locations/%s/publishers/google/models/%s', $projectId, $region, $model); $request = (new GenerateContentRequest()) ->setModel($endpoint) ->setContents([new Content(['parts' => [new Part(['text' => 'Hello'])]])]); $response = $client->generateContent($request); echo "Success!"; } catch (ApiException $e) { echo "API Error: " . $e->getMessage(); } ?>

    My Question:

    Given that all standard configurations (Billing, APIs, IAM Roles, Connectivity, Code) appear to be correct, what could be causing my project to not have access to these standard models? Is this a known issue or limitation with Google Cloud Free Trial accounts, or is there a hidden permission I am missing?

    Thank you for any help you can provide.

Update:

"I have run a direct API call from my local machine using the gcloud SDK and curl, completely bypassing my web server and PHP code. The test still fails with the same NOT_FOUND error.

This proves the issue is not with my code, my server environment, or my authentication method. It is an issue with my project’s permissions or provisioning on Google’s backend.

Here is the terminal output from the definitive test:"

C:\> gcloud config set project 379929453785 Updated property [core/project]. C:\> curl -X POST -H “Authorization: Bearer <ACCESS_TOKEN>” -H “Content-Type: application/json” “https://us-central1-aiplatform.googleapis.com/v1/projects/379929453785/locations/us-central1/publishers/google/models/gemini-1.5-flash-001:generateContent” -d “{\“contents\”:[{\“parts\”:[{\“text\”: \“Hello\”}]}]}” { “error”: { “code”: 404, “message”: “Publisher Model `projects/379929453785/…/gemini-1.5-flash-001` was not found or your project does not have access to it.”, “status”: “NOT_FOUND” } }

Can a Google engineer please investigate why my project (Number: 379929453785) is not correctly provisioned to access Vertex AI foundation models, despite having an active billing account and all necessary APIs and permissions enabled?

Hi @John_Mackay,

Welcome to the Google AI Forum! :confetti_ball: :confetti_ball:

All gemini-1.5-flash models are deprecated as of September 29, 2025.

For future updates, please refer to Release Notes doc