docs: update

This commit is contained in:
xxnuo
2025-12-28 22:56:46 +08:00
parent ae00ec9cb7
commit c3100d2773
10 changed files with 794 additions and 105 deletions

2
API.md
View File

@@ -1,5 +1,7 @@
# MTranServer 高级配置说明
[中文](API.md) | [English](docs/API_en.md) | [日本語](docs/API_ja.md) | [Français](docs/API_fr.md) | [Deutsch](docs/API_de.md)
### 环境变量配置
| 环境变量 | 说明 | 默认值 | 可选值 |

View File

@@ -1,6 +1,6 @@
# MTranServer
[English](README_en.md) | 中文
[中文](README.md) | [English](docs/README_en.md) | [日本語](docs/README_ja.md) | [Français](docs/README_fr.md) | [Deutsch](docs/README_de.md)
<!-- <img src="./images/icon.png" width="64px" height="64px" align="right" alt="MTran"> -->
@@ -144,4 +144,4 @@ docker compose up -d
[Bergamot Project](https://browser.mt/) for awesome idea of local translation.
[Mozilla](https://github.com/mozilla) for the [models](https://github.com/mozilla/firefox-translations-models).
[Mozilla](https://github.com/mozilla) for the [models](https://github.com/mozilla/firefox-translations-models).

80
docs/API_de.md Normal file
View File

@@ -0,0 +1,80 @@
# MTranServer Erweiterte Konfigurationsanleitung
[中文](../API.md) | [English](API_en.md) | [日本語](API_ja.md) | [Français](API_fr.md) | [Deutsch](API_de.md)
### Umgebungsvariablenkonfiguration
| Umgebungsvariable | Beschreibung | Standardwert | Optionen |
| ----------------- | ------------ | ------------ | -------- |
| MT_LOG_LEVEL | Protokollierungsgrad | warn | debug, info, warn, error |
| MT_CONFIG_DIR | Konfigurationsverzeichnis | ~/.config/mtran/server | Beliebiger Pfad |
| MT_MODEL_DIR | Modellverzeichnis | ~/.config/mtran/models | Beliebiger Pfad |
| MT_HOST | Server-Abhöradresse | 0.0.0.0 | Beliebige IP-Adresse |
| MT_PORT | Server-Port | 8989 | 1-65535 |
| MT_ENABLE_UI | Web-UI aktivieren | true | true, false |
| MT_OFFLINE | Offline-Modus, neue Sprachmodelle nicht automatisch herunterladen, nur heruntergeladene Modelle verwenden | false | true, false |
| MT_WORKER_IDLE_TIMEOUT | Worker-Leerlauf-Timeout (Sekunden) | 300 | Beliebige positive ganze Zahl |
| MT_API_TOKEN | API-Zugriffstoken | Leer | Beliebige Zeichenfolge |
Beispiel:
```bash
# Protokollierungsgrad auf debug setzen
export MT_LOG_LEVEL=debug
# Port auf 9000 setzen
export MT_PORT=9000
# Dienst starten
./mtranserver
```
### API-Schnittstellenbeschreibung
#### Systemschnittstellen
| Schnittstelle | Methode | Beschreibung | Authentifizierung |
| ------------- | ------- | ------------ | ----------------- |
| `/version` | GET | Dienstversion abrufen | Nein |
| `/health` | GET | Gesundheitscheck | Nein |
| `/__heartbeat__` | GET | Heartbeat-Check | Nein |
| `/__lbheartbeat__` | GET | Load Balancer Heartbeat-Check | Nein |
| `/docs/*` | GET | Swagger API-Dokumentation | Nein |
#### Übersetzungsschnittstellen
| Schnittstelle | Methode | Beschreibung | Authentifizierung |
| ------------- | ------- | ------------ | ----------------- |
| `/languages` | GET | Liste der unterstützten Sprachen abrufen | Ja |
| `/translate` | POST | Einzeltextübersetzung | Ja |
| `/translate/batch` | POST | Stapelübersetzung | Ja |
**Beispiel für Einzeltextübersetzungsanfrage:**
```json
{
"from": "en",
"to": "zh-Hans",
"text": "Hello, world!",
"html": false
}
```
**Beispiel für Stapelübersetzungsanfrage:**
```json
{
"from": "en",
"to": "zh-Hans",
"texts": ["Hello, world!", "Good morning!"],
"html": false
}
```
**Authentifizierungsmethoden:**
- Header: `Authorization: Bearer <token>`
- Query: `?token=<token>`
Weitere Informationen finden Sie in der API-Dokumentation nach dem Start des Servers.

80
docs/API_en.md Normal file
View File

@@ -0,0 +1,80 @@
# MTranServer Advanced Configuration Guide
[中文](../API.md) | [English](API_en.md) | [日本語](API_ja.md) | [Français](API_fr.md) | [Deutsch](API_de.md)
### Environment Variables
| Environment Variable | Description | Default | Options |
| --------------------- | ---------------------------------------- | ------- | --------------------------- |
| MT_LOG_LEVEL | Log level | warn | debug, info, warn, error |
| MT_CONFIG_DIR | Configuration directory | ~/.config/mtran/server | Any path |
| MT_MODEL_DIR | Model directory | ~/.config/mtran/models | Any path |
| MT_HOST | Server host address | 0.0.0.0 | Any IP address |
| MT_PORT | Server port | 8989 | 1-65535 |
| MT_ENABLE_UI | Enable Web UI | true | true, false |
| MT_OFFLINE | Offline mode, disable automatic download of new language models, only use downloaded models | false | true, false |
| MT_WORKER_IDLE_TIMEOUT| Worker idle timeout (seconds) | 300 | Any positive integer |
| MT_API_TOKEN | API access token | empty | Any string |
Example:
```bash
# Set log level to debug
export MT_LOG_LEVEL=debug
# Set port to 9000
export MT_PORT=9000
# Start the server
./mtranserver
```
### API Documentation
#### System Endpoints
| Endpoint | Method | Description | Auth Required |
| -------- | ------ | ----------- | ------------- |
| `/version` | GET | Get service version | No |
| `/health` | GET | Health check | No |
| `/__heartbeat__` | GET | Heartbeat check | No |
| `/__lbheartbeat__` | GET | Load balancer heartbeat check | No |
| `/docs/*` | GET | Swagger API documentation | No |
#### Translation Endpoints
| Endpoint | Method | Description | Auth Required |
| -------- | ------ | ----------- | ------------- |
| `/languages` | GET | Get supported language list | Yes |
| `/translate` | POST | Single text translation | Yes |
| `/translate/batch` | POST | Batch translation | Yes |
**Single Text Translation Request Example:**
```json
{
"from": "en",
"to": "zh-Hans",
"text": "Hello, world!",
"html": false
}
```
**Batch Translation Request Example:**
```json
{
"from": "en",
"to": "zh-Hans",
"texts": ["Hello, world!", "Good morning!"],
"html": false
}
```
**Authentication Methods:**
- Header: `Authorization: Bearer <token>`
- Query: `?token=<token>`
For details, please refer to the API documentation after the server starts.

80
docs/API_fr.md Normal file
View File

@@ -0,0 +1,80 @@
# Guide de configuration avancée de MTranServer
[中文](../API.md) | [English](API_en.md) | [日本語](API_ja.md) | [Français](API_fr.md) | [Deutsch](API_de.md)
### Configuration des variables d'environnement
| Variable d'environnement | Description | Valeur par défaut | Valeurs possibles |
| ------------------------ | ----------- | ----------------- | ----------------- |
| MT_LOG_LEVEL | Niveau de journalisation | warn | debug, info, warn, error |
| MT_CONFIG_DIR | Répertoire de configuration | ~/.config/mtran/server | Tout chemin |
| MT_MODEL_DIR | Répertoire des modèles | ~/.config/mtran/models | Tout chemin |
| MT_HOST | Adresse d'écoute du serveur | 0.0.0.0 | Toute adresse IP |
| MT_PORT | Port du serveur | 8989 | 1-65535 |
| MT_ENABLE_UI | Activer l'interface Web | true | true, false |
| MT_OFFLINE | Mode hors ligne, ne pas télécharger automatiquement les nouveaux modèles de langue, utiliser uniquement les modèles téléchargés | false | true, false |
| MT_WORKER_IDLE_TIMEOUT | Délai d'inactivité du Worker (secondes) | 300 | Tout entier positif |
| MT_API_TOKEN | Jeton d'accès API | Vide | Toute chaîne de caractères |
Exemple :
```bash
# Définir le niveau de journalisation sur debug
export MT_LOG_LEVEL=debug
# Définir le port sur 9000
export MT_PORT=9000
# Démarrer le service
./mtranserver
```
### Description de l'interface API
#### Interfaces système
| Interface | Méthode | Description | Authentification |
| --------- | ------- | ----------- | ---------------- |
| `/version` | GET | Obtenir la version du service | Non |
| `/health` | GET | Vérification de l'état | Non |
| `/__heartbeat__` | GET | Vérification du rythme cardiaque | Non |
| `/__lbheartbeat__` | GET | Vérification du rythme cardiaque de l'équilibreur de charge | Non |
| `/docs/*` | GET | Documentation API Swagger | Non |
#### Interfaces de traduction
| Interface | Méthode | Description | Authentification |
| --------- | ------- | ----------- | ---------------- |
| `/languages` | GET | Obtenir la liste des langues supportées | Oui |
| `/translate` | POST | Traduction de texte unique | Oui |
| `/translate/batch` | POST | Traduction par lots | Oui |
**Exemple de requête de traduction de texte unique :**
```json
{
"from": "en",
"to": "zh-Hans",
"text": "Hello, world!",
"html": false
}
```
**Exemple de requête de traduction par lots :**
```json
{
"from": "en",
"to": "zh-Hans",
"texts": ["Hello, world!", "Good morning!"],
"html": false
}
```
**Méthodes d'authentification :**
- En-tête : `Authorization: Bearer <token>`
- Requête : `?token=<token>`
Pour plus de détails, veuillez vous référer à la documentation API après le démarrage du serveur.

80
docs/API_ja.md Normal file
View File

@@ -0,0 +1,80 @@
# MTranServer 高度な設定説明
[中文](../API.md) | [English](API_en.md) | [日本語](API_ja.md) | [Français](API_fr.md) | [Deutsch](API_de.md)
### 環境変数設定
| 環境変数 | 説明 | デフォルト値 | 選択肢 |
| -------- | ---- | ------------ | ------ |
| MT_LOG_LEVEL | ログレベル | warn | debug, info, warn, error |
| MT_CONFIG_DIR | 設定ディレクトリ | ~/.config/mtran/server | 任意のパス |
| MT_MODEL_DIR | モデルディレクトリ | ~/.config/mtran/models | 任意のパス |
| MT_HOST | サーバーリッスンアドレス | 0.0.0.0 | 任意のIPアドレス |
| MT_PORT | サーバーポート | 8989 | 1-65535 |
| MT_ENABLE_UI | Web UI を有効にする | true | true, false |
| MT_OFFLINE | オフラインモード。新しい言語モデルを自動ダウンロードせず、ダウンロード済みのモデルのみ使用 | false | true, false |
| MT_WORKER_IDLE_TIMEOUT | Worker アイドルタイムアウト(秒) | 300 | 任意の正の整数 |
| MT_API_TOKEN | API アクセストークン | 空 | 任意の文字列 |
例:
```bash
# ログレベルを debug に設定
export MT_LOG_LEVEL=debug
# ポートを 9000 に設定
export MT_PORT=9000
# サービスを起動
./mtranserver
```
### API インターフェース説明
#### システムインターフェース
| インターフェース | メソッド | 説明 | 認証 |
| ---------------- | -------- | ---- | ---- |
| `/version` | GET | サービスバージョンを取得 | いいえ |
| `/health` | GET | ヘルスチェック | いいえ |
| `/__heartbeat__` | GET | ハートビートチェック | いいえ |
| `/__lbheartbeat__` | GET | ロードバランサーハートビートチェック | いいえ |
| `/docs/*` | GET | Swagger API ドキュメント | いいえ |
#### 翻訳インターフェース
| インターフェース | メソッド | 説明 | 認証 |
| ---------------- | -------- | ---- | ---- |
| `/languages` | GET | サポートされている言語リストを取得 | はい |
| `/translate` | POST | 単一テキスト翻訳 | はい |
| `/translate/batch` | POST | 一括翻訳 | はい |
**単一テキスト翻訳リクエスト例:**
```json
{
"from": "en",
"to": "zh-Hans",
"text": "Hello, world!",
"html": false
}
```
**一括翻訳リクエスト例:**
```json
{
"from": "en",
"to": "zh-Hans",
"texts": ["Hello, world!", "Good morning!"],
"html": false
}
```
**認証方式:**
- Header: `Authorization: Bearer <token>`
- Query: `?token=<token>`
詳細については、サーバー起動後の API ドキュメントを参照してください。

147
docs/README_de.md Normal file
View File

@@ -0,0 +1,147 @@
# MTranServer
[中文](../README.md) | [English](README_en.md) | [日本語](README_ja.md) | [Français](README_fr.md) | [Deutsch](README_de.md)
<!-- <img src="../images/icon.png" width="64px" height="64px" align="right" alt="MTran"> -->
Ein ultraschneller Offline-Übersetzungsmodell-Server mit minimalem Ressourcenverbrauch. Keine Grafikkarte erforderlich. Durchschnittliche Antwortzeit von 50 ms pro Anfrage. Unterstützt die Übersetzung der weltweit wichtigsten Sprachen.
Beachten Sie, dass dieser Modellserver auf die Designziele `Offline-Übersetzung`, `Reaktionsgeschwindigkeit`, `plattformübergreifende Bereitstellung` und `lokale Ausführung` fokussiert ist, um `unbegrenzte kostenlose Übersetzungen` zu erreichen. Aufgrund von Einschränkungen bei der Modellgröße und Optimierung wird die Übersetzungsqualität sicherlich nicht so gut sein wie die von großen Sprachmodellen.
> Für qualitativ hochwertige Übersetzungen wird die Verwendung von Online-APIs für große Sprachmodelle empfohlen.
<img src="../images/preview.png" width="auto" height="460">
## Gebrauchsanweisung
Laden Sie die neueste Version für Ihre Plattform von [Releases](https://github.com/xxnuo/MTranServer/releases) herunter und starten Sie das Programm einfach über die Befehlszeile, um es zu verwenden.
> [MTranServer](https://github.com/xxnuo/MTranServer) ist hauptsächlich für Serverumgebungen gedacht, daher sind derzeit nur der Befehlszeilendienst und die Docker-Bereitstellung verfügbar.
>
> In meiner Freizeit werde ich [MTranDesktop](https://github.com/xxnuo/MTranDesktop) für den Desktop-Einsatz verbessern. Beiträge sind willkommen.
Nach dem Start des Servers werden die Adresse der im Programm enthaltenen einfachen Benutzeroberfläche und die Adresse der Online-Dokumentation im Protokoll ausgegeben. Hier ist eine Vorschau:
![UI](../images/ui.png)
![Dokumentation](../images/swagger.png)
### Befehlszeilenparameter
```bash
./mtranserver [Optionen]
Optionen:
-version, -v Versionsinformationen anzeigen
-log-level string Protokollierungsgrad (debug, info, warn, error) (Standard "warn")
-config-dir string Konfigurationsverzeichnis (Standard "~/.config/mtran/server")
-model-dir string Modellverzeichnis (Standard "~/.config/mtran/models")
-host string Server-Abhöradresse (Standard "0.0.0.0")
-port string Server-Port (Standard "8989")
-ui Web-UI aktivieren (Standard true)
-offline Offline-Modus aktivieren, neue Modelle nicht automatisch herunterladen (Standard false)
-worker-idle-timeout int Worker-Leerlauf-Timeout (Sekunden) (Standard 300)
Beispiele:
./mtranserver --host 127.0.0.1 --port 8080
./mtranserver --ui --offline
./mtranserver -v
```
### Docker Compose Bereitstellung
Erstellen Sie ein leeres Verzeichnis und darin eine `compose.yml` Datei mit folgendem Inhalt:
```yml
services:
mtranserver:
image: xxnuo/mtranserver:latest
container_name: mtranserver
restart: unless-stopped
ports:
- "8989:8989"
environment:
- MT_HOST=0.0.0.0
- MT_PORT=8989
- MT_ENABLE_UI=true
- MT_OFFLINE=false
# - MT_API_TOKEN=ihr_geheimer_token_hier
volumes:
- ./models:/app/models
```
```bash
docker pull xxnuo/mtranserver:latest
docker compose up -d
```
>
> **Wichtiger Hinweis:**
>
> Bei der erstmaligen Übersetzung eines Sprachpaares lädt der Server automatisch das entsprechende Übersetzungsmodell herunter (sofern der Offline-Modus nicht aktiviert ist). Dieser Vorgang kann je nach Netzwerkgeschwindigkeit und Modellgröße einige Zeit in Anspruch nehmen. Nach dem Herunterladen des Modells benötigt der Start der Engine ebenfalls einige Sekunden. Nachfolgende Übersetzungsanfragen profitieren von einer Antwortzeit im Millisekundenbereich. Es wird empfohlen, vor der eigentlichen Verwendung eine Übersetzung zu testen, damit der Server die Modelle vorab herunterladen und laden kann.
>
> Das Programm wird häufig aktualisiert. Wenn Sie auf Probleme stoßen, versuchen Sie, auf die neueste Version zu aktualisieren.
#### Übersetzung-Plugin kompatible Schnittstellen
Der Server bietet kompatible Schnittstellen für mehrere Übersetzungs-Plugins:
| Schnittstelle | Methode | Beschreibung | Unterstützte Plugins |
| ------------- | ------- | ------------ | -------------------- |
| `/imme` | POST | Schnittstelle für Immersive Translate Plugin | [Immersive Translate](https://immersivetranslate.com/) |
| `/kiss` | POST | Schnittstelle für Kiss Translator Plugin | [Kiss Translator](https://github.com/fishjar/kiss-translator) |
| `/deepl` | POST | DeepL API v2 kompatible Schnittstelle | Clients, die die DeepL API unterstützen |
| `/google/language/translate/v2` | POST | Google Translate API v2 kompatible Schnittstelle | Clients, die die Google Translate API unterstützen |
| `/google/translate_a/single` | GET | Google translate_a/single kompatible Schnittstelle | Clients, die Google Web Translate unterstützen |
| `/hcfy` | POST | Selection Translator kompatible Schnittstelle | [Selection Translator](https://github.com/Selection-Translator/crx-selection-translate) |
**Plugin-Konfigurationsanleitung:**
> Hinweis:
>
> - [Immersive Translate](https://immersivetranslate.com/docs/services/custom/): Aktivieren Sie im Entwicklermodus auf der Seite `Einstellungen` die `Beta`-Funktionen, dann sehen Sie unter `Übersetzungsdienste` die `Benutzerdefinierte API-Einstellungen` ([offizielles Tutorial mit Bildern](https://immersivetranslate.com/docs/services/custom/)). Erhöhen Sie dann die `Maximale Anfragen pro Sekunde` in den `Benutzerdefinierte API-Einstellungen`, um die Serverleistung voll auszuschöpfen. Ich habe `Maximale Anfragen pro Sekunde` auf `512` und `Maximale Absätze pro Anfrage` auf `1` eingestellt. Sie können dies entsprechend Ihrer Serverkonfiguration anpassen.
>
> - [Kiss Translator](https://github.com/fishjar/kiss-translator): Scrollen Sie auf der Seite `Einstellungen` nach unten zu den Schnittstelleneinstellungen, dort sehen Sie die benutzerdefinierte Schnittstelle `Custom`. Stellen Sie ebenfalls die `Maximale Anzahl gleichzeitiger Anfragen` und das `Anfrageintervall` ein, um die Serverleistung voll auszuschöpfen. Ich habe die `Maximale Anzahl gleichzeitiger Anfragen` auf `100` und das `Anfrageintervall` auf `1` eingestellt. Sie können dies entsprechend Ihrer Serverkonfiguration anpassen.
>
> Konfigurieren Sie anschließend die Adresse der benutzerdefinierten Schnittstelle des Plugins gemäß der untenstehenden Tabelle.
| Name | URL | Plugin-Einstellung |
| ---- | --- | ------------------ |
| Immersive Translate (Ohne Passwort) | `http://localhost:8989/imme` | `Benutzerdefinierte API-Einstellungen` - `API-URL` |
| Immersive Translate (Mit Passwort) | `http://localhost:8989/imme?token=your_token` | Dasselbe wie oben, ändern Sie `your_token` am Ende der URL in Ihren `MT_API_TOKEN` Wert |
| Kiss Translator (Ohne Passwort) | `http://localhost:8989/kiss` | `Schnittstelleneinstellungen` - `Custom` - `URL` |
| Kiss Translator (Mit Passwort) | `http://localhost:8989/kiss` | Dasselbe wie oben, füllen Sie `KEY` mit `your_token` aus |
| DeepL Kompatibel | `http://localhost:8989/deepl` | Verwenden Sie `DeepL-Auth-Key` oder `Bearer` Authentifizierung |
| Google Kompatibel | `http://localhost:8989/google/language/translate/v2` | Verwenden Sie den `key` Parameter oder `Bearer` Authentifizierung |
| Selection Translator | `http://localhost:8989/hcfy` | Unterstützt `token` Parameter oder `Bearer` Authentifizierung |
**Normale Benutzer können den Dienst nutzen, indem sie die Schnittstellenadresse des Plugins gemäß dem Tabelleninhalt konfigurieren.**
## Ähnliche Projekte
Hier sind einige Projekte mit ähnlichen Funktionen. Wenn Sie andere Bedürfnisse haben, können Sie diese Projekte ausprobieren:
| Projektname | Speicherverbrauch | Nebenläufigkeitsleistung | Übersetzungsqualität | Geschwindigkeit | Weitere Informationen |
| ----------- | ----------------- | ------------------------ | -------------------- | --------------- | --------------------- |
| [NLLB](https://github.com/facebookresearch/fairseq/tree/nllb) | Sehr hoch | Schlecht | Durchschnittlich | Langsam | Die Android-Portierung [RTranslator](https://github.com/niedev/RTranslator) hat viele Optimierungen, aber der Ressourcenverbrauch ist immer noch hoch und es ist nicht schnell |
| [LibreTranslate](https://github.com/LibreTranslate/LibreTranslate) | Sehr hoch | Durchschnittlich | Durchschnittlich | Mittel | Mittelklasse-CPU verarbeitet 3 Sätze/s, High-End-CPU 15-20 Sätze/s. [Details](https://community.libretranslate.com/t/performance-benchmark-data/486) |
| [OPUS-MT](https://github.com/OpenNMT/CTranslate2#benchmarks) | Hoch | Durchschnittlich | Eher schlecht | Schnell | [Leistungstests](https://github.com/OpenNMT/CTranslate2#benchmarks) |
| Andere große Modelle | Extrem hoch | Dynamisch | Sehr gut | Sehr langsam | Hohe Hardwareanforderungen. Wenn Sie eine Übersetzung mit hoher Nebenläufigkeit benötigen, wird empfohlen, das vllm-Framework zu verwenden, um die Nebenläufigkeit über den Speicher- und VRAM-Verbrauch zu steuern |
| Dieses Projekt | Mittel | Hoch | Durchschnittlich | Extrem schnell | Durchschnittliche Antwortzeit von 50 ms pro Anfrage. Das neue Modell hat die Übersetzungsqualität verbessert, was zu einem erhöhten Speicherverbrauch führte. Optimierung wird priorisiert, wenn Zeit verfügbar ist |
> Die Daten in der Tabelle beziehen sich auf einfache Tests mit CPU, Englisch-Chinesisch-Szenarien, keine strengen Tests, Vergleich von nicht quantisierten Versionen, nur als Referenz.
# Erweiterte Konfigurationsanleitung
Bitte beachten Sie die Datei [API_de.md](API_de.md) und die API-Dokumentation nach dem Start.
## Star History
[![Star History Chart](https://api.star-history.com/svg?repos=xxnuo/MTranServer&type=Timeline)](https://www.star-history.com/#xxnuo/MTranServer&Timeline)
## Thanks
[Bergamot Project](https://browser.mt/) for awesome idea of local translation.
[Mozilla](https://github.com/mozilla) for the [models](https://github.com/mozilla/firefox-translations-models).

View File

@@ -1,40 +1,30 @@
# MTranServer
<!-- <img src="./images/icon.png" width="64px" height="64px" align="right" alt="MTran"> -->
[中文](../README.md) | [English](README_en.md) | [日本語](README_ja.md) | [Français](README_fr.md) | [Deutsch](README_de.md)
[中文](README.md) | English
<!-- <img src="../images/icon.png" width="64px" height="64px" align="right" alt="MTran"> -->
A high-performance offline translation model server with minimal resource requirements - no GPU needed. Average response time of 50ms per request. Supports translation of major languages worldwide.
Note: This model focuses on speed and private deployment on various devices, so the translation quality will not match that of large language models.
Note: This model server focuses on `offline translation`, `response speed`, `cross-platform deployment`, and `local execution` to achieve `unlimited free translation`. Due to model size and optimization constraints, the translation quality will not match that of large language models.
For high-quality translation, consider using online large language model APIs.
> For high-quality translation, consider using online large language model APIs.
<img src="./images/preview.png" width="auto" height="460">
## Comparison with Similar Projects (CPU, English to Chinese)
| Project Name | Memory Usage | Concurrency | Translation Quality | Speed | Additional Info |
| ---------------------------------------------------------------------- | -------------- | ----------- | ------------------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [facebook/nllb](https://github.com/facebookresearch/fairseq/tree/nllb) | Very High | Poor | Average | Slow | Android port [RTranslator](https://github.com/niedev/RTranslator) has many optimizations, but still has high resource usage and is not fast |
| [LibreTranslate](https://github.com/LibreTranslate/LibreTranslate) | Very High | Average | Average | Medium | Mid-range CPU processes 3 sentences/s, high-end CPU processes 15-20 sentences/s. [Details](https://community.libretranslate.com/t/performance-benchmark-data/486) |
| [OPUS-MT](https://github.com/OpenNMT/CTranslate2#benchmarks) | High | Average | Below Average | Fast | [Performance Tests](https://github.com/OpenNMT/CTranslate2#benchmarks) |
| Any LLM | Extremely High | Dynamic | Very Good | Very Slow | high hardware requirements |
| MTranServer (This Project) | Low | High | Average | Ultra Fast | 50ms average response time per request |
> Table data is for reference only, not strict testing, non-quantized version comparison.
<img src="../images/preview.png" width="auto" height="460">
## Usage Guide
Download the latest version from [Releases](https://github.com/xxnuo/MTranServer/releases) and start the program in the command line.
> [MTranServer](https://github.com/xxnuo/MTranServer) is mainly for server use, so currently only command line service and Docker deployment are available. I will improve [MTranDesktop](https://github.com/xxnuo/MTranDesktop) for desktop use in the future.
> [MTranServer](https://github.com/xxnuo/MTranServer) is mainly for server use, so currently only command line service and Docker deployment are available.
>
> I will improve [MTranDesktop](https://github.com/xxnuo/MTranDesktop) for desktop use in the future, contributions are welcome.
Console output the address of the simple UI and the online documentation address, below is a preview
After the server starts, the console will output the address of the simple UI and the online documentation address. Below is a preview:
![UI](./images/ui.png)
![UI](../images/ui.png)
![Documentation](./images/swagger.png)
![Documentation](../images/swagger.png)
### Command Line Options
@@ -93,80 +83,6 @@ docker compose up -d
>
> The program is often updated, if you encounter problems, you can try to update to the latest version.
### Environment Variables
| Environment Variable | Description | Default | Options |
| --------------------- | ---------------------------------------- | ------- | --------------------------- |
| MT_LOG_LEVEL | Log level | warn | debug, info, warn, error |
| MT_CONFIG_DIR | Configuration directory | ~/.config/mtran/server | Any path |
| MT_MODEL_DIR | Model directory | ~/.config/mtran/models | Any path |
| MT_HOST | Server host address | 0.0.0.0 | Any IP address |
| MT_PORT | Server port | 8989 | 1-65535 |
| MT_ENABLE_UI | Enable Web UI | true | true, false |
| MT_OFFLINE | Offline mode, disable automatic download of new language models, only use downloaded models | false | true, false |
| MT_WORKER_IDLE_TIMEOUT| Worker idle timeout (seconds) | 300 | Any positive integer |
| MT_API_TOKEN | API access token | empty | Any string |
Example:
```bash
# Set log level to debug
export MT_LOG_LEVEL=debug
# Set port to 9000
export MT_PORT=9000
# Start the server
./mtranserver
```
### API Documentation
#### System Endpoints
| Endpoint | Method | Description | Auth Required |
| -------- | ------ | ----------- | ------------- |
| `/version` | GET | Get service version | No |
| `/health` | GET | Health check | No |
| `/__heartbeat__` | GET | Heartbeat check | No |
| `/__lbheartbeat__` | GET | Load balancer heartbeat check | No |
| `/docs/*` | GET | Swagger API documentation | No |
#### Translation Endpoints
| Endpoint | Method | Description | Auth Required |
| -------- | ------ | ----------- | ------------- |
| `/languages` | GET | Get supported language list | Yes |
| `/translate` | POST | Single text translation | Yes |
| `/translate/batch` | POST | Batch translation | Yes |
**Single Text Translation Request Example:**
```json
{
"from": "en",
"to": "zh-Hans",
"text": "Hello, world!",
"html": false
}
```
**Batch Translation Request Example:**
```json
{
"from": "en",
"to": "zh-Hans",
"texts": ["Hello, world!", "Good morning!"],
"html": false
}
```
**Authentication Methods:**
- Header: `Authorization: Bearer <token>`
- Query: `?token=<token>`
#### Translation Plugin Compatible Endpoints
The server provides compatible endpoints for multiple translation plugins:
@@ -188,8 +104,6 @@ The server provides compatible endpoints for multiple translation plugins:
>
> - [Kiss Translator](https://github.com/fishjar/kiss-translator) - Scroll down in `Settings` page to find the custom interface `Custom`. Similarly, set `Maximum Concurrent Requests` and `Request Interval Time` to fully utilize server performance. I set `Maximum Concurrent Requests` to `100` and `Request Interval Time` to `1`. You can adjust based on your server configuration.
>
> **Important Note:** When translating a language pair for the first time, the server will automatically download the corresponding translation model (unless offline mode is enabled). This process may take some time depending on your network speed and model size. After the model is downloaded, the engine startup also requires a few seconds. Once ready, subsequent translation requests will enjoy millisecond-level response times. It's recommended to test a translation before actual use to allow the server to pre-download and load the models.
>
> Configure the plugin's custom interface address according to the table below.
| Name | URL | Plugin Setting |
@@ -204,18 +118,30 @@ The server provides compatible endpoints for multiple translation plugins:
**Regular users can start using the service after setting up the plugin interface address according to the table above.**
## Support Me
## Comparison with Similar Projects
[Buy me a coffee ☕️](https://www.creem.io/payment/prod_3QOnrHlGyrtTaKHsOw9Vs1)
Here are some similar projects, you can try them if you have other needs:
[Mainland China 💗 Like](./DONATE.md)
| Project Name | Memory Usage | Concurrency | Translation Quality | Speed | Additional Info |
| ---------------------------------------------------------------------- | -------------- | ----------- | ------------------- | ---------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [NLLB](https://github.com/facebookresearch/fairseq/tree/nllb) | Very High | Poor | Average | Slow | Android port [RTranslator](https://github.com/niedev/RTranslator) has many optimizations, but still has high resource usage and is not fast |
| [LibreTranslate](https://github.com/LibreTranslate/LibreTranslate) | Very High | Average | Average | Medium | Mid-range CPU processes 3 sentences/s, high-end CPU processes 15-20 sentences/s. [Details](https://community.libretranslate.com/t/performance-benchmark-data/486) |
| [OPUS-MT](https://github.com/OpenNMT/CTranslate2#benchmarks) | High | Average | Below Average | Fast | [Performance Tests](https://github.com/OpenNMT/CTranslate2#benchmarks) |
| Any LLM | Extremely High | Dynamic | Very Good | Very Slow | High hardware requirements. If you need high concurrency translation, it is recommended to use vllm framework to control translation concurrency through memory and VRAM usage. |
| MTranServer (This Project) | Medium | High | Average | Ultra Fast | 50ms average response time per request. The new model improves translation quality, leading to increased memory usage. Optimization will be prioritized when time permits. |
> Table data is for CPU, English to Chinese scenarios simple testing, not strict testing, non-quantized version comparison, for reference only.
# Advanced Configuration Guide
Please refer to [API_en.md](API_en.md) and the API documentation after startup.
## Star History
[![Star History Chart](https://api.star-history.com/svg?repos=xxnuo/MTranServer&type=Timeline)](https://star-history.com/#xxnuo/MTranServer&Timeline)
[![Star History Chart](https://api.star-history.com/svg?repos=xxnuo/MTranServer&type=Timeline)](https://www.star-history.com/#xxnuo/MTranServer&Timeline)
## Thanks
[Mozilla](https://github.com/mozilla) for the [models](https://github.com/mozilla/firefox-translations-models).
[Bergamot Project](https://browser.mt/) for awesome idea of local translation.
[Mozilla](https://github.com/mozilla) for the [models](https://github.com/mozilla/firefox-translations-models).

147
docs/README_fr.md Normal file
View File

@@ -0,0 +1,147 @@
# MTranServer
[中文](../README.md) | [English](README_en.md) | [日本語](README_ja.md) | [Français](README_fr.md) | [Deutsch](README_de.md)
<!-- <img src="../images/icon.png" width="64px" height="64px" align="right" alt="MTran"> -->
Un serveur de modèle de traduction hors ligne ultra-rapide avec une consommation de ressources minimale. Aucune carte graphique requise. Temps de réponse moyen de 50 ms par requête. Prend en charge la traduction des principales langues du monde.
Notez que ce serveur de modèle se concentre sur la `traduction hors ligne`, la `vitesse de réponse`, le `déploiement multiplateforme` et l'`exécution locale` pour atteindre l'objectif de `traduction gratuite illimitée`. En raison des contraintes de taille et d'optimisation du modèle, la qualité de la traduction ne sera certainement pas aussi bonne que celle des grands modèles de traduction.
> Pour une traduction de haute qualité, il est recommandé d'utiliser les API de grands modèles en ligne.
<img src="../images/preview.png" width="auto" height="460">
## Guide d'utilisation
Téléchargez la dernière version pour votre plateforme depuis les [Releases](https://github.com/xxnuo/MTranServer/releases), et lancez simplement le programme en ligne de commande pour l'utiliser.
> [MTranServer](https://github.com/xxnuo/MTranServer) est principalement destiné à un environnement serveur, c'est pourquoi seuls le service en ligne de commande et le déploiement Docker sont actuellement disponibles.
>
> Pendant mon temps libre, je vais améliorer [MTranDesktop](https://github.com/xxnuo/MTranDesktop) pour une utilisation sur bureau. Les contributions sont les bienvenues.
Après le démarrage du serveur, l'adresse de l'interface utilisateur simple incluse dans le programme et l'adresse de la documentation en ligne seront affichées dans les journaux. Voici un aperçu :
![UI](../images/ui.png)
![Documentation](../images/swagger.png)
### Arguments de la ligne de commande
```bash
./mtranserver [options]
Options :
-version, -v Afficher les informations de version
-log-level string Niveau de journalisation (debug, info, warn, error) (par défaut "warn")
-config-dir string Répertoire de configuration (par défaut "~/.config/mtran/server")
-model-dir string Répertoire des modèles (par défaut "~/.config/mtran/models")
-host string Adresse d'écoute du serveur (par défaut "0.0.0.0")
-port string Port du serveur (par défaut "8989")
-ui Activer l'interface Web (par défaut true)
-offline Activer le mode hors ligne, ne pas télécharger automatiquement les nouveaux modèles (par défaut false)
-worker-idle-timeout int Délai d'inactivité du Worker en secondes (par défaut 300)
Exemples :
./mtranserver --host 127.0.0.1 --port 8080
./mtranserver --ui --offline
./mtranserver -v
```
### Déploiement Docker Compose
Créez un répertoire vide, puis créez un fichier `compose.yml` avec le contenu suivant :
```yml
services:
mtranserver:
image: xxnuo/mtranserver:latest
container_name: mtranserver
restart: unless-stopped
ports:
- "8989:8989"
environment:
- MT_HOST=0.0.0.0
- MT_PORT=8989
- MT_ENABLE_UI=true
- MT_OFFLINE=false
# - MT_API_TOKEN=votre_jeton_secret_ici
volumes:
- ./models:/app/models
```
```bash
docker pull xxnuo/mtranserver:latest
docker compose up -d
```
>
> **Remarque importante :**
>
> Lors de la première traduction d'une paire de langues, le serveur téléchargera automatiquement le modèle de traduction correspondant (sauf si le mode hors ligne est activé). Ce processus peut prendre un certain temps en fonction de la vitesse de votre réseau et de la taille du modèle. Une fois le modèle téléchargé, le démarrage du moteur prend également quelques secondes. Les requêtes de traduction suivantes bénéficieront d'un temps de réponse de l'ordre de la milliseconde. Il est recommandé de tester une traduction avant l'utilisation réelle pour permettre au serveur de pré-télécharger et de charger les modèles.
>
> Le programme est souvent mis à jour. Si vous rencontrez des problèmes, essayez de mettre à jour vers la dernière version.
#### Interface compatible avec les plugins de traduction
Le serveur fournit plusieurs interfaces compatibles avec les plugins de traduction :
| Interface | Méthode | Description | Plugins supportés |
| --------- | ------- | ----------- | ----------------- |
| `/imme` | POST | Interface pour le plugin Immersive Translate | [Immersive Translate](https://immersivetranslate.com/) |
| `/kiss` | POST | Interface pour le plugin Kiss Translator | [Kiss Translator](https://github.com/fishjar/kiss-translator) |
| `/deepl` | POST | Interface compatible DeepL API v2 | Clients supportant l'API DeepL |
| `/google/language/translate/v2` | POST | Interface compatible Google Translate API v2 | Clients supportant l'API Google Translate |
| `/google/translate_a/single` | GET | Interface compatible Google translate_a/single | Clients supportant la traduction web Google |
| `/hcfy` | POST | Interface compatible Selection Translator | [Selection Translator](https://github.com/Selection-Translator/crx-selection-translate) |
**Guide de configuration des plugins :**
> Note :
>
> - [Immersive Translate](https://immersivetranslate.com/docs/services/custom/) : Activez les fonctionnalités `Beta` dans le mode développeur de la page `Paramètres`, et vous verrez `Paramètres API personnalisés` dans `Services de traduction` ([tutoriel officiel avec images](https://immersivetranslate.com/docs/services/custom/)). Ensuite, augmentez le `Nombre maximum de requêtes par seconde` dans `Paramètres API personnalisés` pour utiliser pleinement les performances du serveur. J'ai réglé le `Nombre maximum de requêtes par seconde` à `512` et le `Nombre maximum de paragraphes par requête` à `1`. Vous pouvez ajuster cela en fonction de la configuration de votre serveur.
>
> - [Kiss Translator](https://github.com/fishjar/kiss-translator) : Faites défiler vers le bas dans la page `Paramètres` jusqu'aux paramètres d'interface, vous verrez l'interface personnalisée `Custom`. De même, réglez le `Nombre maximum de requêtes simultanées` et le `Temps d'intervalle entre chaque requête` pour utiliser pleinement les performances du serveur. J'ai réglé le `Nombre maximum de requêtes simultanées` à `100` et le `Temps d'intervalle entre chaque requête` à `1`. Vous pouvez ajuster cela en fonction de la configuration de votre serveur.
>
> Ensuite, configurez l'adresse de l'interface personnalisée du plugin selon le tableau ci-dessous.
| Nom | URL | Réglage du plugin |
| --- | --- | ----------------- |
| Immersive Translate sans mot de passe | `http://localhost:8989/imme` | `Paramètres API personnalisés` - `URL de l'API` |
| Immersive Translate avec mot de passe | `http://localhost:8989/imme?token=your_token` | Idem, changez `your_token` à la fin de l'URL par la valeur de votre `MT_API_TOKEN` |
| Kiss Translator sans mot de passe | `http://localhost:8989/kiss` | `Paramètres d'interface` - `Custom` - `URL` |
| Kiss Translator avec mot de passe | `http://localhost:8989/kiss` | Idem, remplissez `KEY` avec `your_token` |
| Compatible DeepL | `http://localhost:8989/deepl` | Utilisez l'authentification `DeepL-Auth-Key` ou `Bearer` |
| Compatible Google | `http://localhost:8989/google/language/translate/v2` | Utilisez le paramètre `key` ou l'authentification `Bearer` |
| Selection Translator | `http://localhost:8989/hcfy` | Supporte le paramètre `token` ou l'authentification `Bearer` |
**Les utilisateurs ordinaires peuvent utiliser le service en configurant l'adresse de l'interface du plugin selon le contenu du tableau.**
## Projets similaires
Voici quelques projets avec des fonctionnalités similaires. Si vous avez d'autres besoins, vous pouvez essayer ces projets :
| Nom du projet | Utilisation mémoire | Performance concurrente | Qualité traduction | Vitesse | Autres informations |
| ------------- | ------------------- | ----------------------- | ------------------ | ------- | ------------------- |
| [NLLB](https://github.com/facebookresearch/fairseq/tree/nllb) | Très élevée | Mauvaise | Moyenne | Lente | Le portage Android [RTranslator](https://github.com/niedev/RTranslator) a de nombreuses optimisations, mais l'utilisation des ressources reste élevée et ce n'est pas rapide |
| [LibreTranslate](https://github.com/LibreTranslate/LibreTranslate) | Très élevée | Moyenne | Moyenne | Moyenne | Un CPU milieu de gamme traite 3 phrases/s, un CPU haut de gamme 15-20 phrases/s. [Détails](https://community.libretranslate.com/t/performance-benchmark-data/486) |
| [OPUS-MT](https://github.com/OpenNMT/CTranslate2#benchmarks) | Élevée | Moyenne | Assez mauvaise | Rapide | [Tests de performance](https://github.com/OpenNMT/CTranslate2#benchmarks) |
| Autres grands modèles | Ultra élevée | Dynamique | Très bonne | Très lente | Exigences matérielles élevées. Si vous avez besoin d'une traduction à haute concurrence, il est recommandé d'utiliser le framework vllm pour contrôler la concurrence via l'utilisation de la mémoire et de la VRAM |
| Ce projet | Moyenne | Élevée | Moyenne | Ultra rapide | Temps de réponse moyen de 50 ms par requête. Le nouveau modèle a amélioré la qualité de la traduction, entraînant une augmentation de l'utilisation de la mémoire. L'optimisation sera priorisée quand le temps le permettra |
> Les données du tableau sont pour des tests simples CPU, scénarios anglais vers chinois, pas des tests stricts, comparaison de versions non quantifiées, pour référence seulement.
# Guide de configuration avancée
Veuillez vous référer au fichier [API_fr.md](API_fr.md) et à la documentation API après le démarrage.
## Star History
[![Star History Chart](https://api.star-history.com/svg?repos=xxnuo/MTranServer&type=Timeline)](https://www.star-history.com/#xxnuo/MTranServer&Timeline)
## Thanks
[Bergamot Project](https://browser.mt/) for awesome idea of local translation.
[Mozilla](https://github.com/mozilla) for the [models](https://github.com/mozilla/firefox-translations-models).

147
docs/README_ja.md Normal file
View File

@@ -0,0 +1,147 @@
# MTranServer
[中文](../README.md) | [English](README_en.md) | [日本語](README_ja.md) | [Français](README_fr.md) | [Deutsch](README_de.md)
<!-- <img src="../images/icon.png" width="64px" height="64px" align="right" alt="MTran"> -->
超低リソース消費、超高速なオフライン翻訳モデルサーバーです。グラフィックカードは不要です。リクエストあたりの平均応答時間は50ミリ秒です。世界の主要言語の翻訳をサポートしています。
注意:このモデルサーバーは、`オフライン翻訳``応答速度``クロスプラットフォーム展開``ローカル実行`による`無制限の無料翻訳`という設計目標に焦点を当てており、モデルサイズと最適化の制限により、翻訳品質は大モデル翻訳の効果には及びません。
> 高品質な翻訳が必要な場合は、オンラインの大規模言語モデルAPIの使用をお勧めします。
<img src="../images/preview.png" width="auto" height="460">
## 使用方法
[Releases](https://github.com/xxnuo/MTranServer/releases) から対応するプラットフォームの最新バージョンをダウンロードし、コマンドラインでプログラムを起動するだけで使用できます。
> [MTranServer](https://github.com/xxnuo/MTranServer) は主にサーバー使用環境向けであるため、現在はコマンドラインサービスと Docker デプロイのみ提供しています。
>
> 時間があるときに、デスクトップ向けの [MTranDesktop](https://github.com/xxnuo/MTranDesktop) を改善する予定です。貢献を歓迎します。
サーバー起動後、ログにプログラム付属の簡易 UI のアドレスとオンラインドキュメントのアドレスが出力されます。以下はプレビューです。
![UI](../images/ui.png)
![ドキュメント](../images/swagger.png)
### コマンドライン引数
```bash
./mtranserver [オプション]
オプション:
-version, -v バージョン情報を表示
-log-level string ログレベル (debug, info, warn, error) (デフォルト "warn")
-config-dir string 設定ディレクトリ (デフォルト "~/.config/mtran/server")
-model-dir string モデルディレクトリ (デフォルト "~/.config/mtran/models")
-host string サーバーリッスンアドレス (デフォルト "0.0.0.0")
-port string サーバーポート (デフォルト "8989")
-ui Web UI を有効にする (デフォルト true)
-offline オフラインモードを有効にする(新しいモデルを自動ダウンロードしない) (デフォルト false)
-worker-idle-timeout int Worker アイドルタイムアウト(秒) (デフォルト 300)
例:
./mtranserver --host 127.0.0.1 --port 8080
./mtranserver --ui --offline
./mtranserver -v
```
### Docker Compose デプロイ
空のディレクトリを作成し、以下の内容で `compose.yml` ファイルを作成します。
```yml
services:
mtranserver:
image: xxnuo/mtranserver:latest
container_name: mtranserver
restart: unless-stopped
ports:
- "8989:8989"
environment:
- MT_HOST=0.0.0.0
- MT_PORT=8989
- MT_ENABLE_UI=true
- MT_OFFLINE=false
# - MT_API_TOKEN=your_secret_token_here
volumes:
- ./models:/app/models
```
```bash
docker pull xxnuo/mtranserver:latest
docker compose up -d
```
>
> **重要:**
>
> 初めて特定の言語ペアを翻訳する場合、サーバーは対応する翻訳モデルを自動的にダウンロードします(オフラインモードが有効でない場合)。このプロセスには、ネットワーク速度とモデルサイズに応じて時間がかかる場合があります。モデルのダウンロード完了後、エンジンの起動にも数秒かかります。その後の翻訳リクエストはミリ秒レベルの応答速度になります。正式に使用する前に一度翻訳をテストし、サーバーにモデルを事前にダウンロードしてロードさせることをお勧めします。
>
> プログラムは頻繁に更新されます。問題が発生した場合は、最新バージョンに更新してみてください。
#### 翻訳プラグイン互換インターフェース
サーバーは複数の翻訳プラグインの互換インターフェースを提供しています。
| インターフェース | メソッド | 説明 | 対応プラグイン |
| ---------------- | -------- | ---- | -------------- |
| `/imme` | POST | 没入型翻訳Immersive Translateプラグインインターフェース | [没入型翻訳](https://immersivetranslate.com/) |
| `/kiss` | POST | Kiss Translator プラグインインターフェース | [Kiss Translator](https://github.com/fishjar/kiss-translator) |
| `/deepl` | POST | DeepL API v2 互換インターフェース | DeepL API 対応クライアント |
| `/google/language/translate/v2` | POST | Google Translate API v2 互換インターフェース | Google Translate API 対応クライアント |
| `/google/translate_a/single` | GET | Google translate_a/single 互換インターフェース | Google ウェブ翻訳対応クライアント |
| `/hcfy` | POST | 划词翻译Selection Translator互換インターフェース | [划词翻译](https://github.com/Selection-Translator/crx-selection-translate) |
**プラグイン設定説明:**
> 注:
>
> - [没入型翻訳](https://immersivetranslate.com/docs/services/custom/)`設定`ページの開発者モードで`Beta`機能を有効にすると、`翻訳サービス`の中に`カスタムAPI設定`が表示されます([公式画像付きチュートリアル](https://immersivetranslate.com/docs/services/custom/))。その後、`カスタムAPI設定`の`秒間最大リクエスト数`を高く設定して、サーバーの性能を最大限に引き出してください。私は`秒間最大リクエスト数`を`512`、`リクエストごとの最大段落数`を`1`に設定しています。サーバーの構成に合わせて調整してください。
>
> - [Kiss Translator](https://github.com/fishjar/kiss-translator)`設定`ページでインターフェース設定を下にスクロールすると、カスタムインターフェース `Custom` が表示されます。同様に、`最大同時リクエスト数`と`リクエスト間隔時間`を設定してサーバーの性能を引き出してください。私は`最大同時リクエスト数`を`100`、`リクエスト間隔時間`を`1`に設定しています。サーバーの構成に合わせて調整してください。
>
> 次に、以下の表に従ってプラグインのカスタムインターフェースアドレスを設定します。
| 名前 | URL | プラグイン設定 |
| ---- | --- | -------------- |
| 没入型翻訳(パスワードなし) | `http://localhost:8989/imme` | `カスタムAPI設定` - `API URL` |
| 没入型翻訳(パスワードあり) | `http://localhost:8989/imme?token=your_token` | 同上、URL末尾の `your_token` をあなたの `MT_API_TOKEN` の値に変更してください |
| Kiss Translatorパスワードなし | `http://localhost:8989/kiss` | `インターフェース設定` - `Custom` - `URL` |
| Kiss Translatorパスワードあり | `http://localhost:8989/kiss` | 同上、`KEY``your_token` を入力してください |
| DeepL 互換 | `http://localhost:8989/deepl` | `DeepL-Auth-Key` または `Bearer` 認証を使用 |
| Google 互換 | `http://localhost:8989/google/language/translate/v2` | `key` パラメータまたは `Bearer` 認証を使用 |
| 划词翻译 | `http://localhost:8989/hcfy` | `token` パラメータまたは `Bearer` 認証をサポート |
**一般ユーザーは、表の内容に従ってプラグインの使用インターフェースアドレスを設定すれば使用できます。**
## 類似プロジェクト
同様の機能を持つプロジェクトをいくつか挙げます。他のニーズがある場合は、これらのプロジェクトを試してみてください。
| プロジェクト名 | メモリ使用量 | 同時実行性能 | 翻訳品質 | 速度 | その他情報 |
| -------------- | ------------ | ------------ | -------- | ---- | ---------- |
| [NLLB](https://github.com/facebookresearch/fairseq/tree/nllb) | 非常に高い | 悪い | 普通 | 遅い | Android移植版の [RTranslator](https://github.com/niedev/RTranslator) は多くの最適化がありますが、それでもリソース使用量が高く、高速ではありません |
| [LibreTranslate](https://github.com/LibreTranslate/LibreTranslate) | 非常に高い | 普通 | 普通 | 中程度 | ミドルレンジCPUで毎秒3文、ハイエンドCPUで毎秒15-20文処理。[詳細](https://community.libretranslate.com/t/performance-benchmark-data/486) |
| [OPUS-MT](https://github.com/OpenNMT/CTranslate2#benchmarks) | 高い | 普通 | やや悪い | 速い | [性能テスト](https://github.com/OpenNMT/CTranslate2#benchmarks) |
| その他大規模モデル | 超高い | 動的 | 非常に良い | 非常に遅い | ハードウェア要件が高い。高同時実行翻訳が必要な場合は、vllmフレームワークの使用をお勧めします。メモリとVRAM使用量で翻訳同時実行数を制御できます。 |
| 本プロジェクト | 中程度 | 高い | 普通 | 極めて速い | リクエストあたり平均応答時間50ms。新モデルは翻訳品質を向上させましたが、メモリ使用量が増加しました。時間があれば最適化に着手します。 |
> 表のデータはCPU、英中翻訳シナリオでの簡易テストであり、厳密なテストではなく、非量子化バージョンの比較です。参考程度にしてください。
# 高度な設定説明
[API_ja.md](API_ja.md) ファイルおよび起動後の API ドキュメントを参照してください。
## Star History
[![Star History Chart](https://api.star-history.com/svg?repos=xxnuo/MTranServer&type=Timeline)](https://www.star-history.com/#xxnuo/MTranServer&Timeline)
## Thanks
[Bergamot Project](https://browser.mt/) for awesome idea of local translation.
[Mozilla](https://github.com/mozilla) for the [models](https://github.com/mozilla/firefox-translations-models).