← 返回 Skills 市场
chrisbdz

Kimi Search

作者 ChrisBDZ · GitHub ↗ · v1.0.1
cross-platform ✓ 安全检测通过
838
总下载
0
收藏
9
当前安装
2
版本数
在 OpenClaw 中安装
/install kimi-search
功能描述
使用 Moonshot Kimi API 的 $web_search 内置工具进行联网搜索。当需要进行网络搜索获取实时信息时使用,支持中文和英文搜索查询。需要配置 MOONSHOT_API_KEY。
使用说明 (SKILL.md)

Kimi Search

使用 Kimi 大模型的内置联网搜索工具 $web_search 进行联网搜索。

前置要求

  1. Moonshot API Key:需要在 https://platform.moonshot.cn/console 注册并获取 API Key
  2. 账户充值:联网搜索每次额外收费约 ¥0.03,确保账户有余额
  3. Python 环境:Python 3.8+ 和 openai Python 包

安装依赖

skill 需要 openai Python 包。安装方式:

pip3 install openai

或者使用虚拟环境(推荐):

python3 -m venv ~/.openclaw/skills/kimi-search/venv
source ~/.openclaw/skills/kimi-search/venv/bin/activate
pip install openai

配置 API Key

工作原理

本 skill 声明了 primaryEnv: MOONSHOT_API_KEY。OpenClaw 会自动将你配置的 apiKey 值注入到 MOONSHOT_API_KEY 环境变量中供脚本读取。

配置方式(推荐)

编辑 ~/.openclaw/openclaw.json,添加:

{
  "skills": {
    "entries": {
      "kimi-search": {
        "enabled": true,
        "apiKey": "sk-你的APIKey"
      }
    }
  }
}

安全提示~/.openclaw/openclaw.json 是用户主目录下的配置文件,权限通常设置为仅用户可读。如需更高安全性,建议使用环境变量方式。

使配置生效

openclaw gateway restart

替代方案:环境变量

如果你不想将 Key 存储在配置文件中,可以直接设置环境变量:

export MOONSHOT_API_KEY="sk-你的APIKey"
~/.openclaw/skills/kimi-search/scripts/kimi-search "搜索词"

环境变量方式不会在磁盘上留下 Key 记录,适合共享机器或高安全要求场景。

使用方法

作为 Agent 工具使用

配置完成后,可以直接问 Agent:

"用 kimi-search 搜一下今天的新闻"

直接调用脚本

~/.openclaw/skills/kimi-search/scripts/kimi-search "搜索关键词"

示例

kimi-search "今天有什么新闻"
kimi-search "OpenClaw 是什么"
kimi-search "Python 最新版本特性"

输出格式

脚本返回 JSON 格式:

{
  "query": "搜索关键词",
  "answer": "搜索结果的回答",
  "usage": {
    "prompt_tokens": 8059,
    "completion_tokens": 1197,
    "total_tokens": 9256
  }
}
  • query:原始搜索词
  • answer:Kimi 根据搜索结果生成的回答
  • usage:Token 消耗统计(搜索内容会计入 prompt_tokens)

故障排除

错误:"缺少 MOONSHOT_API_KEY"

原因:API Key 未正确配置或未注入环境变量
解决

  1. 检查 ~/.openclaw/openclaw.jsonskills.entries.kimi-search.apiKey 是否填写
  2. 重启 Gateway:openclaw gateway restart
  3. 或使用环境变量方式运行

错误:"Invalid Authentication" 或 401

原因:API Key 无效或已过期
解决

  1. 在 Moonshot 控制台检查 Key 状态
  2. 重新生成 Key 并更新配置

错误:"insufficient_quota" 或余额不足

原因:账户余额不足
解决:在 https://platform.moonshot.cn/console 充值

错误:"ModuleNotFoundError: No module named 'openai'"

原因:缺少 Python 依赖
解决:运行 pip3 install openai

技术说明

  • 模型kimi-k2.5(256k 上下文窗口)
  • 工具$web_search 内置函数(builtin_function 类型)
  • 工作原理
    1. 脚本声明 $web_search 工具给 Kimi API
    2. Kimi 决定需要搜索时,返回 tool_call 请求
    3. 脚本将 tool_call 参数原样返回(这是 $web_search 的正确用法,Kimi 会在服务端执行实际搜索)
    4. Kimi 返回包含搜索结果的最终回答
  • 参数temperature=0.6,禁用 thinking 模式以支持 tool calls
  • 费用
    • 模型调用:按 token 计费(输入 ¥4/1M,输出 ¥21/1M)
    • 搜索功能:每次搜索额外 ¥0.03
  • 性能:搜索结果通常占用 5k-10k tokens,建议用于需要实时信息的场景

安全建议

  1. API Key 保护:不要将 Key 提交到 Git 仓库或分享给他人
  2. 配置文件权限:确保 ~/.openclaw/openclaw.json 权限为 600(仅所有者可读写)
  3. 临时环境变量:在脚本中使用 export 设置的变量只在当前 shell 会话有效
  4. 定期轮换:定期在 Moonshot 控制台重新生成 API Key

参考

安全使用建议
This skill appears to do exactly what it says: use your Moonshot (Kimi) API key to perform web searches. Before installing: 1) Only provide a valid MOONSHOT_API_KEY and avoid committing it to Git or other public places; prefer setting the env var for ephemeral use if you worry about disk-stored keys. 2) Installing/using the skill requires the 'openai' Python package—install from PyPI and verify you trust that package source. 3) The skill will make network calls to the Moonshot API and can incur charges; ensure your account/billing is acceptable. 4) If you want to be extra cautious, inspect the included script (scripts/kimi-search.py) yourself (it is short and readable) and rotate the API key if you later remove the skill. Overall, the bundle is coherent and proportionate, but treat the API key like any other secret.
功能分析
Type: OpenClaw Skill Name: kimi-search Version: 1.0.1 The kimi-search skill bundle is a legitimate implementation for performing web searches via the Moonshot Kimi API. The Python script (scripts/kimi-search.py) uses the standard openai library to interact with the official Moonshot endpoint (api.moonshot.cn) and correctly handles the $web_search built-in tool. No suspicious behaviors such as data exfiltration, unauthorized file access, or malicious prompt instructions were identified.
能力评估
Purpose & Capability
Name/description, declared primaryEnv (MOONSHOT_API_KEY), SKILL.md prose, and the included Python script all align: they call Moonshot's API (via the OpenAI-compatible client) to run Kimi's $web_search tool. No unrelated services, credentials, or binaries are requested.
Instruction Scope
SKILL.md and the script stay within the stated scope: they only explain how to provide the MOONSHOT_API_KEY, install the 'openai' package, invoke the script, and let Kimi request $web_search tool calls. The README does reference storing the key in ~/.openclaw/openclaw.json (with a security warning) and restarting the gateway; both are consistent with how OpenClaw skills are configured.
Install Mechanism
This is an instruction-only skill with an included Python script; there is no install spec, no remote download, and no archive extraction. The only dependency is the public 'openai' Python package installed via pip, which is proportionate.
Credentials
Only one environment variable (MOONSHOT_API_KEY) is required and is the expected credential for the described Moonshot API usage. No other secrets or unrelated env vars are requested.
Persistence & Privilege
The skill does not request 'always: true' or other elevated persistence. It runs as a normal, user-invocable skill and does not attempt to modify other skills or system-wide settings beyond recommending restarting the gateway after config changes (expected behavior).
如何使用
  1. 确保已安装 OpenClaw(本地或 Docker 部署)
  2. 在对话框中输入安装命令:/install kimi-search
  3. 安装完成后,直接呼叫该 Skill 的名称或使用 /kimi-search 触发
  4. 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.1
Improved documentation: clarified primaryEnv injection mechanism, added security recommendations, added dependency installation instructions, explained builtin_function behavior
v1.0.0
Initial release: Kimi web search via builtin function
元数据
Slug kimi-search
版本 1.0.1
许可证
累计安装 11
当前安装数 9
历史版本数 2
常见问题

Kimi Search 是什么?

使用 Moonshot Kimi API 的 $web_search 内置工具进行联网搜索。当需要进行网络搜索获取实时信息时使用,支持中文和英文搜索查询。需要配置 MOONSHOT_API_KEY。 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 838 次。

如何安装 Kimi Search?

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

Kimi Search 是免费的吗?

是的,Kimi Search 完全免费(开源免费),可自由下载、安装和使用。

Kimi Search 支持哪些平台?

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

谁开发了 Kimi Search?

由 ChrisBDZ(@chrisbdz)开发并维护,当前版本 v1.0.1。

💬 留言讨论