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 APIandIAM Service Account Credentials APIare enabled. -
Permissions: I am using a Service Account that has been granted both the
Vertex AI UserandService Account Token Creatorroles 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.comendpoint. The error occurs after a successful connection. -
Regions: The error persists in both
europe-west2andus-central1. -
Models: The error occurs for both
gemini-1.5-flash-001andgemini-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.