BatchTranslate - 批量文本翻译

通义多模态翻译批量翻译

调试

您可以在OpenAPI Explorer中直接运行该接口,免去您计算签名的困扰。运行成功后,OpenAPI Explorer可以自动生成SDK代码示例。

授权信息

当前API暂无授权信息透出。

请求语法

POST /anytrans/translate/batch HTTP/1.1

请求参数

名称类型必填描述示例值
workspaceIdstring

当前请求所使用的百炼业务空间 id

llm-kqtrcpdee4xm29xx
formatstring

翻译形式

text
sourceLanguagestring

源语言

zh
targetLanguagestring

目标语言

en
textobject

待翻译的批量文本

{"0":"明天天气怎么样?","1":"你中午吃饭了吗"}
scenestring

翻译模型

枚举值:
  • mt-plus专业版
  • mt-turbo轻量版
mt-turbo
extobject

控制翻译功能的扩展参数

examplesarray<object>

翻译示例列表

object

翻译示例

tgtstring

目标文本

hello
srcstring

源文本

你好
domainHintstring

领域提示(一段英文自然语言文本,用于指示大模型翻译的风格)

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.
sensitivesarray

敏感词库

string

待过滤的敏感词

password
terminologiesarray<object>

翻译术语库

object

待干预术语对

tgtstring

干预后译文

API
srcstring

源文本

应用接口
textTransformobject

译文文本转换

toLowerboolean

译文全转为小写

枚举值:
  • true
  • false
false
toUpperboolean

译文全转为大写

枚举值:
  • true
  • false
false
toTitleboolean

译文全转为 capitalized 首字母大写

枚举值:
  • true
  • false
false

返回参数

名称类型描述示例值
object

Schema of Response

codestring

响应状态码

200
messagestring

响应信息

success
requestIdstring

请求 id,用于追溯 API 调用链路

3BE338D3-16B1-513F-8DD2-57C8528DEAAA
successboolean

接口调用是否成功

true
httpStatusCodestring

http 状态码

200
dataobject

返回数据

translationListarray<object>

批量翻译结果

translationListobject

单条翻译结果

codelong

响应状态码

200
messagestring

响应信息

OK
indexstring

单条翻译结果的索引

0
translationstring

该索引对应的翻译结果

What will the weather be like tomorrow?
usageobject

token 用量

inputTokenslong

输入 token 数

53
outputTokenslong

输出 token 数

8
totalTokenslong

总 token 数

61

示例

正常返回示例

JSON格式

{
  "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?",
        "usage": {
          "inputTokens": 53,
          "outputTokens": 8,
          "totalTokens": 61
        }
      }
    ]
  }
}

错误码

HTTP status code错误码错误信息
400IdempotentParameterMismatchThe 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.

访问错误中心查看更多错误码。