xxnuo/MTranServer
Offline translation model server with low resource consumption, fast speed, and private deployment capability. 低资源占用速度快可私有部署的离线翻译模型服务器
MTranServer – Offline Translation Server
What it is
- A self‑hosted translation service that runs on a regular PC (no GPU required). It uses ONNX‑runtime models (derived from Mozilla’s translation models) to translate between several language pairs, most notably English‑Chinese and German‑English.
- Provides a local HTTP API that mimics popular translation APIs (DeepL, Google Translate, etc.) so existing plugins and scripts can point to it.
Key features
- Zero‑GPU, CPU‑only inference via ONNX Runtime; automatically picks the best CPU thread count and execution mode.
- Cross‑platform desktop client (Windows, macOS, Linux) with a system‑tray UI and a built‑in Swagger UI for testing.
- Docker support – can be run as a container with a simple
docker composefile. - Plugin compatibility – offers drop‑in endpoints (
/deepl,/google/...,/kiss,/imme, etc.) so VS Code, browser extensions, and other translation tools work without code changes. - Offline mode – after the first online download of a language pair, the service can run completely offline.
- Command‑line control – flags for host/port, UI toggle, cache size, worker idle timeout, and explicit model download.
How to get it
- Desktop app – download the appropriate installer from the GitHub Releases page; it adds a tray icon and launches the server automatically.
- npm package –
npm i -g mtranserver && mtranserver(orbunx,pnpm, etc.). - Docker – pull
xxnuo/mtranserver:latestand run with the providedcompose.yml(bind amodelsandconfigdirectory).
Running the server
# quick start via npm
npx mtranserver@latest
# or with Docker
docker pull xxnuo/mtranserver:latest
docker compose up -d
- The first time a language direction is requested, the server downloads the required ONNX model files (needs internet). Subsequent requests reuse the cached files.
- Use
mtranserver --helpto see all options (host, port, UI, offline flag, cache size, etc.).
Ecosystem
- MTranCode – VS Code/Cursor extension that translates code comments by calling
http://localhost:8989. - MTranBrowser – a browser extension (still under development) that can also talk to the local server.
- The server’s API is documented in
API.mdand exposed via a Swagger UI athttp://localhost:8989when the UI flag is enabled.
Performance (v5 ONNX)
- On an Intel i5‑14400, English→Chinese short sentences average 11 ms (≈86 req/s) with 6 CPU threads; paragraphs take ~28 ms.
- Compared to the previous 5.0.1 release, throughput roughly doubled (e.g., English→Chinese short‑sentence throughput ↑ 1.78×).
- Memory footprint for a loaded English→Chinese model peaks around 392 MiB.
Why it matters
- Provides a privacy‑preserving alternative to cloud translation services—your text never leaves your machine.
- Works on modest hardware, making local translation accessible for developers, writers, and anyone who needs quick gist‑level translations without a GPU.
Links
- Demo UI: https://MTranServer.ipacel.cc/ui/
- GitHub: https://github.com/xxnuo/MTranServer
- Related projects: Bergamot (inspiration), ONNX Runtime, Mozilla translation models.
Related
- Project
- Project
- Project
- Project