Back to Registry
name: baidu-text-translate
description: Use this skill whenever you need to translate text with the trans-cli tool (Baidu Translation AI API). Covers JSON output contract, Baidu-specific language codes (jp/kor/fra/spa/ara — not ISO defaults), exit code semantics, error decision tree, first-time API key setup, QUOTA_EXCEEDED / AUTH_FAILED recovery, environment self-diagnosis via
View Author Profile
Official Verified
Baidu Text Translate
Skill by baidu-translate
skill-install — Terminal
Install via CLI (Recommended)
clawhub install openclaw/skills/skills/baidu-translate/baidu-text-translateOr
name: baidu-text-translate
description: Use this skill whenever you need to translate text with the trans-cli tool (Baidu Translation AI API). Covers JSON output contract, Baidu-specific language codes (jp/kor/fra/spa/ara — not ISO defaults), exit code semantics, error decision tree, first-time API key setup, QUOTA_EXCEEDED / AUTH_FAILED recovery, environment self-diagnosis via trans doctor, and listing supported languages via trans languages. Trigger on any of: running trans text, shell pipelines with translation, trans-cli errors, API key configuration, trans doctor checks, or looking up language codes.
homepage: https://fanyi.baidu.com
metadata: {"clawdbot":{"emoji":"🌐","requires":{"bins":["trans"]},"install":[{"id":"npm","kind":"npm","package":"@bdtrans/trans-cli","bins":["trans"],"label":"Install trans-cli (npm)"}]}}
baidu_text_translate — Agent Reference
trans text wraps the Baidu AI Translation API. Use --json — it separates
success (stdout) from errors (stderr) and gives you structured fields to act on.
trans text --json "你好世界" # auto-detect → English
trans text --json --from zh --to jp "你好" # explicit languages
trans text --json --to fra --reference "使用正式语气" "你好" # custom instruction
echo "早上好" | trans text --json # stdin pipe
Environment Diagnosis
Before translating, verify the environment with trans doctor:
trans doctor # human-readable output
trans doctor --json # JSON output for Agent parsing
JSON contract (stdout):
{
"checks": [
{"name":"api_key", "ok":true, "source":"env/config", "message":"configured"},
{"name":"connectivity","ok":true, "latency_ms":243, "message":"reachable"},
{"name":"account", "ok":true, "message":"valid"}
],
"all_ok": true
}
| Exit | all_ok | Meaning |
|---|---|---|
| 0 | true | All checks passed — ready to translate |
| 2 | false | At least one check failed — inspect checks[].ok |
When a check fails, help_url in the failing check points to the fix:
api_key.ok:false→ setTRANS_API_KEY(see Configuration below)account.ok:false→ key invalid/expired or quota exhausted
Run trans doctor --json as the first step when diagnosing any trans-cli failure.
JSON Contract
Success (stdout, exit 0):
{"from":"zh","to":"en","source":"你好","translated":"Hello"}
| Field | Note |
|---|---|
from | API-detected language — may differ from --from auto |
to | Target language |
source | Original input |
translated | Result |
Error (stderr, exit ≠ 0):
{"code":"AUTH_FAILED","message":"…","help_url":"https://…","raw_code":"52001"}
help_url and raw_code are omitted when not applicable.
Error Decision Tree
Metadata
AI Skill Finder
Not sure this is the right skill?
Describe what you want to build — we'll match you to the best skill from 16,000+ options.
Find the right skill Add to Configuration
Paste this into your clawhub.json to enable this plugin.
{
"plugins": {
"official-baidu-translate-baidu-text-translate": {
"enabled": true,
"auto_update": true
}
}
}Safety NoteClawKit audits metadata but not runtime behavior. Use with caution.