I have considerable translation work to perform for my academic research project for the upcoming month and I was under the impression I could use the paid API provided by Libretranslate and UAV4GEO to get this done effectively. First, it was advertise it can process up to 80 requests per minute. In our tests, we did not get anywhere close to this. Second, there were no mention about a limit. When we were done testing and ready to move to production, we no longer were able to receive any 200 responses from the server (we are only getting 403 and 429 responses at this point). Even when I try to use the browser’s version, I get a “Too many request limits violations”.
Is this a temporary issue with the server or there were limitations paid users should be aware of before subscribing to your services?
One thing to keep in mind, is that you cannot initiate more than 20 concurrent connections to the server from the same IP. Can you provide more details about how you are making connections to the API? I’ve tried to run CURL several times within a minute and the limits seem to work OK (but here I’m using a single connection):
curl -d "q=test&api_key=xxxxx&source=en&target=es" -X POST https://libretranslate.com/translate
{"translatedText":"prueba"}
Thank you for your prompt reply! I understand now the 80 requests per minute is a constraint and not a performance target. Just a heads up, to improve your communication with future clients, I’ve read it as: “our servers can deliver up to 80 requests per minute” not as "you can process maximum 80 requests per minute. Anyway our number of requests per minutes even with parallelization set up on my machine, we were nowhere near the 80 requests maximum. We were around 30.
All the requests are coming from my computer. I don’t use any proxies, and I have 7 parallel process. I do use a VPN and I might have changed my address IP while querying the server. Might that be the issue?
I also realize that perhaps 20 is too conservative for a number of parallel connections; we’ve set that limit recently because a few users were making thousands of parallel connections. I’d be happy to increment that if it helps get your application working.
Edit: I just bumped it to 80. Let me know if it works better now?
I’ve bumped the number of allowed parallel connections to our webserver from 20 to 80 (for all users). That was probably the issue. Sorry for the trouble this might have caused and thanks for reporting it!
Ok so we have done further tests with translation of titles and it was very quick. We did pass the threshold of 80. The server starts to return 429 responses. I wanted to test further to get closer the 80 requests limit, but now I receive only 403 responses. What is the penality every time we don’t respect the threshold?
Continuously hitting the request limits will get the API key temporarily banned for a period of time (30 minutes). I recommend putting a sleep if you get a 429 to make sure this doesn’t happen.
I had this problem because in the event of a parallel request, if a request fails with a 429 the others have already left and therefore have the IP banned.
It may be necessary to review this system, it is interesting for libretranslate.com but may not be for paid API keys, or increase it for paid API keys. i think
Do you have an issue with the service today? Today we have 502 responses after roughly 30 sec (while we had 520 after roughly 50 sec yesterday). This means the server doesn’t have time to perform the queries on our longest content to translate, which doesn’t contain more than 3000 characters before the encoding made by httr::build_url() in R. We did 3000 characters chunks as a way to get close the 5000 limitation, while minimizing the chance of busting it.
In the screen shot below, you can see the timestamp of the log, what is important to notice is the status code and the Time elapsed.
Another issue here, we have a 502 with a content of 570 char to translate.
[ 2022-07-21 11:36:15 ] : Result request row name 391 with nchar = 570 is : Status_code: 502 Time elepased : 30.4199368953705
This is very concerning as I expect to use this service that I have paid for much more than I currently have in the next weeks.
You should try to pass the api_key, q, source and target parameters in the POST request body, not in the URL. URLs typically have a maximum length of 2048. I’m guessing that’s the key issue here.
Hi @pierotofy, even with the POST request body method you suggested, we still receive 502 responses systematically when we hit the 30 second mark. It’s like there is some form of a timeout on the server side. Can you verify please? Thanks.