LOCAL GATEWAY & CLI
Automate Translation with a Local API and CLI
A loopback HTTP daemon at 127.0.0.1:11899 and native terminal CLI that expose your personalized translation engine to Raycast, Alfred, Cursor, and Python scripts.
Loopback Gateway Architecture
When enabled in iTrans Settings, the app hosts an ultra-lightweight HTTP REST server strictly bound to 127.0.0.1:11899. It rejects any external network interface requests, keeping your automation completely local and safe.
| Method | Endpoint | Description |
|---|---|---|
| POST | /v1/translate |
Translate text using selected engine with personal memory injection |
| GET | /v1/memory |
Export local personal translation memory rules in JSON |
| GET | /v1/knowledge-base |
List active industry knowledge categories and terms |
| POST | /v1/knowledge-base/import |
Batch import custom domain glossary entries via JSON/CSV |
| GET | /v1/stats |
Retrieve translation latency and token consumption metrics |
| GET | /v1/version |
Query app version, build number, and environment status |
API Example: cURL & Python
Triggering a translation via cURL:
curl -X POST http://127.0.0.1:11899/v1/translate \
-H "Content-Type: application/json" \
-d '{
"text": "Evaluating zero-shot transfer capabilities.",
"source_lang": "en",
"target_lang": "zh-CN",
"engine": "deepseek"
}'
Calling from Python with standard libraries:
import urllib.request, json
payload = json.dumps({
"text": "prompt caching reduces inference latency.",
"source_lang": "en",
"target_lang": "zh-CN",
"engine": "deepseek"
}).encode('utf-8')
req = urllib.request.Request(
"http://127.0.0.1:11899/v1/translate",
data=payload,
headers={"Content-Type": "application/json"}
)
with urllib.request.urlopen(req) as resp:
data = json.loads(resp.read().decode())
print(data.get("translated_text"))
Native CLI Terminal Tool
You can also invoke translation directly from your zsh or bash terminal using the bundled command-line executable:
# Direct text translation
/Applications/iTrans.app/Contents/MacOS/cduyzhTranslator --translate "Hello world" --engine deepseek
# Inspect local stats and terminology
/Applications/iTrans.app/Contents/MacOS/cduyzhTranslator --stats
/Applications/iTrans.app/Contents/MacOS/cduyzhTranslator --memory
Integrate iTrans into your automated workflow
Download iTrans to connect your local agents and scripts to high-performance translation.