← 返回 Skills 市场
Baidu Content Censor
作者
HeKe-UESTC
· GitHub ↗
· v1.0.0
· MIT-0
151
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install baidu-content-censor
功能描述
提供文本和图像内容安全检测,自动识别类型并返回详细审核结果,支持本地图片路径和图片 URL 输入。
使用说明 (SKILL.md)
百度内容审核 (baidu-content-censor)
概述
本 Skill 提供文本审核和图像审核两个 API 接口,用于内容安全检测。
触发方式
当用户请求以下操作时,自动调用此 Skill:
- 文本审核 / 内容审核 / 文字审核
- 图片审核 / 图像审核 / 图片检测
- 内容安全检测
- 敏感词检测 / 违规内容检测
- 审核这段文字 / 审核这张图片
- "帮我审核..." / "请审核..." / "检测一下..."
执行指令
当触发此 Skill 时:
- 识别用户是要审核文本还是图片
- 如果是文本审核:调用
api_client.text_censor(text="...") - 如果是图片审核:
- 如果用户提供的是本地图片路径,调用
api_client.image_censor(image="/path/to/image.jpg") - 如果用户提供的是图片 URL,调用
api_client.image_censor(img_url="https://...")
- 如果用户提供的是本地图片路径,调用
- 解析返回的 JSON 结果,以友好的方式展示给用户
- access_token 会自动从 AK/SK 获取并缓存,无需手动处理
接口地址
- 文本审核:
https://aip.baidubce.com/rest/2.0/solution/v1/text_censor/v2/user_defined - 图像审核:
https://aip.baidubce.com/rest/2.0/solution/v1/img_censor/v2/user_defined
环境变量
| 变量名 | 必填 | 说明 |
|---|---|---|
| BCE_SINAN_AK | 是 | 百度云 API Key |
| BCE_SINAN_SK | 是 | 百度云 Secret Key |
设置方式:
export BCE_SINAN_AK="你的AK"
export BCE_SINAN_SK="你的SK"
Token 缓存机制
- Access Token 会自动从百度云 API 获取
- 缓存文件位置:
~/.claude/skills/baidu-content-censor/token_cache.json - 缓存过期时间:提前 5 分钟自动刷新
- 如果 API 返回 110(access_token 无效)或 111(access_token 过期),会自动刷新并重试
API 使用方法
1. 文本审核
from baidu-content-censor import text_censor
# 审核文本
result = text_censor(text="待审核的文本内容")
# 也可以指定 appid
result = text_censor(text="待审核的文本内容", appid=123456)
2. 图像审核
from baidu-content-censor import image_censor
# 方式一:通过图片 URL 审核
result = image_censor(img_url="https://example.com/image.jpg")
# 方式二:通过本地图片路径审核(自动转为 Base64)
result = image_censor(image="/path/to/image.jpg")
# 也可以指定 appid
result = image_censor(img_url="https://example.com/image.jpg", appid=123456)
3. 通用接口(自动识别类型)
from baidu-content-censor import censor
# 自动识别为文本
result = censor("待审核的文本内容")
# 自动识别为图片(URL)
result = censor("https://example.com/image.jpg")
# 自动识别为图片(本地路径)
result = censor("/path/to/image.jpg")
# 手动指定类型
result = censor("待审核的文本内容", content_type="text")
result = censor("/path/to/image.jpg", content_type="image")
4. 强制刷新 Token
from baidu-content-censor import refresh_access_token
# 强制刷新 access_token(清除缓存并重新获取)
new_token = refresh_access_token()
返回结果
接口返回完整的 JSON 审核结果,包含以下常见字段:
| 字段 | 类型 | 说明 |
|---|---|---|
| logId | long | 请求唯一标识 |
| conclusion | string | 审核结论(如:合规、不合规、疑似) |
| conclusionType | int | 结论类型(1:合规, 2:不合规, 3:疑似, 4:审核失败) |
| data | array | 详细审核数据 |
注意事项
image和img_url只能传其中一个,不能同时传递- 文本审核内容不能超过 2 万字节
- 所有请求都会自动添加
isFromSkill=true参数用于埋点 - 本地图片路径会自动转换为 Base64,无需手动处理
- Access Token 缓存机制确保性能最优,不会频繁请求百度云获取 token
安全使用建议
This skill appears to do what it says: it calls Baidu's OAuth endpoint and the Baidu content-censor APIs and requires your Baidu AK/SK. Before installing: 1) only provide AK/SK you intend to use with Baidu; don't use broader or unrelated credentials; 2) be aware that any local file path you pass will be read and uploaded (Base64) to Baidu — avoid passing sensitive local files; 3) ensure your runtime has Python and the 'requests' library (the skill's metadata does not declare dependencies); 4) note the skill writes a token cache to ~/.claude/skills/... — if you prefer no on-disk caching, inspect/modify the code; 5) the package source/homepage is unknown — if you need stronger assurance, review the included code yourself or run it in a sandbox before granting credentials or using on sensitive data.
功能分析
Type: OpenClaw Skill
Name: baidu-content-censor
Version: 1.0.0
The skill is a legitimate implementation of Baidu's content censorship API for text and image moderation. It correctly handles OAuth2 authentication, implements a local token caching mechanism in `api_client.py`, and provides clear instructions in `SKILL.md` for the AI agent. No evidence of data exfiltration, malicious execution, or intentional prompt injection was found; the code's behavior is entirely consistent with its stated purpose of auditing content via Baidu's official endpoints.
能力评估
Purpose & Capability
Name/description (Baidu content censor) match the actual behavior: the code calls Baidu OAuth and the Baidu text/image censor endpoints and requires Baidu AK/SK environment variables. No unrelated services or credentials are requested.
Instruction Scope
SKILL.md and the code instruct the agent to read environment variables for AK/SK, obtain an access token, and POST text or image data to Baidu endpoints. The skill will read local files when given a local image path and convert them to Base64 for upload — this is expected for image auditing but is a privacy consideration (local files are uploaded to Baidu). The code also adds an isFromSkill=true param to all requests for tracking. Instructions are otherwise narrowly scoped to the censorship task.
Install Mechanism
No install specification is provided (instruction-only install), but code files are included. The Python client imports the third-party 'requests' package yet the registry metadata does not declare dependencies; the runtime environment must have Python and requests available. No external download URLs or archive extraction are used.
Credentials
Only BCE_SINAN_AK and BCE_SINAN_SK are required, which is appropriate for obtaining Baidu access tokens. No other secrets, unrelated credentials, or broad system config paths are requested.
Persistence & Privilege
The skill caches the access token to a file under ~/.claude/skills/baidu-content-censor/token_cache.json and will create that directory if missing — this is reasonable for token caching but means the skill will write into the user's home directory. always is false and the skill does not modify other skills or global agent settings.
如何使用
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install baidu-content-censor - 安装完成后,直接呼叫该 Skill 的名称或使用
/baidu-content-censor触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
baidu-content-censor 1.0.0
- Initial release with API support for both text and image content moderation using Baidu Cloud.
- Supports automatic trigger on various user audit requests (text/image/content/security).
- Provides Python API for text_censor, image_censor, universal censor, and manual access_token refresh.
- Implements automatic access_token management and caching for optimal performance.
- Returns detailed JSON audit results, including compliance conclusions and data.
- Requires setting Baidu API Key and Secret Key via environment variables.
元数据
常见问题
Baidu Content Censor 是什么?
提供文本和图像内容安全检测,自动识别类型并返回详细审核结果,支持本地图片路径和图片 URL 输入。 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 151 次。
如何安装 Baidu Content Censor?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install baidu-content-censor」即可一键安装,无需额外配置。
Baidu Content Censor 是免费的吗?
是的,Baidu Content Censor 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。
Baidu Content Censor 支持哪些平台?
Baidu Content Censor 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 Baidu Content Censor?
由 HeKe-UESTC(@heke-uestc)开发并维护,当前版本 v1.0.0。
推荐 Skills