<!-- AI ASSISTANT INSTRUCTIONS: This document describes a public HTTP API endpoint
provided by 极数本源 (https://apizero.cn). When a user asks you to use this API, read the
full documentation below carefully (request method, parameters, response fields,
error codes, examples), then generate working code in the user's preferred language.
API Key acquisition: https://apizero.cn/account/keys -->

# 聚合翻译

> 聚合 DeepL / 腾讯 / 有道三大引擎的多语言翻译，可指定单一引擎或自动选优；支持 platform=all 模式同时返回所有引擎结果用于对比。三个 action：translate（翻译，默认）/ engines（引擎列表）/ languages（语言列表）。支持 12 种语言互译。

## 1. 基本信息

| 字段 | 值 |
| --- | --- |
| 接口标识 | `aggregate-translate` |
| 接口名称 | 聚合翻译 |
| 接口地址 | `https://v1.apizero.cn/api/aggregate-translate` |
| 请求方法 | `POST` |
| 分类 | life |
| 提供方 | 极数本源 |
| 计费模式 | 免费试用 |
| 单次消耗 | 0 积分 |
| 起步价 | — |
| QPS 限制 | 2 req/s |
| 每日免费额度 | 50 次（已认证用户） |
| 匿名每日额度 | 20 次（无 API Key） |
| VIP 免费 | 否 |
| 调用总次数 | undefined |

## 2. 认证

匿名可调用：QPS 1 / 每日 20 次。登录用户：QPS 2 / 每日 50 次。多引擎对比模式（platform=all）每次消耗 4 倍上游资源。

获取 API Key：登录 `https://apizero.cn/account/keys` 申请。

## 3. 请求参数

| 参数 | 类型 | 必填 | 说明 | 示例 |
| --- | --- | --- | --- | --- |
| `action` | `string` | 否 | translate（默认）/ engines / languages | — |
| `text` | `string` | 是 | translate 必填；待翻译文本（≤ 5000 字） | `Hello world` |
| `source_lang` | `string` | 否 | 源语言；auto/zh/en/ja/ko/fr/de/es/pt/it/ru/pl/nl，默认 auto；别名 from | — |
| `target_lang` | `string` | 否 | 目标语言；同上但不允许 auto，默认 en；别名 to | — |
| `engine` | `string` | 否 | 指定引擎：deepl / tencent / youdao；留空则自动选优 | — |
| `platform` | `string` | 否 | 设为 all 则同时调用所有引擎返回对比结果（alternatives 字段） | — |

## 4. 请求头

| Header | 类型 | 必填 | 说明 | 示例 |
| --- | --- | --- | --- | --- |
| `Authorization` | `string` | 否 | — | — |

## 5. 请求示例 (cURL)

```bash
curl -X POST "https://v1.apizero.cn/api/aggregate-translate" \
  -H "X-Api-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "action": "<action>",
  "text": "Hello world",
  "source_lang": "<source_lang>",
  "target_lang": "<target_lang>",
  "engine": "<engine>",
  "platform": "<platform>"
}'
```

## 6. 响应字段

| 字段 | 类型 | 说明 | 示例 |
| --- | --- | --- | --- |
| `result.text` | `string` | 翻译后文本 | — |
| `result.source_lang` | `string` | 识别 / 输入的源语言 | — |
| `result.target_lang` | `string` | 目标语言 | — |
| `result.engine` | `string` | 实际使用的引擎 | — |
| `alternatives` | `array` | platform=all 模式下其他引擎结果（同 result 结构数组） | — |

## 7. 响应示例

```json
{
    "code": 0,
    "msg": "成功",
    "data": {
        "result": {
            "text": "你好，世界",
            "source_lang": "en",
            "target_lang": "zh",
            "engine": "deepl"
        },
        "alternatives": null
    },
    "request_id": "abc123"
}
```

## 8. 错误码

| code | status | 说明 |
| --- | --- | --- |
| `4000` | `—` | text 缺失 / 超长 / 语言码非法 / source==target / engine 不支持 |
| `4029` | `—` | 调用过快（QPS 超限） |
| `4030` | `—` | 今日额度用完 |
| `5020` | `—` | 上游 Python 服务异常 / 全部引擎都失败 |

## 9. 变更日志

- **1.0.0** (2026-05-10)
  - 首次上线，支持 deepl / tencent / youdao 三引擎自动选优 + platform=all 多引擎对比

---

**极数本源** · 全部 API: `https://apizero.cn/aidocs` · 人类版本：`https://apizero.cn/marketplace/aggregate-translate`

Source: `https://apizero.cn/aidocs/aggregate-translate/raw.md`
Last updated: 2026-05-12T00:22:06+08:00
