← 返回 Skills 市场
lykeion-dev

Cohere Translator

作者 大村愛弥 · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ 安全检测通过
81
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install cohere-translator
功能描述
Neural machine translation supporting 23 languages using Cohere's Command A Translate model, optimized for file-based input to minimize token costs.
使用说明 (SKILL.md)

Cohere Translator Skill

State-of-the-art neural machine translation using Cohere's Command A Translate model (cohere/command-a-translate-08-2025, 111B parameters, 23 languages).

🔑 Requires a Cohere API key. The model is free for trial keys as of 2026-05-17 (1,000 calls/month, 20 req/min). Get a key at: https://dashboard.cohere.com/api-keys

⚠️ CRITICAL: Always Use File Mode to Save Tokens

When translating file content, use --file/-f mode. This bypasses the agent entirely — the script reads the file directly and translates it. Your agent never loads the file content into its context window.

# ❌ WASTES TOKENS: Agent reads file → passes text as CLI argument
python3 translate.py "$(cat document.txt)" --to ja

# ✅ ZERO AGENT TOKENS: Script reads file directly, agent only issues the command
python3 translate.py -f document.txt --to ja -o output.txt

This is not optional advice — it is the correct way to use this skill. Every byte of text you pass through the agent as a CLI argument doubles your token cost for no benefit. File mode eliminates this entirely.

This applies equally when using the skill from an agent (OpenClaw, Claude Code, etc.) or directly from the command line.

Quick Start

# 1. Set your Cohere API key (get one at https://dashboard.cohere.com/api-keys)
export COHERE_API_KEY="your-key-here"

# 2. Translate a file (RECOMMENDED — zero agent tokens)
python3 skills/cohere-translator/scripts/translate.py -f input.txt --to ja -o output.txt

# 3. Quick one-liner (text on command line — small texts only)
python3 skills/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 output.txt

# Large files auto-chunked (6,000+ chars automatically split)
python3 translate.py -f large_document.txt --to ja -o output.txt
# Output: 📄 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       Input file (or '-' for stdin). PREFERRED MODE.
-o, --output PATH     Output file (default: stdout)
-t, --to CODE         Target language (default: en)
--temperature FLOAT   Temperature 0.1-1.0 (default: 0.3)
--max-tokens INT      Max output tokens per chunk (default: 4000)
--system-prompt STR   System message for constraints
--api-key KEY         Cohere API key (or set COHERE_API_KEY env var)
--json                Output full JSON with token counts
-q, --quiet           Suppress progress messages
--list-languages      List supported language codes

System Prompt Examples

# Operational constraints work well
python3 translate.py -f doc.txt --to ja \
  --system-prompt "Output ONLY the translation. Keep numbers and URLs unchanged."

Note: System prompts work for operational constraints but have limited effect on translation tone/style. The model's DPO training makes translation behavior largely hardwired.

API Key

This skill requires a Cohere API key. Get a free trial key at: https://dashboard.cohere.com/api-keys

Trial keys provide: 1,000 calls/month, 20 req/min, completely free.

export COHERE_API_KEY="your-key-here"

How the Agent Should Use This Skill

[TASK] Translate /workspace/document.txt to Japanese.

# Correct:
python3 skills/cohere-translator/scripts/translate.py -f /workspace/document.txt --to ja -o /workspace/document_ja.txt

# The agent never reads document.txt. ZERO context tokens wasted on file content.
# After completion, the agent may read document_ja.txt to verify the result.

Known Limitations

  • Japanese slang (2ch-style, ギャル語) may cause API errors
  • System messages cannot change formality reliably
  • 8K input token limit — auto-chunked for files (see translate_file())
  • Idioms translate literally rather than finding cultural equivalents
  • Business keigo→European loses some formality density

Quality Matrix

Direction Casual Business Technical Idioms
JA↔KO ★★★★★ ★★★★★ ★★★★★ ★★★
JA↔ZH ★★★★★ ★★★★ ★★★★★ ★★★
EN→any ★★★★★ ★★★★★ ★★★★★ ★★★★
Any→EN ★★★★★ ★★★★★ ★★★★★ ★★★★
ZH↔KO ★★★★★ ★★★★★
FR↔DE ★★★★★ ★★★★★ ★★★★★

Full research: skills/cohere-translator/RESEARCH.md

安全使用建议
Install only if you are comfortable sending the files you translate to Cohere and using your Cohere API key/quota. Prefer environment-variable key setup, avoid translating highly sensitive documents unless permitted, and make sure curl is installed.
功能分析
Type: OpenClaw Skill Name: cohere-translator Version: 1.0.0 The cohere-translator skill bundle is a legitimate tool for neural machine translation using the Cohere API. The core logic in `scripts/translate.py` uses Python's standard library and `curl` to interact with the official Cohere endpoint (api.cohere.ai), implementing robust features like script-density-aware chunking and rate-limit pacing. The instructions in `SKILL.md` and `README.md` are focused on token optimization and efficiency, specifically advising the AI agent to use file-mode to minimize context window usage. No indicators of data exfiltration, unauthorized execution, or malicious prompt injection were found.
能力标签
cryptocan-make-purchasesrequires-sensitive-credentials
能力评估
Purpose & Capability
The stated purpose, documentation, and visible code all align around translating user-provided text/files through Cohere. The notable user impact is that translated content is sent to an external provider.
Instruction Scope
The skill strongly recommends file mode so the agent does not load the source document into context. That is purpose-aligned for token savings, but it means the script reads the selected file directly and sends its contents for translation.
Install Mechanism
There is no install spec, and the registry lists no required binaries, but the visible script invokes curl. This is disclosed in README as using stdlib plus curl, so it is an install metadata gap rather than hidden behavior.
Credentials
Network access to Cohere and a Cohere API key are proportionate to the translation purpose. Users should consider provider privacy terms and API quota or billing effects.
Persistence & Privilege
No persistence, background worker, privilege escalation, or local credential storage is evident in the provided artifacts. The skill does handle a Cohere API key for authorized API calls.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install cohere-translator
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /cohere-translator 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
Initial release: SOTA neural machine translation using Cohere's Command A Translate (111B, 23 languages). Free tier available (1,000 calls/month). Features: zero-agent-token file mode, script-density-aware auto-chunking, 6000-token round-trip budget, rate-limit pacing. Zero Python dependencies (stdlib + curl only).
元数据
Slug cohere-translator
版本 1.0.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

Cohere Translator 是什么?

Neural machine translation supporting 23 languages using Cohere's Command A Translate model, optimized for file-based input to minimize token costs. 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 81 次。

如何安装 Cohere Translator?

在 OpenClaw 或 Claude Code 对话框中运行命令「/install cohere-translator」即可一键安装,无需额外配置。

Cohere Translator 是免费的吗?

是的,Cohere Translator 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。

Cohere Translator 支持哪些平台?

Cohere Translator 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。

谁开发了 Cohere Translator?

由 大村愛弥(@lykeion-dev)开发并维护,当前版本 v1.0.0。

💬 留言讨论