智谱网络搜索:实时 AI 互联网搜索 - Openclaw Skills

作者:互联网

2026-04-16

AI教程

什么是 智谱网络搜索?

智谱网络搜索是一款为 AI 智能体打造的强大工具,旨在弥合静态知识与实时互联网之间的差距。通过利用智谱 bigmodel.cn API(特别是具备网络搜索能力的 GLM-4-flash 模型),此技能允许智能体检索时事、进行事实核查并从全网收集数据。对于需要最新准确性的 Openclaw Skills 开发者来说,这是一个至关重要的组件。

该技能在设计时注重效率和安全性,确保搜索通过加密通道进行,同时为开发者提供对 API 交互的粒度控制。它促进了从全球网络直接到您的 AI 驱动工作流的信息无缝流动。

下载入口:https://github.com/openclaw/skills/tree/main/skills/honestqiao/minimax-tts-v2

安装与下载

1. ClawHub CLI

从源直接安装技能的最快方式。

npx clawhub@latest install minimax-tts-v2

2. 手动安装

将技能文件夹复制到以下位置之一

全局模式 ~/.openclaw/skills/ 工作区 /skills/

优先级:工作区 > 本地 > 内置

3. 提示词安装

将此提示词复制到 OpenClaw 即可自动安装。

请帮我使用 Clawhub 安装 minimax-tts-v2。如果尚未安装 Clawhub,请先安装(npm i -g clawhub)。

智谱网络搜索 应用场景

  • 获取最新新闻和热门话题用于内容创作
  • 对特定技术或通用主题进行深入研究
  • 验证 AI 模型训练截止日期之后发生的实时信息
  • 根据用户查询(如“搜索”或“查询”)触发自动网络搜索
智谱网络搜索 工作原理
  1. AI 智能体根据用户提示或特定触发器识别对外部信息的需求。
  2. 该技能使用 curl 向智谱 API 端点构建安全的 POST 请求。
  3. GLM-4-flash 模型使用其集成的网络搜索工具处理搜索查询。
  4. 搜索结果以 JSON 格式返回,并使用 jq 解析以确保数据安全处理。
  5. 相关信息经过综合处理后,通过 Openclaw Skills 环境反馈给用户。

智谱网络搜索 配置指南

要集成此搜索能力,您必须首先从智谱 BigModel 平台获取 API 密钥。请按照以下步骤操作:

  1. 访问 BigModel API 管理页面生成您的密钥。
  2. 在终端中将密钥设置为环境变量:
export MINIMAX_API_KEY="your_api_key"
  1. 确保您已安装 jq 以便在 Openclaw Skills 设置中进行 JSON 处理和数据安全:
sudo apt install jq # 在 Debian/Ubuntu 系统上

智谱网络搜索 数据架构与分类体系

组件 详情
API 端点 https://open.bigmodel.cn/api/paas/v4/chat/completions
主要模型 glm-4-flash
身份验证 Bearer Token (通过 MINIMAX_API_KEY)
载荷类型 带有 tool_choice: web_search 的 JSON
输出处理 通过 jq 过滤的选择消息内容
name: minimax-tts
description: Use Zhipu (智谱) web search API for searching the internet. Use when user asks for web search, latest news, or needs current information.
allowed-tools: Bash(curl:*) Bash(jq:*)
env:
  - MINIMAX_API_KEY

Use Zhipu's web search API to search the internet.

?? Security Requirements

This skill requires MINIMAX_API_KEY environment variable to be set before use.

Security Best Practices:

  1. DO NOT store API keys in ~/.bashrc - keys can be leaked
  2. DO NOT source shell configuration files - prevents arbitrary code execution
  3. Set environment variable directly when running the script
  4. Be aware API key will be visible in process list (ps aux)

Setup

# Set API key as environment variable
export MINIMAX_API_KEY="your_api_key"

Get your API key from: https://www.bigmodel.cn/usercenter/proj-mgmt/apikeys

Usage

export MINIMAX_API_KEY="your_key"

curl -s -X POST "https://open.bigmodel.cn/api/paas/v4/chat/completions" r
  -H "Authorization: Bearer $MINIMAX_API_KEY" r
  -H "Content-Type: application/json" r
  -d '{
    "model": "glm-4-flash",
    "messages": [{"role": "user", "content": "搜索: YOUR_QUERY"}],
    "tools": [{"type": "web_search", "web_search": {"search_query": "YOUR_QUERY"}}]
  }' | jq -r '.choices[0].message.content'

Using the Script

export MINIMAX_API_KEY="your_key"
./search.sh "搜索内容"

Security Analysis

? What's Safe:

  • No sourcing of ~/.bashrc or shell config files
  • Uses jq for JSON escaping (prevents injection)
  • Uses HTTPS with TLS 1.2+
  • API key via environment variable (not hardcoded)
  • Proper error handling - sensitive info not leaked
  • Input validation (query length limit)
  • Generic error messages (no path/file hints)

?? Considerations:

  • Process list visibility: API key visible in ps aux
    • Use in trusted environments only
  • Endpoint: https://open.bigmodel.cn (official Zhipu API)

Safety Features

Feature Implementation
JSON escaping jq --arg prevents injection
Input validation Query length ≤500 chars
TLS Force TLS 1.2+
Error handling Generic messages, no leaks
Timeout 30 second curl timeout

When to Use

  • User says "search for", "look up", "find information about"
  • User asks "what's the latest news about"
  • User needs current information from the web

API Endpoint

Official: https://open.bigmodel.cn/api/paas/v4/chat/completions

相关推荐