← 返回 Skills 市场
baidu-translate

Baidu File Translate

作者 baidu-translate · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ 安全检测通过
49
总下载
1
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install baidu-file-translate
功能描述
Use this skill for file translation with trans-cli (Baidu LLM File Translation API). Covers the submit → poll → download async workflow, requestId lifecycle,...
使用说明 (SKILL.md)

baidu-file-translate — Agent Reference

File translation is async. Always use the submit → poll loop below. Never rely on --wait without a timeout — it may block indefinitely in an Agent framework.

Step 1: trans file submit \x3Cfile> --from auto --to en --json
        → exit ≠ 0 → handle by error code (see Error Handling)
        → exit 0   → record request_id from stdout

Step 2: every 5 s: trans file query \x3Crequest_id> --json
        → exit ≠ 0              → handle error; DOC_FAILED = don't retry
        → exit 0, status=processing → keep polling
        → exit 0, status=done       → use file_url, or re-run with --download

Set an Agent-level timeout (e.g. 10 min). On WAIT_TIMEOUT, save the request_id — the job is still running and can be resumed later.


trans file submit \x3Cfile>

trans file submit report.pdf --from zh --to en --json
trans file submit report.pdf --to en --reference "Use academic tone"
Flag Default Description
--from auto Source language (auto-detect)
--to zh Target language — auto is not accepted
--reference Custom translation instruction, ≤ 1000 Unicode code points
--trans-image false Also translate text inside images
--wait false Block until done (always pair with --wait-timeout)
--wait-timeout 0 (no limit) Max wait time for --wait mode

trans file query \x3CrequestId>

trans file query REQ123 --json
trans file query REQ123 --download --output ./output/
Flag Default Description
--download false Download the translated file when done
--output ./ Download directory (used with --download)
--wait false Block until done
--wait-timeout 0 (no limit) Max wait time for --wait mode

JSON Contract

submit success (stdout):

{"request_id": "REQ123", "status": "submitted"}

query — in progress (stdout):

{"request_id": "REQ123", "status": "processing", "name": "report.pdf", "from": "zh", "to": "en"}

query — done (stdout):

{"request_id": "REQ123", "status": "done", "file_url": "https://...", "char_count": 1000, "amount": 70}

With --download, the done response gains:

{"local_path": "/absolute/path/to/report_en.pdf"}

error (stderr, exit ≠ 0):

{"code": "AUTH_FAILED", "message": "...", "help_url": "https://fanyi-api.baidu.com/manage/apiKey"}

help_url is omitted when not applicable.


Error Handling

exit ≠ 0
├── CONFIG_MISSING (exit 2) → guide user to set TRANS_API_KEY
├── AUTH_FAILED    (exit 2) → key invalid/expired; check fanyi-api.baidu.com/manage/apiKey
├── QUOTA_EXCEEDED (exit 3) → balance exhausted; recharge, then retry
├── RATE_LIMITED   (exit 3) → back off 30 s, then retry
├── NETWORK_ERROR  (exit 4) → check connectivity, retry
├── DOC_FAILED     (exit 3) → server-side failure; do NOT retry
├── INVALID_INPUT  (exit 1) → fix file path / format / --to value
└── WAIT_TIMEOUT   (exit 1) → job still running; save request_id and resume later

stderr carries errors only — there are no progress events on stderr.


Supported Formats

docx / doc / pdf / xlsx / xls / pptx / ppt / html / htm / txt / xml / md

file_url expires after 30 days.

安全使用建议
This skill appears purpose-aligned and safe to use for its stated task. Before installing or using it, verify the trans-cli package source, protect your TRANS_API_KEY, and only submit documents that your privacy or workplace rules allow you to send to Baidu.
能力标签
requires-sensitive-credentials
能力评估
Purpose & Capability
The documented purpose and behavior align: submit a file to Baidu translation, poll for completion, and download the result. Users should notice that document contents are processed by an external provider.
Instruction Scope
The workflow is narrowly scoped to trans-cli file submit/query/download commands and includes bounded polling guidance such as an agent-level timeout.
Install Mechanism
The registry says there is no install spec, while SKILL.md metadata references installing an external npm package for the trans binary. The package code and version are not included in the artifacts.
Credentials
TRANS_API_KEY is proportionate for Baidu API use, but it is a sensitive account credential and should be handled carefully.
Persistence & Privilege
The skill only describes saving request_id values for resuming jobs and notes that file_url expires after 30 days; there is no evidence of background persistence or self-propagation.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install baidu-file-translate
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /baidu-file-translate 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
baidu-file-translate 1.0.0 - Initial release for async Baidu file translation via trans-cli. - Implements submit → poll → download workflow for document translation. - Supports error handling for common scenarios (e.g., DOC_FAILED, AUTH_FAILED, WAIT_TIMEOUT). - Lists all accepted file formats: docx, pdf, xlsx, pptx, html, txt, xml, md. - Provides Agent-safe polling and guidance for managing requestId and job state. - Documentation covers command usage, options, JSON output, and troubleshooting.
元数据
Slug baidu-file-translate
版本 1.0.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

Baidu File Translate 是什么?

Use this skill for file translation with trans-cli (Baidu LLM File Translation API). Covers the submit → poll → download async workflow, requestId lifecycle,... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 49 次。

如何安装 Baidu File Translate?

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

Baidu File Translate 是免费的吗?

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

Baidu File Translate 支持哪些平台?

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

谁开发了 Baidu File Translate?

由 baidu-translate(@baidu-translate)开发并维护,当前版本 v1.0.0。

💬 留言讨论