Tongyi Multimodal Translation: Text Translation
Try it now
Test
RAM authorization
|
Action |
Access level |
Resource type |
Condition key |
Dependent action |
|
anytrans:TextTranslate |
none |
*All Resource
|
None | None |
Request syntax
POST /anytrans/translate/text HTTP/1.1
Request parameters
|
Parameter |
Type |
Required |
Description |
Example |
| workspaceId |
string |
Yes |
Workspace ID |
llm-kqtrcpdee4xm29xx |
| format |
string |
No |
text format |
text |
| sourceLanguage |
string |
Yes |
Source language code |
zh |
| targetLanguage |
string |
Yes |
Target Language Code |
en |
| text |
string |
Yes |
Text to be translated |
今天天气怎么样 |
| scene |
string |
No |
Model type Valid values:
|
mt-turbo |
| ext |
object |
No |
Extended parameters to control translation behavior |
|
| examples |
array<object> |
No |
List of Translation Examples |
|
|
object |
No |
Translation Example |
||
| src |
string |
No |
Source text |
你好 |
| tgt |
string |
No |
Target text |
hello |
| domainHint |
string |
No |
Domain hint |
technology |
| agent |
string |
No |
Expert agent Valid values:
|
game |
| sensitives |
array |
No |
Sensitive word list |
|
|
string |
No |
sensitive word list |
password |
|
| terminologies |
array<object> |
No |
Translation terminology |
|
|
object |
No |
Translation terminology |
||
| src |
string |
No |
Source text |
机器学习 |
| tgt |
string |
No |
Target text |
ML |
| textTransform |
object |
No |
Translated Text Conversion |
|
| toLower |
boolean |
No |
Convert to lowercase Valid values:
|
false |
| toUpper |
boolean |
No |
Convert to uppercase Valid values:
|
false |
| toTitle |
boolean |
No |
First letter capitalized Valid values:
|
false |
| config |
object |
No |
Translation Behavior Control |
|
| skipCsiCheck |
boolean |
No |
Whether to skip the Green Web check. (To use this option, you must first complete the process to disable Green Web before making the API call.) Valid values:
|
fasle |
| prefix |
string |
No |
Prefix Configuration |
Today's weather |
| paramMap |
any |
No |
Extended parameter configuration (bizUserld: A business-level user ID that distinguishes between different business users. It implements "user-based isolation" for terminology intervention so that interventions for one user do not affect others. bizType: A business scenario type or identifier that distinguishes between different scenarios. It implements "scenario-based isolation" for terminology intervention so that interventions for one scenario do not affect others.) Valid values:
|
{"bizUserld":"123456","bizType":session"} |
| langDetect |
boolean |
No |
Response elements
|
Element |
Type |
Description |
Example |
|
object |
The response schema. |
||
| code |
string |
The response status code. |
200 |
| message |
string |
A message that provides details about the response. |
success |
| requestId |
string |
The unique identifier for the request. |
299C57B2-EBB4-57E2-A6FE-723B874ACB74 |
| success |
boolean |
Indicates whether the request was successful. |
true |
| httpStatusCode |
string |
The HTTP status code. |
200 |
| data |
object |
The data object returned by the request. |
|
| translation |
string |
The translated text. |
How does Mogujie solve the data annotation challenge by building a platform? |
| detectedLang |
string |
The detected source language. |
|
| usage |
object |
Details about the Tokens consumed by the request. |
|
| inputTokens |
integer |
The number of Tokens in the input text. |
491 |
| outputTokens |
integer |
The number of Tokens in the output text. |
400 |
| totalTokens |
integer |
The total number of Tokens consumed by the request. |
891 |
Examples
Success response
JSON format
{
"code": "200",
"message": "success",
"requestId": "299C57B2-EBB4-57E2-A6FE-723B874ACB74",
"success": true,
"httpStatusCode": "200",
"data": {
"translation": "How does Mogujie solve the data annotation challenge by building a platform?",
"detectedLang": "",
"usage": {
"inputTokens": 491,
"outputTokens": 400,
"totalTokens": 891
}
}
}
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.