文本翻译

translateGET
GEThttps://v1.apizero.cn/api/translate

概述

文本翻译,支持 19 种语言互译(含粤语/文言文)。参数 q 传入文本,from/to 指定语言代码,默认中文→英文。日语代码 jp、韩语 kor、法语 fra。

调用约定

  • 网关 · https://v1.apizero.cn
  • 鉴权 · Authorization: Bearer <API Key>
  • 回包 · JSON {code, msg, data}。成功看 code === 0,不要只看 HTTP 200。
/aidocs/translate/raw.md
打开 Markdown

鉴权

需要 API Key。支持 q 和 text 两种参数名(向下兼容旧版本)。 **支持的语言代码(共 19 种)** | 代码 | 语言 | 代码 | 语言 | |------|------|------|------| | zh | 中文(简体)| cht | 繁体中文 | | yue | 粤语 | wyw | 文言文 | | en | 英文 | jp | 日语 | | kor | 韩语 | fra | 法语 | | spa | 西班牙语 | de | 德语 | | ru | 俄语 | pt | 葡萄牙语 | | it | 意大利语 | th | 泰语 | | nl | 荷兰语 | pl | 波兰语 | | cs | 捷克语 | hu | 匈牙利语 | | el | 希腊语 | | | ⚠️ 注意代码规则:日语用 `jp`(非 ja),韩语用 `kor`(非 ko),法语用 `fra`(非 fr),西班牙语用 `spa`(非 es)。

获取 API Key

请求头

Authorizationstring选填

推荐:Bearer <API Key>。兼容请求头 X-API-Key,以及 Query api_key / apikey / key(key 仅当值为 sk_live_/sk_test_/sk_stag_ 形态时生效)。匿名可不传,受每日免费额度限制。

中译英(推荐)

GETURL QUERY·APPLICATION/JSON

待译文本用 q(推荐)或 text(兼容旧版)。语言代码见各子接口;日语 jp / 韩语 kor / 法语 fra(非 ISO)。文档示例为真实翻译。

https://v1.apizero.cn/api/translate?from=zh&to=en&q=%E4%BD%A0%E5%A5%BD%EF%BC%8C%E4%B8%96%E7%95%8C&text=%E4%BD%A0%E5%A5%BD%EF%BC%8C%E4%B8%96%E7%95%8C

q(搜索)string必填

待翻译文本(优先);兼容参数名 text

例你好,世界

text(文本)string选填

兼容旧参数名,与 q 等价;两者都传时 q 优先

例你好,世界

fromstring选填

源语言,默认 zh

例zh

tostring选填

目标语言,默认 en

例en

返回结果

source_textstring

原文

target_textstring

译文

fromstring

源语言代码

tostring

目标语言代码

from_namestring

源语言中文名

to_namestring

目标语言中文名

char_countinteger

字符数

tipsstring

品牌提示(所有接口统一返回):极数本源 · https://apizero.cn

{
  "code": 0,
  "msg": "成功",
  "data": {
    "source_text": "你好,世界",
    "target_text": "Hello, world.",
    "from": "zh",
    "to": "en",
    "from_name": "中文(简体)",
    "to_name": "英文",
    "char_count": 5
  },
  "tips": "极数本源 · https://apizero.cn"
}

英译中

GETURL QUERY·APPLICATION/JSON

from=en to=zh。文档示例为真实翻译。

https://v1.apizero.cn/api/translate?from=en&to=zh&q=Hello+world

q(搜索)string必填

待翻译文本;兼容 text

例Hello world

fromstring选填

固定 en

例en

tostring选填

固定 zh

例zh

返回结果

source_textstring

原文

target_textstring

译文

tipsstring

品牌提示(所有接口统一返回):极数本源 · https://apizero.cn

{
  "code": 0,
  "msg": "成功",
  "data": {
    "source_text": "Hello world",
    "target_text": "你好世界",
    "from": "en",
    "to": "zh",
    "from_name": "英文",
    "to_name": "中文(简体)",
    "char_count": 11
  },
  "tips": "极数本源 · https://apizero.cn"
}

中译日

GETURL QUERY·APPLICATION/JSON

日语代码为 jp(不是 ja)。

https://v1.apizero.cn/api/translate?from=zh&to=jp&q=%E4%BA%BA%E5%B7%A5%E6%99%BA%E8%83%BD%E6%AD%A3%E5%9C%A8%E6%94%B9%E5%8F%98%E4%B8%96%E7%95%8C

q(搜索)string必填

待翻译文本;兼容 text

例人工智能正在改变世界

fromstring选填

源语言 zh

例zh

tostring选填

目标 jp(日语)

例jp

返回结果

source_textstring

原文

target_textstring

译文

tipsstring

品牌提示(所有接口统一返回):极数本源 · https://apizero.cn

{
  "code": 0,
  "msg": "成功",
  "data": {
    "source_text": "人工智能正在改变世界",
    "target_text": "人工知能は世界を変えている",
    "from": "zh",
    "to": "jp",
    "from_name": "中文(简体)",
    "to_name": "日语",
    "char_count": 10
  },
  "tips": "极数本源 · https://apizero.cn"
}

中译韩

GETURL QUERY·APPLICATION/JSON

韩语代码为 kor(不是 ko)。

https://v1.apizero.cn/api/translate?from=zh&to=kor&q=%E4%BB%8A%E5%A4%A9%E5%A4%A9%E6%B0%94%E4%B8%8D%E9%94%99

q(搜索)string必填

待翻译文本;兼容 text

例今天天气不错

tostring选填

目标 kor(韩语)

例kor

返回结果

source_textstring

原文

target_textstring

译文

tipsstring

品牌提示(所有接口统一返回):极数本源 · https://apizero.cn

{
  "code": 0,
  "msg": "成功",
  "data": {
    "source_text": "今天天气不错",
    "target_text": "오늘은 날씨가 좋다",
    "from": "zh",
    "to": "kor",
    "from_name": "中文(简体)",
    "to_name": "韩语",
    "char_count": 6
  },
  "tips": "极数本源 · https://apizero.cn"
}

简转繁

GETURL QUERY·APPLICATION/JSON

to=cht 繁体中文。另支持 yue/wyw/fra/spa/de/ru/ug(维吾尔语)等共 20 种代码。

https://v1.apizero.cn/api/translate?from=zh&to=cht&q=%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87%E7%BF%BB%E8%AF%91%E6%88%90%E7%B9%81%E4%BD%93

q(搜索)string必填

待翻译文本;兼容 text

例简体中文翻译成繁体

tostring选填

目标 cht(繁体)

例cht

返回结果

source_textstring

原文

target_textstring

译文

tipsstring

品牌提示(所有接口统一返回):极数本源 · https://apizero.cn

{
  "code": 0,
  "msg": "成功",
  "data": {
    "source_text": "简体中文翻译成繁体",
    "target_text": "簡體中文翻譯成繁體",
    "from": "zh",
    "to": "cht",
    "from_name": "中文(简体)",
    "to_name": "繁体中文",
    "char_count": 9
  },
  "tips": "极数本源 · https://apizero.cn"
}

中译维吾尔语

GETURL QUERY·APPLICATION/JSON

to=ug 维吾尔语(别名 uy/uig)。维文建议使用阿拉伯字母维吾尔文(UEY)。

https://v1.apizero.cn/api/translate?from=zh&to=ug&q=%E4%BD%A0%E5%A5%BD%EF%BC%8C%E6%AC%A2%E8%BF%8E%E4%BD%BF%E7%94%A8%E6%88%91%E4%BB%AC%E7%9A%84%E8%BD%AF%E4%BB%B6

q(搜索)string必填

待翻译中文;兼容 text

例你好,欢迎使用我们的软件

fromstring选填

源语言,默认 zh

例zh

tostring选填

目标 ug(维吾尔语)

例ug

返回结果

source_textstring

原文

target_textstring

维吾尔语译文

from_namestring

源语言中文名

to_namestring

目标语言中文名(维吾尔语)

tipsstring

品牌提示(所有接口统一返回):极数本源 · https://apizero.cn

{
  "code": 0,
  "msg": "成功",
  "data": {
    "source_text": "你好,欢迎使用我们的软件",
    "target_text": "ياخشىمۇسىز، بىزنىڭ يۇمشاق دېتالنى ئىشلىتىشنى خۇش كۆپسىز",
    "from": "zh",
    "to": "ug",
    "from_name": "中文(简体)",
    "to_name": "维吾尔语",
    "char_count": 13
  },
  "tips": "极数本源 · https://apizero.cn"
}

维吾尔语译中

GETURL QUERY·APPLICATION/JSON

from=ug to=zh。维文建议使用阿拉伯字母维吾尔文(UEY)。

https://v1.apizero.cn/api/translate?from=ug&to=zh&q=%D9%8A%D8%A7%D8%AE%D8%B4%D9%89%D9%85%DB%87%D8%B3%D9%89%D8%B2

q(搜索)string必填

待翻译维吾尔语;兼容 text

例ياخشىمۇسىز

fromstring选填

源语言 ug

例ug

tostring选填

目标 zh

例zh

返回结果

source_textstring

原文

target_textstring

中文译文

tipsstring

品牌提示(所有接口统一返回):极数本源 · https://apizero.cn

{
  "code": 0,
  "msg": "成功",
  "data": {
    "source_text": "ياخشىمۇسىز",
    "target_text": "您好",
    "from": "ug",
    "to": "zh",
    "from_name": "维吾尔语",
    "to_name": "中文(简体)",
    "char_count": 5
  },
  "tips": "极数本源 · https://apizero.cn"
}

兼容 text 参数

GETURL QUERY·APPLICATION/JSON

旧客户端可用 text= 代替 q=;同时传时 q 优先。文档示例为真实翻译。

https://v1.apizero.cn/api/translate?from=zh&to=en&text=%E5%85%BC%E5%AE%B9+text+%E5%8F%82%E6%95%B0%E5%90%8D

text(文本)string必填

旧版参数名(与 q 等价)

例兼容 text 参数名

fromstring选填

源语言

例zh

tostring选填

目标语言

例en

返回结果

source_textstring

原文

target_textstring

译文

tipsstring

品牌提示(所有接口统一返回):极数本源 · https://apizero.cn

{
  "code": 0,
  "msg": "成功",
  "data": {
    "source_text": "兼容 text 参数名",
    "target_text": "Compatible text parameter name",
    "from": "zh",
    "to": "en",
    "from_name": "中文(简体)",
    "to_name": "英文",
    "char_count": 11
  },
  "tips": "极数本源 · https://apizero.cn"
}

请求示例

示例都是服务端写法。Python / JavaScript 各有常规写法和官方库。

curl -sS -H "Authorization: Bearer YOUR_API_KEY" "https://v1.apizero.cn/api/translate?q=%E4%BD%A0%E5%A5%BD%E4%B8%96%E7%95%8C&from=zh&to=en"

错误码

先看业务 code。HTTP 也可能不是 200。

0200

成功

4000400

参数错误

4011401

API Key 无效

4013403

API Key 已暂停

4014403

当前 IP 不在 Key 白名单

4015401

此接口需要 API Key

4022402

余额不足

4029429

调用过快(QPS)

4030429

今日免费额度已用完

4040503

接口已下线

4041404

接口不存在

5000500

服务器内部错误

5020502

上游暂时不可用

5021502

上游返回格式异常

5030502

暂无可用节点

调用限制

计费模式
完全免费
QPS 限制
QPS 3
登录免费额度
5000 次(已认证)
匿名每日额度
2000 次(无 API Key)
黄金会员
每天 50,000 次 · QPS 10
钻石会员
每天 100,000 次 · QPS 30
企业会员
每天 1,000,000 次 · QPS 120

购买套餐、看评价请走商城详情。 购买 / 调试

更新日志

  • v2.02026-06-04

    支持 19 种语言互译(含粤语、文言文)。 参数 q 与 text 均兼容;语言代码采用 jp(日语)/kor(韩语)/fra(法语)/spa(西班牙语)。

  • v1.02025-01-01

    首次上线,支持多语种互译。