1

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

Samir Ahmane
  • 830
  • 7
  • 22
  • Cloud Translation enforces quotas on the content size of requests and the number of requests that you can send.By default, the number of characters that you can send per day is unlimited.You can monitor and edit your quotas by using the Google Cloud console.For more information you can follow this [link](https://cloud.google.com/translate/quotas#:~:text=You%20can%20also%20lower%20your,exceeded%20a%20per%20minute%20quota.).Let me know if this helps you or not. – kiran mathew Jan 29 '23 at 12:15

1 Answers1

0

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.

Linda Lawton - DaImTo
  • 106,405
  • 32
  • 180
  • 449