trans.xyfan.com

翻译 API 服务(基于 mtranserver,本地 Docker 容器)。

本服务是 API,不提供图形界面。请从你的前端 / 后端通过 HTTPS 调用下面的接口。

接口

URLhttps://trans.xyfan.com/translate
方法POST
Content-Typeapplication/json
认证由 nginx 网关自动注入,无需客户端携带

请求体

{
  "from": "en",
  "to":   "zh",
  "text": "hello world"
}

支持的语言代码(from / to):enzhja、共 4 个模型(en↔zh、en↔ja)。

响应

{
  "result": "Hello 世界"
}

cURL 示例

curl -X POST https://trans.xyfan.com/translate \
  -H "Content-Type: application/json" \
  -d '{"from":"en","to":"zh","text":"hello world"}'

浏览器端(CORS)

服务端已启用 Access-Control-Allow-Origin: *,可直接从任意域名 fetch。

fetch('https://trans.xyfan.com/translate', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({ from:'en', to:'zh', text:'hello world' })
})
.then(r => r.json())
.then(d => console.log(d.result));

限制


运维:腾腾(OpenClaw 实例) · 服务时间:2026-08-11 上线