tencent cloud

ChatTranslations
Last updated:2026-01-27 12:37:24
ChatTranslations
Last updated: 2026-01-27 12:37:24

1. API Description

Domain name for API request: hunyuan.ai.intl.tencentcloudapi.com.

Tencent Hunyuan is a large language model (LLM) developed by Tencent R&D. It possesses powerful Chinese creation capacity, logical reasoning in complex context, and reliable task execution power. This API supports streaming or non-streaming calls. When using streaming calls, it follows the SSE protocol.

  1. This API does not currently support returning Image Content.
  2. By default, this API has account restrictions with a number of concurrencies of 5.
  3. Please use the SDK to call this API. examples are provided in the Git repository examples/hunyuan/v20230901/ directory for each development language. The SDK link is provided in the "Developer Resources - SDK" part under the document.
  4. We recommend you use API Explorer for quick online debugging interface and download example code in languages, click to open.

A maximum of 20 requests can be initiated per second for this API.

We recommend you to use API Explorer
Try it
API Explorer provides a range of capabilities, including online call, signature authentication, SDK code generation, and API quick search. It enables you to view the request, response, and auto-generated examples.

2. Input Parameters

The following request parameter list only provides API request parameters and some common parameters. For the complete common parameter list, see Common Request Parameters.

Parameter Name Required Type Description
Action Yes String Common Params. The value used for this API: ChatTranslations.
Version Yes String Common Params. The value used for this API: 2023-09-01.
Region No String Common Params. This parameter is not required.
Model Yes String Model name. optional values include hunyuan-translation.
Please read the introduction in the product overview for model descriptions.

Note:
Different models have different pricing. according to the purchase guide, call as needed.
Stream No Boolean Streaming call switch.
Note:.
1. it defaults to non-streaming (false) when no value is passed.
2. for streaming calls, the results are incrementally returned via the SSE protocol (the return value is taken from Choices[n].Delta, and incremental data must be concatenated to obtain the complete result).
3. for non-streaming calls:.
The calling method is the same as an ordinary HTTP request.
The API response is time-consuming. if needed, set it to true for reduced latency.
Only return the final result once (return value takes the value from Choices[n].Message).

Note:.
When making an SDK call, streaming and non-streaming calls require different ways to obtain the return value. refer to the comments or sample code in the SDK (in the examples/hunyuan/v20230901/ directory of each language SDK code repository).
Text No String Text to be translated.
Source No String Source language.
Supported language list:.
Simplified chinese: zh, traditional chinese: zh-TR, cantonese: yue, english: en, french: fr, portuguese: pt, spanish: es, japanese: ja, turkish: TR, russian: ru, arabic: ar, korean: ko, thai: th, italian: it, german: de, vietnamese: vi, malay: ms, indonesian: id.
The following languages are supported only by the hunyuan-translation model:.
Filipino: fil, hindi: hi, polish: pl, czech: cs, dutch: nl, khmer: km, burmese: my, persian: fa, gujarati: gu, urdu: ur, telugu: te, marathi: mr, hebrew: he, bengali: bn, tamil: ta, ukrainian: uk, tibetan: bo, kazakh: kk, mongolian: mn, uyghur: ug.
Target No String Target language.
Supported language list:.
Simplified chinese: zh, traditional chinese: zh-TR, cantonese: yue, english: en, french: fr, portuguese: pt, spanish: es, japanese: ja, turkish: TR, russian: ru, arabic: ar, korean: ko, thai: th, italian: it, german: de, vietnamese: vi, malay: ms, indonesian: id.
The following languages are supported only by the hunyuan-translation model:.
Filipino: fil, hindi: hi, polish: pl, czech: cs, dutch: nl, khmer: km, burmese: my, persian: fa, gujarati: gu, urdu: ur, telugu: te, marathi: mr, hebrew: he, bengali: bn, tamil: ta, ukrainian: uk, tibetan: bo, kazakh: kk, mongolian: mn, uyghur: ug.
Field No String Domain of the text to be translated, such as game plot.
References.N No Array of Reference Reference example, up to 10.

3. Output Parameters

Parameter Name Type Description
Id String Request'S RequestId this time.
Note String Disclaimer.
Created Integer Unix timestamp, in seconds.
Usage Usage Token statistical information.
Billing by Token quantity.
Choices Array of TranslationChoice Reply content.
ErrorMsg ErrorMsg Error message.
If the service encounters an exception during streaming return, return this error.
RequestId String The unique request ID, generated by the server, will be returned for every request (if the request fails to reach the server for other reasons, the request will not obtain a RequestId). RequestId is required for locating a problem. As a streaming response API, when the request is successfully completed, the RequestId will be placed in the Header "X-TC-RequestId" of the HTTP response.

4. Example

Example1 Non-Streaming Call to Translation API

Non-streaming call to Translation API

Input Example

POST / HTTP/1.1
Host: hunyuan.intl.tencentcloudapi.com
Content-Type: application/json
X-TC-Action: ChatTranslations
<Common request parameters>

{
    "Model": "hunyuan-translation",
    "Stream": false,
    "Text": "Playing video games leads to lasting improvements in cognitive abilities.",
    "Source": "en",
    "Target": "zh",
"Field": "Game plot"
    "References": [
        {
            "Type": "sentence",
            "Text": "Computer games are a perfect recipe for strengthening our cognitive skills",
"Translation": "Computer games are the perfect recipe to enhance our cognition"
        }
    ]
}

Output Example

{
    "Response": {
        "RequestId": "e638f0a0-a2a5-4c43-a1c6-798a7cbfbb18",
        "Id": "e638f0a0-a2a5-4c43-a1c6-798a7cbfbb18",
        "Created": 1733133524,
        "Choices": [
            {
                "Index": 0,
                "Message": {
                    "Role": "assistant",
                    "Content": "Playing video games can cause persistent enhancement in cognition."
                },
                "FinishReason": "stop"
            }
        ],
        "Usage": {
            "PromptTokens": 96,
            "CompletionTokens": 10,
            "TotalTokens": 106
        },
        "Note": "The above content is AI generation and does not mean the developer standpoint. Do not delete or modify this tag."
    }
}

5. Developer Resources

SDK

TencentCloud API 3.0 integrates SDKs that support various programming languages to make it easier for you to call APIs.

Command Line Interface

6. Error Code

The following only lists the error codes related to the API business logic. For other error codes, see Common Error Codes.

Error Code Description
FailedOperation.EngineRequestTimeout Request timeout at the engine layer. try again later.
FailedOperation.EngineServerError Internal error at the engine layer. try again later.
FailedOperation.EngineServerLimitExceeded Request exceeds the limit at the engine layer. try again later.
FailedOperation.FreeResourcePackExhausted The remaining free resource package quota is exhausted. purchase a resource pack or enable post-payment.
FailedOperation.ResourcePackExhausted The remaining resource package quota is exhausted. purchase a resource pack or enable post-payment.
FailedOperation.ServiceNotActivated The service is not activated. go to the console to apply for a trial.
FailedOperation.ServiceStop User proactively stopped services.
FailedOperation.ServiceStopArrears Service suspended due to overdue payments.
InternalError Internal error.
InvalidParameter Parameter error.
InvalidParameterValue Parameter value error.
InvalidParameterValue.Model Model does not exist.
LimitExceeded The quota limit is exceeded.
Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback