Tongyi Multimodal Translation: Batch Translation
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
anytrans:BatchTranslate |
none |
*All Resource
|
None | None |
Request syntax
POST /anytrans/translate/batch HTTP/1.1
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| workspaceId |
string |
Yes |
The ID of the Model Studio workspace used for this request. |
llm-kqtrcpdee4xm29xx |
| sourceLanguage |
string |
Yes |
The source language. |
zh |
| targetLanguage |
string |
Yes |
The target language. |
en |
| text |
object |
Yes |
A map of texts to translate, in which the key is a custom identifier and the value is the source text. |
{"0":"明天天气怎么样?","1":"你中午吃饭了吗"} |
| scene |
string |
No |
The translation model. Valid values:
|
mt-turbo |
| format |
string |
No |
The translation format. |
text |
| appName |
string |
No |
The name of the calling application. |
baidufanyi |
| ext |
object |
No |
The extended parameters that control translation features. |
|
| examples |
array<object> |
No |
A list of translation examples. |
|
|
object |
No |
A translation example. |
||
| tgt |
string |
No |
The target text. |
hello |
| src |
string |
No |
The source text. |
你好 |
| domainHint |
string |
No |
A natural language instruction in English that guides the model's translation style. |
this sentence from an e-commerce product image, please provide a translation that is both highly concise and no more than 1.2 times the length of the original. |
| sensitives |
array |
No |
A list of sensitive terms. |
|
|
string |
No |
A sensitive term to filter out. |
password |
|
| terminologies |
array<object> |
No |
A list of custom terminology for overriding translations. |
|
|
object |
No |
A terminology pair for a translation override. |
||
| tgt |
string |
No |
The target text to use for the override. |
API |
| src |
string |
No |
The source text to be overridden. |
应用接口 |
| textTransform |
object |
No |
Specifies case transformations for the translated text. |
|
| toLower |
boolean |
No |
Specifies whether to convert the entire translated text to lowercase. Valid values:
|
false |
| toUpper |
boolean |
No |
Specifies whether to convert the entire translated text to uppercase. Valid values:
|
false |
| toTitle |
boolean |
No |
Specifies whether to convert the entire translated text to title case. Valid values:
|
false |
| config |
object |
No |
Controls the translation behavior. |
|
| skipCsiCheck |
boolean |
No |
Specifies whether to skip the Content Moderation check. To set this to true, you must first complete the required process to disable Content Moderation. Valid values:
|
false |
| paramMap |
any |
No |
Extended parameters for applying custom terminology that is isolated by user or business scenario. Valid values:
|
{"bizUserld":"123456","bizType":session"} |
| langDetect |
boolean |
No |
Specifies whether to enable automatic detection of the source language. If set to true, the |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
The schema of the response body. |
||
| code |
string |
The status code for the overall API call. |
200 |
| message |
string |
The response message. |
success |
| requestId |
string |
The unique identifier for the request. Use this ID for tracing and troubleshooting. |
3BE338D3-16B1-513F-8DD2-57C8528DEAAA |
| success |
boolean |
Indicates whether the API call was successful. Valid values:
|
true |
| httpStatusCode |
string |
The HTTP status code. |
200 |
| data |
object |
The response payload that contains the translation results. |
|
| translationList |
array<object> |
An array of translation results, one for each text provided in the request. |
|
|
array<object> |
A single translation result. |
||
| code |
integer |
The status code for the individual translation within the batch. |
200 |
| message |
string |
The status message for the individual translation. |
OK |
| index |
string |
The zero-based index of this result, which corresponds to the order of the source text in the original request. |
0 |
| translation |
string |
The translated text. |
What will the weather be like tomorrow? |
| detectedLang |
string |
The language code of the detected source language. |
|
| usage |
object |
An object detailing the token usage for this translation. |
|
| inputTokens |
integer |
The number of tokens in the source text. |
53 |
| outputTokens |
integer |
The number of tokens in the generated translation. |
8 |
| totalTokens |
integer |
The total number of tokens processed for the translation (the sum of |
61 |
Examples
Success response
JSON format
{
"code": "200",
"message": "success",
"requestId": "3BE338D3-16B1-513F-8DD2-57C8528DEAAA",
"success": true,
"httpStatusCode": "200",
"data": {
"translationList": [
{
"code": 200,
"message": "OK",
"index": "0",
"translation": "What will the weather be like tomorrow?",
"detectedLang": "",
"usage": {
"inputTokens": 53,
"outputTokens": 8,
"totalTokens": 61
}
}
]
}
}
Error codes
|
HTTP status code |
Error code |
Error message |
Description |
|---|---|---|---|
| 400 | IdempotentParameterMismatch | The request uses the same client token as a previous, but non-identical request. Do not reuse a client token with different requests, unless the requests are identical. |
See Error Codes for a complete list.
Release notes
See Release Notes for a complete list.