json and markdown.
This document will provide detailed instructions on integrating the Translate API, helping you easily integrate and fully utilize the powerful features of this API. With the Translate API, you can easily translate the input text into a specific language and support specific methods for outputting the translation results.
Application Process
To use the Localization Translate API, you need to first apply for the corresponding service on the application page Localization Translate API. After entering the page, click the “Acquire” button, as shown in the image:
If you are not logged in or registered, you will be automatically redirected to the login page inviting you to register and log in. After logging in or registering, you will be automatically returned to the current page.
There is a free quota available for first-time applicants, allowing you to use the API for free.
Request Example
We will take an English input as an example to demonstrate how to use the API. Suppose the English description is:# Title 1\n\nThis is a paragraph.\n\n## Title 2\n\nThis is another paragraph., and we will demonstrate how to upload the English description and obtain the Chinese translation result, while displaying it in markdown format.
Setting Request Headers and Request Body
Request Headers include:accept: Specifies that the response result should be in JSON format, set toapplication/json.authorization: The key to call the API, which can be selected directly after application.
input: The text that needs to be translated.locale: The language for the translation.extension: The format for displaying the translation result.model: The large model used for translation, defaulting to gpt-3.5.

Code Example
You can see that various language codes have been automatically generated on the right side of the page, as shown in the image:
CURL
Python
Response Example
Upon a successful request, the API will return the result information of the translation task. For example:data field, which includes the translated Chinese text, and is returned in markdown format. Other information is as follows:
data: The result of the translation task.model: The large language model used for the translation task.locale: The type of translation language for the translation task.
Error Handling
When calling the API, if an error occurs, the API will return the corresponding error code and message. For example:400 token_mismatched: Bad request, possibly due to missing or invalid parameters.400 api_not_implemented: Bad request, possibly due to missing or invalid parameters.401 invalid_token: Unauthorized, invalid or missing authorization token.429 too_many_requests: Too many requests, you have exceeded the rate limit.500 api_error: Internal server error, something went wrong on the server.

