Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/aien-translate/blob/main/README.md # aien-translate aien-dev/aien-translate Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `aien-translate / README.md` 111 lines · 7424 bytes Raw Blame History Rendered 1 # aien-translate 2 3 4 **English** · [简体中文](docs/i18n/README.zh-CN.md) · [繁體中文](docs/i18n/README.zh-TW.md) · [日本語](docs/i18n/README.ja.md) · [한국어](docs/i18n/README.ko.md) · [Español](docs/i18n/README.es.md) · [Français](docs/i18n/README.fr.md) · [Deutsch](docs/i18n/README.de.md) · [Português](docs/i18n/README.pt.md) · [Русский](docs/i18n/README.ru.md) 5 6 7 Translate your website into 31 languages with your own AI model. No API key, no cloud service, and your visitors' text never leaves your server. 8 9 aien-translate is a translation server for [translate.js](https://github.com/xnx3/translate). It translates with AIEN's own inference runtime. It also works with any server that offers the same OpenAI-style chat API. 10 11 ## Translate your website 12 13 **1. Start the server on loopback.** You need Rust and a running model server (AIEN's `aien-serve-http`, or any OpenAI-style chat server). Obtain the model server owner's approval before using a shared engine. 14 15 ``` 16 git clone https://github.com/aien-dev/aien-translate 17 cd aien-translate 18 cargo build --release 19 ./target/release/aien-translate --engine http://127.0.0.1:18091 20 ``` 21 22 The server refuses non-loopback `--listen` addresses. For a local-only test, the default loopback listener needs no token. **For a public site**, create a private, randomly generated single-line token file (at least 32 bytes; owner-readable only), then start with `--auth-token-file /private/path/token`. Publish only a same-origin HTTPS reverse-proxy route to this loopback service. The proxy must authenticate/authorize visitors, reject cross-site requests (check `Origin` or Fetch Metadata and use CSRF protection for cookie-authenticated users), rate-limit by its verified client identity (not client-supplied forwarding headers), cap request size, reject excess work without queueing, strip client `Authorization` headers, and set the backend `Authorization: Bearer ` header itself. Restrict direct access to the listener to the proxy account. Do not embed the token in JavaScript or expose this service directly: the backend sends no CORS allow-origin header, and CORS was never authentication. If your public site permits anonymous visitors, the proxy must still enforce per-visitor quotas and abuse controls before it forwards requests. 23 24 **2. Add translate.js to your page, behind the same-origin proxy.** Download `translate.js` from [its repository](https://github.com/xnx3/translate) and host it with your site. Then add these lines just before ``: 25 26 ```html 27 28 33 ``` 34 35 **3. Open your page.** A language menu appears, and choosing a language translates the page in place. To pick a language from your own code, call `translate.changeLanguage('japanese')`. The browser must reach the proxy on the same origin; the localhost backend is not reachable from a remote visitor. 36 37 ### Check locally 38 39 With no token configured, the loopback-only server responds to: 40 41 ``` 42 curl http://127.0.0.1:18097/health 43 curl -X POST http://127.0.0.1:18097/translate.json \ 44 -d 'from=english&to=japanese&text=%5B%22Hello%20world%22%5D' 45 ``` 46 47 With `--auth-token-file`, the proxy must add the bearer header; unauthenticated requests receive HTTP 401. The first command reports the model in use. The second returns the translation in `"text"`, for example `["こんにちは世界"]`. 48 49 ## What it protects 50 51 Every translation is checked before a visitor sees it: 52 53 - Links, email addresses, code in backticks, and placeholders such as `{name}` or `%s` must come through unchanged. 54 - Product names on the keep list (AIEN, Omega, Aien, and others) are never translated. Use `--keep-file` to supply your own list. 55 - A translation that is empty, or far longer than the original, is thrown away. 56 57 If any check fails, the visitor sees the original text instead of a broken translation. 58 59 ## How it works 60 61 - translate.js sends the page's text to `/translate.json`. The server sends it to the model in batches, one request at a time, because the GPU may be shared. 62 - Every translation is saved (SQLite), so the same text is never translated twice. Repeat visits are instant. 63 - translate.js cuts web addresses apart at `//`. The server keeps those pieces in place so links are rebuilt correctly. 64 - If the model's answer for a batch can't be matched to the inputs, the batch is split and retried, down to single items. 65 66 ## Options 67 68 ``` 69 --listen loopback address only (default 127.0.0.1:18097) 70 --engine model server (default http://127.0.0.1:18091) 71 --cache saved translations (default ~/.local/state/aien-translate/cache.sqlite) 72 --keep-file names never translated, one per line 73 --auth-token-file bearer secret for a trusted local proxy 74 ``` 75 76 Each translation request is limited to 40 texts, 3,000 characters and a 16 KiB body. The server admits at most six translation requests per minute from each directly connected IP, tracks at most 1,024 IPs, and admits only one translation request at a time (HTTP 429 rather than waiting in an inference queue). Behind a proxy, the backend sees only the proxy IP; these limits **do not replace the proxy's per-visitor rate limit**. Slow or restarting model requests can still occupy the one active slot for a long time. 77 78 Endpoints: `/translate.json`, `/language.json`, `/connectTest.json`, `/init.json` and `/health`. `/ip.json` (location lookup) is not offered. With a token, `/translate.json` and `/health` require it. 79 80 ## Languages 81 82 English, Simplified and Traditional Chinese, Japanese, Korean, Spanish, French, German, Portuguese, Italian, Russian, Ukrainian, Polish, Dutch, Swedish, Danish, Norwegian, Finnish, Czech, Romanian, Hungarian, Greek, Turkish, Arabic, Persian, Hindi, Bengali, Thai, Vietnamese, Indonesian and Malay. The list is in `src/langs.rs`. 83 84 ## Tests 85 86 - `cargo test` runs unit tests, plus end-to-end tests against a fake model (no GPU needed). 87 - `demo/` has a page that uses the real translate.js. Serve the folder and run `python demo/check.py URL` (needs Playwright) to see the translated page. 88 89 ## Translations of this page 90 91 The other-language versions of this page were made by aien-translate itself, with `scripts/translate_readme.py`. They are machine translations, and the English version is the original. 92 93 ## Limits 94 95 - Speed depends on the GPU. On AIEN's runtime, a batch takes about a second when the GPU is free, and much longer when another job is using it. 96 - These are machine translations. They are good for reading, but no person has reviewed them. 97 98 ## License 99 100 AGPL-3.0. See [LICENSE](LICENSE). 101 102 ## Human-Directed Agentic Engineering 103 104 Development follows Human-Directed Agentic Engineering (HDAE): humans define goals, 105 architecture, constraints, acceptance criteria, and stopping points; agents implement, 106 execute checks, diagnose failures, and revise within those boundaries. Human review 107 retains responsibility for claims, acceptance, and release decisions. 108 109 For the documented method and a systems-software case study, see Gregory M. Kurtzer, 110 *Ginux: Building an Independent Kernel That Runs Linux Userspace through Human-Directed 111 Agentic Engineering* (2026), https://doi.org/10.5281/zenodo.`23682548`.