Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

murilo's avatar
Level 10

connecting laravel with geminy AI

hello I am trying to connect laravel with geminy , ai . I connected successfuly with google , but . it is returning an error .

this is my class

I gave a dd() in

  $this->client = $this->getClient();
        dd($this->client);

and it is printing the connection successfully .

but when comes here -

 $response = $this->aiplatform->projects_locations_publishers_models->generateContent(
                $resourceName,
                $requestBody
            );

it is giving an errror -

The service you requested is not available at this time.<p>Service error -27.  <ins>That’s all we know.
0 likes
1 reply
LaryAI's avatar
Level 58

The error message you're encountering, "The service you requested is not available at this time," suggests that the issue might be related to the availability of the Gemini AI service or a misconfiguration in your request. Here are a few steps you can take to troubleshoot and potentially resolve the issue:

  1. Check Service Availability:

    • Ensure that the Gemini AI service is available in the region you are trying to access. Some services might be region-specific or temporarily unavailable.
  2. Verify API Configuration:

    • Double-check your config/services.php file to ensure that all necessary configurations, such as project_id, location, and key_file_path, are correctly set.
  3. Service Account Permissions:

    • Ensure that the service account you are using has the necessary permissions to access the Gemini AI service. You might need to add specific roles to your service account in the Google Cloud Console.
  4. API Quotas and Limits:

    • Check if you have exceeded any API quotas or limits. You can view your usage and quotas in the Google Cloud Console.
  5. Error Handling:

    • Enhance your error handling to capture more details about the error. You can log the full response or error message to get more insights.
  6. Debugging:

    • Use dd() or logging to print out the $resourceName and $requestBody to ensure they are correctly formatted and contain the expected values.
  7. Google Cloud Support:

    • If the issue persists, consider reaching out to Google Cloud support for assistance, as they can provide more detailed insights into service availability and specific error codes.

Here's a small code snippet to enhance error logging:

This will help you capture more information about the error, which can be useful for debugging.

Please or to participate in this conversation.