ClawKit Logo
ClawKitReliability Toolkit
Back to Registry
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-translate
Or

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
}
Exitall_okMeaning
0trueAll checks passed — ready to translate
2falseAt 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 → set TRANS_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"}
FieldNote
fromAPI-detected language — may differ from --from auto
toTarget language
sourceOriginal input
translatedResult

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

Stars4473
Views0
Updated2026-05-01
View Author Profile
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.