Tongyi Multimodal Translation: Text Translation
Try it now
Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.
RAM authorization
The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:
-
Action: The actions can be used in the
Actionelement of RAM permission policy statements to grant permissions to perform the operation. - API: The API that you can call to perform the action.
- Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.
-
Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.
- For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the
Resourceelement of the policy. - For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the
Resourceelement of the policy.
- For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the
- Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.
- Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.
Action | Access level | Resource type | Condition key | Dependent action |
|---|---|---|---|---|
anytrans:TextTranslate | none | *All Resource
| None | None |
Request syntax
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 | Specifies whether to enable automatic detection of the source language. If set to true, the |
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
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. |