Skip to content

Latest commit

 

History

History
122 lines (96 loc) · 1.73 KB

File metadata and controls

122 lines (96 loc) · 1.73 KB

Local Service API

Default address:

http://127.0.0.1:8765

Health Check

GET /api/health

Response:

{
  "status": "ok",
  "version": "0.1.0",
  "platform": "darwin-arm64"
}

Model Status

GET /api/model/status

Response fields:

  • loaded: Whether the model or mock engine is available.
  • model_name: Display name of the model.
  • model_repo: Model repository.
  • model_file: Model file name.
  • model_path: Local model path.
  • runtime: Runtime type.
  • runtime_feature: Required runtime feature.
  • status: Current status.
  • license_accepted: Whether the license has been accepted.
  • detail: Status summary.

Accept License

POST /api/license/accept
Content-Type: application/json

Request:

{
  "model": "HY-MT1.5-1.8B",
  "license": "Tencent HY Community License Agreement",
  "accepted": true,
  "accepted_at": "2026-05-15T00:00:00Z"
}

Batch Translation

POST /api/translate
Content-Type: application/json

Request:

{
  "source_lang": "auto",
  "target_lang": "zh",
  "texts": ["Hello world"],
  "mode": "plain"
}

Response:

{
  "translations": ["你好,世界"],
  "model": "Hy-MT1.5-1.8B-1.25bit-GGUF",
  "cached": false
}

Format-Preserving Translation

POST /api/translate/formatted
Content-Type: application/json

Request:

{
  "source_lang": "auto",
  "target_lang": "zh",
  "segments": [
    {
      "id": "node-1",
      "text": "<source>Hello <sn>world</sn>.</source>"
    }
  ]
}

Error Shape

{
  "error": {
    "code": "MODEL_NOT_LOADED",
    "message": "模型未加载,请检查模型路径或重新加载模型。",
    "detail": "model path does not exist"
  }
}