Search code examples
google-translate

Google Translate API returns User rate limit exceeded while the text is much shorter than the quota


We use Google Translate API to translate some HTML documents. It works fine for small texts but returns 'User rate limit exceeded' error for larger ones. E.g. an HTML document about 35 000 characters long (including tags) fails. The per 100 sec quota is set up to 10 000 000 characters.

When I was trying to find the limit I figured out the following. If I strip tags and cut the text down to 30 001 characters it works fine. If I try to send the original HTML for translation again it works too! But if I change the target language it stops working again and I need to: 1) strip tags, cut the text and send it to the translation; 2) send the original HTML for translation again.

I'd expect the translation of 35K characters HTML works fine as it's way less than the 10M / 100 sec quota. The sequence above doubles the number of billing characters. Also it stops working from time to time.

UPD We do use a billing account and pay for the API requests.


Solution

  • As mentioned at https://cloud.google.com/translate/quotas, translation API is optimized for translation of short requests. The recommended maximum length for each request is 2K. , Also documentation says you must create a billing account to increase quota.

    You can use https://tech.yandex.com/translate/ or other translate APIs if you exceed your quota.