Limitations of Claude
When using Claude to translate content, if the translation doesn't go through, one of the following issues may be happening. You can confirm by accessing the logs.
Translating big chunks of text
Claude is not meant to be used for long translations: Each string to translate cannot be longer than 8000 characters. (Otherwise, it would surpass the 8192
limit of max tokens for the supported models.)
For instance, the access log may print the following error message:
String to translate exceeds max length of '8192': '{ LONG TEXT HERE }'
This issue may happen when translating content for the Classic Editor, since the whole HTML blob is sent all together. (The Block Editor, in contrast, sends the block properties as independent strings.)
In addition, Claude may crash when performing translations of long text, so the logs may contain this error message:
The API for provider 'Claude' returned error: 'Server error: `POST https:\/\/api.anthropic.com\/v1\/messages` resulted in a `529 ` response:\n{\"type\":\"error\",\"error\":{\"type\":\"overloaded_error\",\"message\":\"Overloaded\"}}'
Then, for Classic Editor-based CPTs that contain big chunks of content, switching to a different translation provider (such as ChatGPT) will solve the problem.
Reaching the rate limits
The rate limits in Anthropic are (by default) restrictive.
When translating multiple strings in a limited span of time, the request may return a 429 Too Many Requests
rate limit error, with message:
This request would exceed your organization’s rate limit of 10,000 output tokens per minute. For details, refer to: https://docs.anthropic.com/en/api/rate-limits; see the response headers for current usage. Please reduce the prompt length or the maximum tokens requested, or try again later. You may also contact sales at https://www.anthropic.com/contact-sales to discuss your options for a rate limit increase.
If that happens, either increase your rate limits on Anthropic's API, or avoid using Claude when sending many posts to translate all at once (eg: via Bulk Actions) or when multiple posts are translated in quick succession.