I have an ambiguous error with User Rate Limit Exceeded with google-cloud-php-translate for one translation

194 Views Asked by At

I am using the following code:

require 'vendor/autoload.php';

use Google\Cloud\Translate\V2\TranslateClient;
$API_KEY='my-key';
$translate = new TranslateClient([
    'key' => $API_KEY
]);

// Translate text from english to french.
$result = $translate->translate('Hello world!', [
    'target' => 'fr',
        'restOptions' => [
           'headers' => [
               'referer' => 'http://localhost:4001'
           ]
        ]
]);

This would basically result in the following error: enter image description here

Quoting the documentation, it says: "The error message states Daily Limit Exceeded if you exceeded a daily quota or User Rate Limit Exceeded if you exceeded a per minute quota.". I have waited more than one minute and still the same problem. Does anyone has an idea?

NOTE: I am using laravel artisan tinker to perform the code above as a script

1

There are 1 best solutions below

0
On BEST ANSWER

There are sevral types of quotas.

  1. user based quotas
  2. project based quotas
  3. quote per minute
  4. daily quota.

Once you have caped out a daily quota you need to wait until midnight west coast usa time for it to reset.

Quotas and limits

If you exceed your quota, Cloud Translation returns a 403 error. The error message states Daily Limit Exceeded if you exceeded a daily quota or User Rate Limit Exceeded if you exceeded a per minute quota.

Daily quotas reset at midnight Pacific Time, which means new quotas can take up to 24 hours to become effective.