默认地址:
http://127.0.0.1:8765
GET /api/health响应:
{
"status": "ok",
"version": "0.1.0",
"platform": "darwin-arm64"
}GET /api/model/status响应字段:
loaded:模型或 mock 引擎是否可用。model_name:模型名称。model_repo:模型仓库。model_file:模型文件名。model_path:模型本地路径。runtime:运行时类型。runtime_feature:运行时必需特性。status:当前状态。license_accepted:许可证是否已确认。detail:状态摘要。
POST /api/license/accept
Content-Type: application/json请求:
{
"model": "HY-MT1.5-1.8B",
"license": "Tencent HY Community License Agreement",
"accepted": true,
"accepted_at": "2026-05-15T00:00:00Z"
}POST /api/translate
Content-Type: application/json请求:
{
"source_lang": "auto",
"target_lang": "zh",
"texts": ["Hello world"],
"mode": "plain"
}响应:
{
"translations": ["你好,世界"],
"model": "Hy-MT1.5-1.8B-1.25bit-GGUF",
"cached": false
}POST /api/translate/formatted
Content-Type: application/json请求:
{
"source_lang": "auto",
"target_lang": "zh",
"segments": [
{
"id": "node-1",
"text": "<source>Hello <sn>world</sn>.</source>"
}
]
}{
"error": {
"code": "MODEL_NOT_LOADED",
"message": "模型未加载,请检查模型路径或重新加载模型。",
"detail": "model path does not exist"
}
}