Token导航 LogoToken导航TokenDH.com
研究检索敏感数据clawhub未标认证来源可访问clear审计提醒

baidu-text-translate百度文字翻译

Agent Skill

baidu-text-translate 用于记录任务执行中的错误、用户纠正、经验和能力缺口,适合在 OpenClaw 中希望让 Agent 持续沉淀问题、修正和最佳实践时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

总安装

5,532

周安装

241

GitHub Stars

3

下载量

1,889
OpenClaw

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

GitHub

来源数

2

许可证

MIT-0

最后核验

2026-05-01

来源状态

来源可访问

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:baidu-text-translate(百度文字翻译)
来源仓库:https://github.com/baidu-translate/baidu-text-translate
安装命令:
openclaw skills install baidu-text-translate
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 OpenClaw 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

ClawHubOpenClaw
openclaw skills install baidu-text-translate

简介

通过带有百度特定语言代码、API 密钥管理、错误处理和环境诊断的 trans-cli,使用百度人工智能翻译 API 翻译文本。

SKILL.md

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"],"env":["TRANS_API_KEY"]},"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

ExitcodeCauseAction
0OKUse translated
1INVALID_INPUTEmpty textFix input, don't retry
1INVALID_LANGUAGEWrong lang code (e.g. ja → should be jp)Fix --to/--from, see Language Codes below
2CONFIG_MISSINGTRANS_API_KEY not setStop — run trans doctor --json then guide user to set up API key
2AUTH_FAILEDKey invalid/expired (raw_code 52001–52003)Stop — run trans doctor --json then guide user to API key page
3QUOTA_EXCEEDEDBalance = 0Stop — guide user to recharge (see below)
3RATE_LIMITEDQPS exceededWait 1 s, retry once
3API_ERRORUnexpected API errorRetry once; if persists, report raw_code + message
4NETWORK_ERRORNo connectivityRetry twice with 2 s gap; if persists, report

Exit 2 requires human intervention — the agent cannot fix auth or config. Exit 1 means the agent passed bad arguments — fix the call, not the environment.


Language Codes

Baidu does not follow ISO 639. When unsure of a code, query locally:

trans languages                    # full list (200+ languages)
trans languages --filter jp        # search by code
trans languages --filter 日语      # search by name
trans languages --json             # JSON output for Agent parsing

The six most common ISO traps:

Baidu (correct)ISO (wrong for Baidu)Language
jpjaJapanese
korkoKorean
frafrFrench
spaesSpanish
araarArabic
vieviVietnamese

Other common codes that match ISO: zh cht en ru de pt it nl hi th Use auto for source-language auto-detection.


Configuration

Priority: --api-key flag > TRANS_API_KEY env > ~/.trans-cli/config.json

Config file field: api_key.

trans config init               # create empty config skeleton (~/.trans-cli/config.json)
trans config init --force       # overwrite existing config
trans config set api_key <KEY>  # write api_key (creates file if absent)

Getting an API Key (First-Time Setup)

Guide the user through these steps — the agent cannot do this on their behalf:

  1. Open the Baidu Translation Open Platform and sign in: <https://fanyi-api.baidu.com/>
  2. Go to Developer Center: <https://fanyi-api.baidu.com/manage/developer>
  3. Click "Use Now" → select "General Translation" → complete identity verification
  4. Get your API Key: <https://fanyi-api.baidu.com/manage/apiKey>
  5. Write to config: trans config set api_key <KEY>

or set the environment variable TRANS_API_KEY

  1. Verify: trans doctor --jsonall_ok:true means success

Recharging (QUOTA_EXCEEDED)

Recharge portal: <https://fanyi-api.baidu.com/manage/account> Takes effect immediately — no restart needed. Auto-renewal can be enabled on the same page. Usage details: <https://fanyi-api.baidu.com/api/trans/user/usage>


Non-Obvious Behaviours

  • Multiple positional args join with a space: trans text hello world"hello world"
  • When both stdin and positional args are given, positional args win silently
  • The from field in JSON is the API's detected language, not the --from flag value
  • trans doctor checks are short-circuit: if api_key fails, connectivity/account are skipped
  • --reference is optional; omitting it sends no extra field to the API

适合场景

01

OpenClaw 用户查找和安装 Skill 时

02

用户想查找某类 Agent Skill 时

03

需要根据任务场景推荐可安装能力包时

04

需要对比不同来源的安装命令和来源信息时

能力概览

能力 1

按任务关键词查找相关 Skills

能力 2

展示可复制的安装命令

能力 3

保留来源站点、仓库和原始说明,方便继续核验

能力 4

补充不同宿主或平台的使用分布数据

能力 5

展示第三方安全扫描或审计结果

安装后应在对应宿主中按原始 README 的触发条件使用;具体调用方式请以来源页面和 README 为准。

平台分布

OpenClaw

78.48%
按下载量换算1,482

安全审计

VirusTotal

未展示

ClawScan

可疑

Static analysis

通过

权限和风险

敏感数据

该 Skill 可能接触密钥、Token、环境变量或敏感配置,应进入高风险复核队列,默认不自动发布。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在 warning/failed 结果,不能写成本站确认安全。当前只有一个来源,正式发布前建议补源仓库或其他目录站核验。

来源信息

继续浏览同类 Skills