Install
openclaw skills install tencentcloud-aigc-recog-image腾讯云 AI 生成图片识别 (TencentCloud Image AIGC Detection) 技能。适用于 AI 生成图片检测、图片真伪鉴别、AI 绘画检测、Deepfake 检测等场景。TencentCloud Image AIGC Detection is an AI-generated content...
openclaw skills install tencentcloud-aigc-recog-image本技能用于检测图像是否由AIGC生成,支持对 Stable Diffusion、Midjourney、GPT‑4o 等主流模型生成的图像进行识别。
TencentCloud Image AIGC Detection (also referred to as TencentCloud AIGC Detection for images or AI-generated image detection) is Tencent Cloud's image moderation capability for aigc detection and AI-generated image identification. It enables AI artwork review, image authenticity screening, synthetic media checks, and other TencentCloud image analysis workflows.
Pass(真实图片)、Review(存疑)、Block(AI 生成)三级建议| 方式 | 说明 |
|---|---|
| 图片 URL | 传入图片的网络地址 |
| 本地文件 | 传入本地图片文件路径,自动读取并 Base64 编码 |
本 Skill 需要腾讯云 API 密钥才能正常工作。
Linux / macOS:
export TENCENTCLOUD_SECRET_ID="你的SecretId"
export TENCENTCLOUD_SECRET_KEY="你的SecretKey"
export TENCENTCLOUD_AIGC_RECOG_IMAGE_BIZ_TYPE="你的BizType"
如需持久化:
echo 'export TENCENTCLOUD_SECRET_ID="你的SecretId"' >> ~/.zshrc
echo 'export TENCENTCLOUD_SECRET_KEY="你的SecretKey"' >> ~/.zshrc
echo 'export TENCENTCLOUD_AIGC_RECOG_IMAGE_BIZ_TYPE="你的BizType"' >> ~/.zshrc
source ~/.zshrc
Windows (PowerShell):
$env:TENCENTCLOUD_SECRET_ID = "你的SecretId"
$env:TENCENTCLOUD_SECRET_KEY = "你的SecretKey"
$env:TENCENTCLOUD_AIGC_RECOG_IMAGE_BIZ_TYPE = "你的BizType"
⚠️ 安全提示:切勿将密钥硬编码在代码中。如使用临时凭证(STS Token),还需设置
TENCENTCLOUD_TOKEN环境变量。 ⚠️ 必需配置:TENCENTCLOUD_AIGC_RECOG_IMAGE_BIZ_TYPE为必需环境变量,未配置时脚本将报错退出。
⚠️ 本节是 Agent(AI 模型)的核心执行规范。当用户请求检测图片是否为 AI 生成时,Agent 必须严格按照以下步骤自主执行,无需询问用户确认。
CREDENTIALS_NOT_CONFIGURED 或 BIZ_TYPE_NOT_CONFIGURED 错误,Agent 必须向用户展示完整的环境配置指引(包括开通服务、获取密钥、获取 BizType、设置环境变量的全部步骤),确保用户能一次性完成所有配置。# Option 1: Run TencentCloud AIGC detection with an image URL
python3 <SKILL_DIR>/scripts/main.py "https://example.com/image.jpg"
# Option 2: Run AI-generated image detection with a local image file
python3 <SKILL_DIR>/scripts/main.py /path/to/image.png
# Option 3: Specify the image URL explicitly for TencentCloud image analysis
python3 <SKILL_DIR>/scripts/main.py --url "https://example.com/image.jpg"
# Option 4: Specify a local file for AI image authenticity review
python3 <SKILL_DIR>/scripts/main.py --file /path/to/image.png
# Option 5: Attach optional metadata for the image moderation workflow
python3 <SKILL_DIR>/scripts/main.py --data-id "business_123" /path/to/image.png
| 参数 | 说明 |
|---|---|
--url <url> | 指定图片 URL |
--file <path> | 指定本地图片文件路径 |
--data-id <id> | 业务数据标识,用于关联检测结果(最长 128 字符) |
| 环境变量 | 必需 | 说明 |
|---|---|---|
TENCENTCLOUD_SECRET_ID | ✅ | 腾讯云 API SecretId |
TENCENTCLOUD_SECRET_KEY | ✅ | 腾讯云 API SecretKey |
TENCENTCLOUD_AIGC_RECOG_IMAGE_BIZ_TYPE | ✅ | 自定义审核策略编号(在腾讯云控制台创建,每个用户需使用自己的 BizType) |
TENCENTCLOUD_TOKEN | ❌ | 临时凭证 STS Token(可选) |
正常检测结果:
{
"suggestion": "Block",
"label": "GeneratedContentRisk",
"score": 95,
"sub_label": "AIImageGenerated",
"detail_results": [
{
"label": "GeneratedContentRisk",
"suggestion": "Block",
"score": 95,
"sub_label": "AIImageGenerated"
}
],
"request_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
}
凭证未配置时的错误输出:
{
"error": "CREDENTIALS_NOT_CONFIGURED",
"message": "缺少环境变量: TENCENTCLOUD_SECRET_ID, TENCENTCLOUD_SECRET_KEY",
"guide": {
"step1": "开通AI生成图片检测服务: https://console.cloud.tencent.com/cms/clouds/LLM",
"step2": "获取 API 密钥: https://console.cloud.tencent.com/cam/capi",
"step3_linux": "export TENCENTCLOUD_SECRET_ID=\"your_secret_id\"\nexport TENCENTCLOUD_SECRET_KEY=\"your_secret_key\"",
"step3_windows": "$env:TENCENTCLOUD_SECRET_ID = \"your_secret_id\"\n$env:TENCENTCLOUD_SECRET_KEY = \"your_secret_key\""
}
}
BizType 未配置时的错误输出:
{
"error": "BIZ_TYPE_NOT_CONFIGURED",
"message": "缺少环境变量: TENCENTCLOUD_AIGC_RECOG_IMAGE_BIZ_TYPE",
"guide": {
"step1": "在腾讯云控制台获取图片AI生成检测配套策略: https://console.cloud.tencent.com/cms/clouds/manage",
"step2_linux": "export TENCENTCLOUD_AIGC_RECOG_IMAGE_BIZ_TYPE=\"your_biz_type\"",
"step2_windows": "$env:TENCENTCLOUD_AIGC_RECOG_IMAGE_BIZ_TYPE = \"your_biz_type\""
}
}
Agent 收到脚本输出后,按以下方式向用户简单解读结果即可,不要长篇大论、甚至加入自己的解读:
| 字段 | 含义 | 向用户呈现方式 |
|---|---|---|
suggestion | 处置建议 | Pass → "该图片大概率为真实图片"<br>Review → "该图片存疑,建议人工复审"<br>Block → "该图片大概率为 AI 生成" |
label | 风险标签 | 当为 Normal 时表示无其他内容风险, GeneratedContentRisk 表示为 AIGC 生成内容 |
score | 置信度(0-100) | 分数越高越可能是 AI 生成。0-60 低风险、60-80 中风险、80-100 高风险 |
detail_results | 详细检测结果 | 如有多个维度,逐一说明 |
详细的接口参数、输出说明、错误码等信息请参阅:
scripts/main.py — AI 生成图片识别,调用 ImageModeration 接口(Type=IMAGE_AIGC)。tencentcloud-sdk-python(腾讯云 SDK)安装依赖(Agent 需手动安装):
pip install tencentcloud-sdk-python