← 返回 Skills 市场
qingzhe2020

ifly-translate

作者 Iflytek AIcloud · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ⚠ suspicious
247
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install ifly-translate
功能描述
iFlytek Machine Translation (机器翻译) — translate text between Chinese, English, Japanese, Korean, French, Spanish, German, Russian, Arabic, Thai, Vietnamese, a...
使用说明 (SKILL.md)

ifly-translate

Translate text using iFlytek's Machine Translation API (机器翻译). Supports 70+ language pairs.

Setup

  1. Create an app at 讯飞控制台 with 机器翻译 service enabled
  2. Set environment variables:
    export XFYUN_APP_ID="your_app_id"
    export XFYUN_API_KEY="your_api_key"
    export XFYUN_API_SECRET="your_api_secret"
    

Usage

Basic translation (Chinese → English by default)

python3 scripts/translate.py "你好世界"

Specify source and target language

python3 scripts/translate.py -s en -t cn "Hello world"

Read from stdin

echo "こんにちは" | python3 scripts/translate.py - -s ja -t cn

Read from file

python3 scripts/translate.py -f document.txt -s cn -t en

Options

Flag Short Description
text Text to translate (use - for stdin)
--file -f Read text from a file
--from -s Source language code (default: cn)
--to -t Target language code (default: en)
--verbose -v Show source/target language labels
--raw Output raw JSON response

Common language codes

Code Language Code Language
cn 中文 en English
ja 日语 ko 韩语
fr 法语 de 德语
es 西班牙语 ru 俄语
ar 阿拉伯语 th 泰语
vi 越南语 pt 葡萄牙语
it 意大利语 tr 土耳其语

Aliases are supported: zhcn, chinesecn, englishen, japaneseja, etc.

Full language list: \x3Chttps://www.xfyun.cn/doc/nlp/xftrans/API.html>

Examples

# Chinese to English
python3 scripts/translate.py "人工智能改变世界"

# English to Chinese
python3 scripts/translate.py -s en -t cn "Artificial intelligence changes the world"

# Japanese to Chinese
python3 scripts/translate.py -s ja -t cn "おはようございます"

# Verbose output with language labels
python3 scripts/translate.py -v "你好"

# Raw JSON for debugging
python3 scripts/translate.py --raw "测试翻译"

Output

  • Default: translated text only (stdout)
  • --verbose: shows source and target with language labels
  • --raw: full API JSON response

Notes

  • Auth: HMAC-SHA256 with Digest header (SHA-256 of body) — different from some other xfyun APIs
  • Endpoint: POST https://itrans.xfyun.cn/v2/its
  • Env vars: XFYUN_APP_ID, XFYUN_API_KEY, XFYUN_API_SECRET
  • Text is base64-encoded in the request body
  • No pip deps: Uses only Python stdlib (urllib, hmac, hashlib, json, etc.)

常见问题 FAQ (´,,•ω•,,)♡

机器翻译的主要功能是什么?

答:支持文本到文本的机器翻译 ✨

机器翻译支持哪些语种?

答:目前支持包括英、日、法、西、俄等70多种语言,详细的语种可见 语种列表~

机器翻译支持什么应用平台?

答:目前仅支持webapi接口哦 (,,•́ . •̀,,)

机器翻译支持的文本长度是多少?

答:单次文本长度不得超过4096字节~

是否支持源语种的自动识别?

答:目前不支持,后续会开放,新消息请关注平台动态 (◕‿◕)

机器翻译如何购买?

答:机器翻译产品页对应产品价格 → 点击申请购买,填好相关信息,商务工作人员会及时与您联系~


❌ 常见错误及解决方案 (´,,•ω•,,)♡

错误:认证失败 / Invalid credential

表现:返回 401 Unauthorizedauthentication error

可能原因

  • API Key 或 API Secret 填写错误啦 (´;ω;`)
  • 环境变量没有正确设置

解决方法

  1. 确认你正确设置了环境变量:
    export XFYUN_APP_ID="你的APP_ID"
    export XFYUN_API_KEY="你的API_KEY"
    export XFYUN_API_SECRET="你的API_SECRET"
    
  2. 检查是否有空格或多余的引号哦 ✧(≖ ◡ ≖)
  3. 讯飞控制台 确认你的密钥是否正确复制~

错误:服务未开通 / Service not enabled

表现:返回 403 Forbidden 或提示服务未开通

可能原因

  • 机器翻译服务还没有开通呢 (;´Д`A)

解决方法

  1. 登录 讯飞控制台
  2. 点击「创建新应用」或选择已有应用
  3. 在「产品服务」中找到「机器翻译」并开通
  4. 开通后可能需要几分钟生效,稍等一下下~ (,,•́ . •̀,,)

错误:额度不足 / Quota exceeded

表现:返回 402 Payment Required 或提示额度不足

可能原因

  • 免费额度用完啦,或者套餐包到期了 (╥_╥)

解决方法

  1. 登录 讯飞控制台 查看剩余额度
  2. 如果需要更多资源,可以:
    • 购买机器翻译套餐包 👉 价格页面
    • 联系商务工作人员申请更大额度~

错误:文本过长 / Text too long

表现:返回错误提示文本过长

可能原因

  • 单次翻译的文本超过4096字节啦 (⊙_⊙)

解决方法

  1. 将长文本拆分成多个小段落进行翻译
  2. 每个段落单独调用翻译接口
  3. 最后将结果拼接起来~ ✨

错误:网络连接失败 / Connection error

表现:连接超时或网络错误

可能原因

  • 网络不稳定 or 防火墙拦截了 (;・∀・)

解决方法

  1. 检查网络连接是否正常
  2. 如果是企业网络,尝试关闭防火墙或代理
  3. 确认 itrans.xfyun.cn 是否可访问
  4. 可以ping一下试试看:ping itrans.xfyun.cn

错误:语种不支持 / Language not supported

表现:返回语种错误或无法识别

可能原因

  • 使用的语言代码不在支持列表中 ( ̄▽ ̄)

解决方法

  1. 请参考上方「Common language codes」表格
  2. 语言代码要使用标准的双字母代码哦,比如 cnenja
  3. 支持的语言列表详见:讯飞机器翻译API文档

❓ 其他常见问题

Q: 为什么翻译结果返回为空?

A: 检查一下输入的文本是否为空,或者是否包含特殊字符导致编码问题哦~ (。・`ω´・)

Q: 翻译速度很慢怎么办?

A: 可以检查一下网络状况,或者将长文本拆分处理~

Q: 如何查看我的使用量?

A: 登录 讯飞控制台 即可查看详细的使用统计和账单信息!


💡 小提示

  • 使用 --raw 参数可以看到完整的API响应,方便调试哦~
  • 遇到不确定的错误时,可以把错误信息复制到搜索引擎搜索一下,或者查看 官方文档 寻求帮助 (◕‿◕)
  • 购买套餐包请访问:讯飞控制台价格页面
安全使用建议
This package appears to be a legitimate iFlytek translation client, but do the following before installing or running it: (1) Confirm the source/trustworthiness — the skill metadata omits the three required XFYUN credentials even though the script needs them; (2) Only provide XFYUN credentials you control and consider using a limited/test key; (3) Inspect or remove the .claude/settings.local.json file (it contains a Bash zip permission pointing to a local user path and is unrelated to translation); (4) Run the script in an isolated environment or container if you are unsure; (5) Verify network access and that requests go only to itrans.xfyun.cn; and (6) If you intend to publish or share this skill, update the registry metadata to declare the required environment variables so automated reviewers and users can see them.
功能分析
Type: OpenClaw Skill Name: ifly-translate Version: 1.0.0 The skill bundle is a legitimate implementation of the iFlytek Machine Translation API. The Python script `scripts/translate.py` uses only standard libraries to handle authentication (HMAC-SHA256) and network requests to the official endpoint (`itrans.xfyun.cn`). While it accesses environment variables for API credentials and can read local files for translation, these behaviors are consistent with its stated purpose. A local configuration file `.claude/settings.local.json` was included unintentionally by the developer but contains no malicious instructions.
能力评估
Purpose & Capability
The name, SKILL.md, and scripts/translate.py all describe and implement an iFlytek (讯飞) Machine Translation client that posts to itrans.xfyun.cn; the code, usage examples, and required env vars in SKILL.md are coherent with that purpose. However, the registry metadata claims no required environment variables or primary credential, which is inconsistent with the runtime instructions and the script's explicit dependency on three XFYUN credentials.
Instruction Scope
SKILL.md instructs the agent (and user) to set XFYUN_APP_ID, XFYUN_API_KEY, XFYUN_API_SECRET and run a bundled Python script; the script only reads stdin or an input file, the declared env vars, and makes HTTPS requests to itrans.xfyun.cn. The instructions do not direct reading unrelated system files or sending data to unexpected external endpoints.
Install Mechanism
There is no install spec (instruction-only + one bundled script). No third-party packages are downloaded or executed; the Python code uses only stdlib. This is the lower-risk install model.
Credentials
The runtime requires three secrets (XFYUN_APP_ID, XFYUN_API_KEY, XFYUN_API_SECRET) which are appropriate for the iFlytek API, but the skill registry metadata does not declare any required env vars or a primary credential — a metadata omission that hides sensitive requirements from automated reviewers/users. Additionally, the repository includes a .claude/settings.local.json entry granting a Bash zip command (targeting a specific user path), which is unrelated to translation and could indicate leftover packaging/permission settings or accidental inclusion of local config.
Persistence & Privilege
The skill does not request persistent presence (always:false), does not modify other skills or global agent settings, and contains no install script altering system configuration. It runs as an on-demand CLI script that performs network calls to the API endpoint.
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install ifly-translate
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /ifly-translate 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
- Initial release of ifly-translate. - Translate text between 70+ languages using iFlytek Machine Translation API. - Python CLI supports file, stdin, or direct text input, with customizable source/target language. - Pure Python standard library; no pip dependencies required. - Provides verbose and raw output options for flexible usage and debugging.
元数据
Slug ifly-translate
版本 1.0.0
许可证 MIT-0
累计安装 0
当前安装数 0
历史版本数 1
常见问题

ifly-translate 是什么?

iFlytek Machine Translation (机器翻译) — translate text between Chinese, English, Japanese, Korean, French, Spanish, German, Russian, Arabic, Thai, Vietnamese, a... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 247 次。

如何安装 ifly-translate?

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

ifly-translate 是免费的吗?

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

ifly-translate 支持哪些平台?

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

谁开发了 ifly-translate?

由 Iflytek AIcloud(@qingzhe2020)开发并维护,当前版本 v1.0.0。

💬 留言讨论