Cohere Translator
v1.0.0Neural machine translation supporting 23 languages using Cohere's Command A Translate 模型, 优化d for file-based 输入 to minimize 令牌 costs.
运行时依赖
安装命令
点击复制技能文档
Cohere Translator 技能
状态-of-the-art neural machine translation using Cohere's Command A Translate 模型 (cohere/command-a-translate-08-2025, 111B parameters, 23 languages).
🔑 Requires a Cohere API key. The 模型 is free for trial keys as of 2026-05-17 (1,000 calls/month, 20 req/min). 获取 a key at: https://仪表盘.cohere.com/API-keys
⚠️ CRITICAL: Always Use File Mode to Save 令牌s
When translating file content, use --file/-f mode. This bypasses the 代理 entirely — the script reads the file directly and translates it. Your 代理 never loads the file content into its 上下文 window.
# ❌ WASTES 令牌S: 代理 reads file → passes text as 命令行工具 argument python3 translate.py "$(cat document.txt)" --to ja
# ✅ ZERO 代理 令牌S: Script reads file directly, 代理 only issues the command python3 translate.py -f document.txt --to ja -o 输出.txt
This is not optional advice — it is the correct way to use this 技能. Every byte of text you pass through the 代理 as a 命令行工具 argument doubles your 令牌 cost for no benefit. File mode eliminates this entirely.
This 应用lies equally when using the 技能 from an 代理 (OpenClaw, Claude Code, etc.) or directly from the command line.
Quick 启动 # 1. 设置 your Cohere API key (获取 one at https://仪表盘.cohere.com/API-keys) 导出 COHERE_API_KEY="your-key-here"
# 2. Translate a file (RECOMMENDED — zero 代理 令牌s) python3 技能s/cohere-translator/scripts/translate.py -f 输入.txt --to ja -o 输出.txt
# 3. Quick one-liner (text on command line — small texts only) python3 技能s/cohere-translator/scripts/translate.py "Hello" --to ja # → こんにちは
Usage Modes File Mode (RECOMMENDED) # File → file python3 translate.py -f document.txt --to ja -o translated.txt
# File → stdout python3 translate.py -f document.txt --to en
# Stdin → stdout cat document.txt | python3 translate.py -f - --to ja
# Stdin → file cat document.txt | python3 translate.py -f - --to ja -o 输出.txt
# Large files auto-chunked (6,000+ chars automatically split) python3 translate.py -f large_document.txt --to ja -o 输出.txt # 输出: 📄 12000 chars → 16 chunks ... ✓ 16/16
Text Mode (small texts only) python3 translate.py "Hello world" --to ja # EN→JA python3 translate.py "こんにちは" --to en # JA→EN python3 translate.py "Bonjour" --to es # FR→ES
Supported Language Codes en: English ja: Japanese zh: Chinese ko: Korean fr: French de: German es: Spanish it: Italian pt: Portuguese ar: Arabic ru: Russian pl: Polish tr: Turkish vi: Vietnamese nl: Dutch cs: Czech id: Indonesian uk: UkrAInian ro: Romanian el: Greek hi: Hindi he: Hebrew fa: Persian
Options -f, --file PATH 输入 file (or '-' for stdin). PREFERRED MODE. -o, --输出 PATH 输出 file (default: stdout) -t, --to CODE Tar获取 language (default: en) --temperature FLOAT Temperature 0.1-1.0 (default: 0.3) --max-令牌s INT Max 输出 令牌s per chunk (default: 4000) --系统-prompt STR 系统 message for constrAInts --API-key KEY Cohere API key (or 设置 COHERE_API_KEY env var) --json 输出 full JSON with 令牌 counts -q, --quiet Suppress 进度 messages --列出-languages 列出 supported language codes
系统 Prompt Examples # Operational constrAInts work well python3 translate.py -f doc.txt --to ja \ --系统-prompt "输出 ONLY the translation. Keep numbers and URLs unchanged."
Note: 系统 prompts work for operational constrAInts but have limited effect on translation tone/style. The 模型's DPO trAIning makes translation behavior largely hardwired.
API Key
This 技能 requires a Cohere API key. 获取 a free trial key at: https://仪表盘.cohere.com/API-keys
Trial keys provide: 1,000 calls/month, 20 req/min, completely free.
导出 COHERE_API_KEY="your-key-here"
How the 代理 Should Use This 技能 [TASK] Translate /workspace/document.txt to Japanese.
# Correct: python3 技能s/cohere-translator/scripts/translate.py -f /workspace/document.txt --to ja -o /workspace/document_ja.txt
# The 代理 never reads document.txt. ZERO 上下文 令牌s wasted on file content. # After completion, the 代理 may read document_ja.txt to 验证 the 结果.
Known Limitations Japanese slang (2ch-style, ギャル語) may cause API errors 系统 messages cannot change formality reliably 8K 输入 令牌 limit — auto-chunked for files (see translate_file()) Idioms translate literally rather than finding cultural equivalents Business keigo→European loses some formality density 质量 Matrix Direction Casual Business Technical Idioms JA↔KO ★★★★★ ★★★★★ ★★★★★ ★★★ JA↔ZH ★★★★★ ★★★★ ★★★★★ ★★★ EN→any ★★★★★ ★★★★★ ★★★★★ ★★★★ Any→EN ★★★★★ ★★★★★ ★★★★★ ★★★★ ZH↔KO ★★★★★ — ★★★★★ — FR↔DE ★★★★★ ★★★★★ ★★★★★ —
Full re搜索: 技能s/cohere-translator/RE搜索.md