Install any skill in seconds. Free to start, no credit card required.
Get Started Free →通过萤石设备抓图 + 智能体分析接口,实现对摄像头画面的多模态 AI 理解。
.claude/skills/ezviz-multimodal-analysis/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-02 | ✗→✓ | ▲ Improved | 1195% | 0% |
| case-03 | ✗→✓ | ▲ Improved | 551% | 0% |
| case-04 | ✗→✓ | ▲ Improved | 234% | 0% |
| case-05 | ✗→✓ | ▲ Improved | 232% | 0% |
| case-06 | ✗→✓ | ▲ Improved | 382% | 0% |
通过萤石设备抓图 + 智能体分析接口,实现对摄像头画面的多模态 AI 理解。
在使用此技能前,请完成以下安全检查:
| # | 检查项 | 状态 | 说明 | |---|--------|------|------| | 1 | 凭证权限 | ⚠️ 必需 | 使用最小权限的 AppKey/AppSecret,不要用主账号凭证 | | 2 | 配置文件读取 | ⚠️ 注意 | 技能会读取 ~/.openclaw/*.json 文件(但环境变量优先级更高) | | 3 | Token 缓存 | ⚠️ 注意 | Token 缓存在 /tmp/ezviz_global_token_cache/ (权限 600) | | 4 | API 域名 | ✅ 已验证 | openai.ys7.com 和 aidialoggw.ys7.com 是萤石官方 API 端点 | | 5 | 代码审查 | ✅ 推荐 | 审查 scripts/multimodal_analysis.py 和 lib/token_manager.py |
凭证获取优先级(从高到低):
┌─────────────────────────────────────────────────────────────┐
│ 1. 环境变量 (最高优先级 - 推荐) │
│ ├─ EZVIZ_APP_KEY │
│ ├─ EZVIZ_APP_SECRET │
│ ├─ EZVIZ_DEVICE_SERIAL │
│ └─ EZVIZ_AGENT_ID │
│ ✅ 优点:不读取配置文件,完全隔离 │
├─────────────────────────────────────────────────────────────┤
│ 2. OpenClaw 配置文件 (仅当环境变量未设置时使用) │
│ ├─ ~/.openclaw/config.json │
│ ├─ ~/.openclaw/gateway/config.json │
│ └─ ~/.openclaw/channels.json │
│ ⚠️ 注意:只读取 channels.ezviz 字段,不读取其他服务凭证 │
├─────────────────────────────────────────────────────────────┤
│ 3. 命令行参数 (最低优先级) │
│ python3 multimodal_analysis.py appKey appSecret ... │
└─────────────────────────────────────────────────────────────┘安全建议:
bash# 1. 使用环境变量(优先级最高,避免配置文件意外使用) export EZVIZ_APP_KEY="your_dedicated_app_key" export EZVIZ_APP_SECRET="your_dedicated_app_secret" export EZVIZ_DEVICE_SERIAL="dev1,dev2,dev3" export EZVIZ_AGENT_ID="your_agent_id" # 2. 高安全环境:禁用 Token 缓存 export EZVIZ_TOKEN_CACHE=0 # 3. 测试凭证(推荐先用测试账号) # 登录 https://openai.ys7.com/ 创建专用应用,仅开通抓图和 AI 分析相关权限 # 获取 Agent ID: https://openai.ys7.com/console/aiAgent/aiAgent.html
技能按以下顺序获取凭证(优先级从高到低):
EZVIZ_APP_KEY, EZVIZ_APP_SECRET, EZVIZ_DEVICE_SERIAL, EZVIZ_AGENT_ID) ← 推荐~/.openclaw/config.json 等)bashpip install requests
bashexport EZVIZ_APP_KEY="your_app_key" export EZVIZ_APP_SECRET="your_app_secret" export EZVIZ_DEVICE_SERIAL="dev1,dev2,dev3" export EZVIZ_AGENT_ID="your_agent_id"
可选环境变量:
bashexport EZVIZ_CHANNEL_NO="1" # 通道号,默认 1 export EZVIZ_ANALYSIS_TEXT="请分析这张图片" # 分析提示词 export EZVIZ_TOKEN_CACHE="1" # Token 缓存:1=启用 (默认), 0=禁用
Token 缓存说明:
EZVIZ_TOKEN_CACHE=0 每次重新获取 Token/tmp/ezviz_global_token_cache/global_token_cache.json注意:
EZVIZ_ACCESS_TOKEN!技能会自动获取 Tokenbashpython3 {baseDir}/scripts/multimodal_analysis.py
命令行参数:
bash# 单个设备 python3 {baseDir}/scripts/multimodal_analysis.py appKey appSecret dev1 1 agentId # 多个设备(逗号分隔) python3 {baseDir}/scripts/multimodal_analysis.py appKey appSecret "dev1,dev2,dev3" 1 agentId # 自定义分析提示词 python3 {baseDir}/scripts/multimodal_analysis.py appKey appSecret dev1 1 agentId "请识别画面中的人员"
技能支持从 OpenClaw 的 channels 配置中自动读取萤石凭证,无需单独设置环境变量。
在 ~/.openclaw/config.json 或 ~/.openclaw/channels.json 中添加:
json{ "channels": { "ezviz": { "appId": "your_app_id", "appSecret": "your_app_secret", "domain": "https://openai.ys7.com", "enabled": true } } }
技能会按以下顺序查找配置文件:
~/.openclaw/config.json~/.openclaw/gateway/config.json~/.openclaw/channels.json凭证获取优先级:
EZVIZ_APP_KEYEZVIZ_APP_SECRETEZVIZ_DEVICE_SERIALEZVIZ_AGENT_IDchannels.ezviz.appIdchannels.ezviz.appSecret1. 获取 Token (appKey + appSecret → accessToken)
↓
2. 设备抓图 (accessToken + deviceSerial → picUrl)
↓
3. AI 分析 (agentId + picUrl → 分析结果)
↓
4. 输出结果 (JSON + 控制台)你不需要手动获取或配置 EZVIZ_ACCESS_TOKEN!
技能会自动处理 Token 的获取:
首次运行:
appKey + appSecret → 调用萤石 API → 获取 accessToken (有效期 7 天)
↓
保存到缓存文件(系统临时目录)
↓
后续运行:
检查缓存 Token 是否过期
├─ 未过期 → 直接使用缓存 Token ✅
└─ 已过期 → 重新获取新 TokenToken 管理特性:
EZVIZ_ACCESS_TOKEN 环境变量EZVIZ_TOKEN_CACHE=0 可禁用缓存(每次运行重新获取)======================================================================
Ezviz Multimodal Analysis Skill (萤石多模态分析)
======================================================================
[Time] 2026-03-18 20:50:00
[INFO] Target devices: 2
- dev1 (Channel: 1)
- dev2 (Channel: 1)
[INFO] Agent ID: 98af3e...
[INFO] Analysis: 请分析这张图片的内容
======================================================================
SECURITY VALIDATION
======================================================================
[OK] Device serial format validated
[OK] Using credentials from environment variables
======================================================================
[Step 1] Getting access token...
======================================================================
[INFO] Using cached global token, expires: 2026-03-25 19:21:16
[SUCCESS] Using cached token, expires: 2026-03-25 19:21:16
======================================================================
[Step 2] Capturing and analyzing images...
======================================================================
[Device] dev1 (Channel: 1)
[SUCCESS] Image captured: https://opencapture.ys7.com/...
[SUCCESS] Analysis completed!
[Analysis Result]
{
"场景": "办公室",
"人员数量": 3,
"主要物体": ["办公桌", "电脑", "椅子"]
}
[Device] dev2 (Channel: 1)
[SUCCESS] Image captured: https://opencapture.ys7.com/...
[SUCCESS] Analysis completed!
[Analysis Result]
{
"场景": "会议室",
"人员数量": 5,
"主要物体": ["会议桌", "投影仪", "椅子"]
}
======================================================================
ANALYSIS SUMMARY
======================================================================
Total devices: 2
Success: 2
Failed: 0
======================================================================| 格式 | 示例 | 说明 | |------|------|------| | 单设备 | dev1 | 默认通道 1 | | 多设备 | dev1,dev2,dev3 | 全部使用默认通道 | | 指定通道 | dev1:1,dev2:2 | 每个设备独立通道 | | 混合 | dev1,dev2:2,dev3 | 部分指定通道 |
| 接口 | URL | 文档 | |------|-----|------| | 获取 Token | POST /api/lapp/token/get | https://openai.ys7.com/help/81 | | 设备抓图 | POST /api/lapp/device/capture | https://openai.ys7.com/help/687 | | 智能体分析 | POST /api/service/open/intelligent/agent/engine/agent/anaylsis | https://openai.ys7.com/help/5006 |
| 域名 | 用途 | |------|------| | openai.ys7.com | 萤石开放平台 API(Token、抓图) | | aidialoggw.ys7.com | 萤石 AI 智能体分析接口 |
返回字段:
analysis - AI 分析结果(依赖智能体配置)pic_url - 抓拍图片 URL(有效期 2 小时)错误码:
200 - 操作成功400 - 参数错误500 - 服务异常10002 - accessToken 过期10028 - 抓图次数超限20007 - 设备不在线dev1,dev2,dev3dev1:1,dev2:2| 场景 | 提示词 | |------|--------| | 通用分析 | "请分析这张图片的内容" | | 人员识别 | "请识别画面中的人员数量和位置" | | 行为分析 | "请分析画面中人员的行为活动" | | 安全检测 | "请检测画面中是否存在安全隐患" | | 物体识别 | "请识别画面中的主要物体" |
⚠️ 频率限制: 萤石抓图接口建议间隔 4 秒以上。技能已自动在设备间等待 4 秒,避免触发限流(错误码 10028)
⚠️ 隐私合规: 使用摄像头监控可能涉及隐私问题,确保符合当地法律法规
⚠️ 设备要求: 设备必须在线且支持抓图功能(support_capture=1)
⚠️ Token 安全: Token 会缓存到系统临时目录(自动管理),不写入日志,不发送到非萤石端点
⚠️ 分析超时: AI 分析可能耗时较长,默认超时 60 秒
本技能会向第三方服务发送数据:
| 数据类型 | 发送到 | 用途 | 是否必需 | |----------|--------|------|----------| | appKey/appSecret | openai.ys7.com (萤石) | 获取访问 Token | ✅ 必需 | | 设备序列号 | openai.ys7.com (萤石) | 请求抓图 | ✅ 必需 | | 抓拍图片 URL | openai.ys7.com (萤石) | AI 智能体分析 | ✅ 必需 | | 智能体 ID | aidialoggw.ys7.com (萤石) | AI 分析请求 | ✅ 必需 | | EZVIZ_ACCESS_TOKEN | 自动生成 | 每次运行自动获取 | ✅ 自动 |
数据流出说明:
openai.ys7.com): Token 请求、设备抓图 - 萤石官方 APIaidialoggw.ys7.com): 图片分析 - 萤石官方 API凭证权限建议:
本地处理:
/tmp/ezviz_global_token_cache/),权限 600EZVIZ_TOKEN_CACHE=0 环境变量| 场景 | 说明 | |------|------| | 🏢 办公场景 | 识别人员数量、工作状态、办公环境 | | 🏭 工厂监控 | 检测安全规范、设备状态、人员行为 | | 🏪 零售分析 | 客流统计、货架状态、顾客行为 | | 🏠 智能家居 | 场景识别、异常检测、家庭成员活动 |
场景 1: 单设备快速分析
bashpython3 multimodal_analysis.py your_key your_secret BF6985110 1 your_agent_id
场景 2: 多设备批量分析
bashexport EZVIZ_DEVICE_SERIAL="dev1,dev2,dev3" export EZVIZ_AGENT_ID="your_agent_id" python3 multimodal_analysis.py
场景 3: 自定义分析提示词
bashexport EZVIZ_ANALYSIS_TEXT="请检测画面中是否存在安全隐患" python3 multimodal_analysis.py your_key your_secret dev1 1 your_agent_id
文档 URL: https://openai.ys7.com/help/81
接口说明:
请求地址:
POST https://openai.ys7.com/api/lapp/token/get请求参数: | 参数名 | 类型 | 描述 | 是否必选 | |--------|------|------|----------| | appKey | String | appKey | Y | | appSecret | String | appSecret | Y |
返回数据:
json{ "data": { "accessToken": "at.xxxxxxxxxxxxx", "expireTime": 1470810222045 }, "code": "200", "msg": "操作成功!" }
文档 URL: https://openai.ys7.com/help/687
接口功能: 抓拍设备当前画面,该接口仅适用于 IPC 或者关联 IPC 的 DVR 设备。
该接口需要设备支持能力集:support_capture=1
> ⚠️ 注意:设备抓图能力有限,请勿频繁调用,建议每个摄像头调用的间隔4s 以上。
请求地址:
POST https://openai.ys7.com/api/lapp/device/capture请求参数: | 参数名 | 类型 | 描述 | 是否必选 | |--------|------|------|----------| | accessToken | String | 授权过程获取的 access_token | Y | | deviceSerial | String | 设备序列号,字母需为大写 | Y | | channelNo | int | 通道号,IPC 设备填写 1 | Y |
返回数据:
json{ "data": { "picUrl": "https://opencapture.ys7.com/.../capture/xxx.jpg?Expires=xxx&..." }, "code": "200", "msg": "操作成功!" }
返回字段: | 字段名 | 类型 | 描述 | |--------|------|------| | picUrl | String | 抓拍后的图片路径,图片保存有效期为 2 小时 |
文档 URL: https://openai.ys7.com/help/5006
接口功能: 调用萤石 AI 智能体对图片进行多模态理解分析。
请求地址:
POST https://aidialoggw.ys7.com/api/service/open/intelligent/agent/engine/agent/anaylsis请求参数: | 参数名 | 类型 | 描述 | 是否必选 | |--------|------|------|----------| | accessToken | String | 授权过程获取的 access_token | Y | | appId | String | 智能体 ID | Y | | mediaType | String | 媒体类型:image | Y | | text | String | 分析提示词 | Y | | dataType | String | 数据类型:url | Y | | data | String | 图片 URL | Y |
返回数据:
json{ "meta": { "code": 200, "message": "success" }, "data": "{\"场景\":\"办公室\",\"人员数量\":3}" }
返回字段: | 字段名 | 类型 | 描述 | |--------|------|------| | meta.code | Number | 响应码 | | meta.message | String | 响应消息 | | data | String | 分析结果(JSON 字符串) |
默认行为:
/tmp/ezviz_global_token_cache/global_token_cache.json)为什么缓存 Token:
如果您不希望 Token 被持久化,可以通过以下方式禁用缓存:
方法 1: 环境变量
bashexport EZVIZ_TOKEN_CACHE=0 python3 scripts/multimodal_analysis.py ...
方法 2: 修改代码
pythonfrom token_manager import get_cached_token # 禁用缓存 token_result = get_cached_token(app_key, app_secret, use_cache=False)
| 系统 | 路径 | |------|------| | macOS | /var/folders/xx/xxxx/T/ezviz_global_token_cache/ | | Linux | /tmp/ezviz_global_token_cache/ | | Windows | C:\Users\{user}\AppData\Local\Temp\ezviz_global_token_cache\ |
查看缓存:
bash# macOS/Linux ls -la /tmp/ezviz_global_token_cache/ cat /tmp/ezviz_global_token_cache/global_token_cache.json # 清除缓存 rm -rf /tmp/ezviz_global_token_cache/
bash# 1. 验证缓存文件权限 ls -la /tmp/ezviz_global_token_cache/global_token_cache.json # 应该显示:-rw------- (600) # 2. 验证缓存内容 cat /tmp/ezviz_global_token_cache/global_token_cache.json | python3 -m json.tool # 3. 验证禁用缓存 export EZVIZ_TOKEN_CACHE=0 python3 scripts/multimodal_analysis.py ... # 应该显示 "Getting access token from Ezviz API" 而不是 "Using cached global token" # 4. 清除缓存 python3 lib/token_manager.py clear
bash# 推荐:使用 .env 文件(不要提交到版本控制) echo "EZVIZ_APP_KEY=your_key" >> .env echo "EZVIZ_APP_SECRET=your_secret" >> .env chmod 600 .env # 加载环境变量 source .env
如果您在共享计算机或高安全环境中使用:
bashexport EZVIZ_TOKEN_CACHE=0 # 禁用缓存 python3 scripts/multimodal_analysis.py ...
bash# 清除所有缓存的 Token rm -rf /tmp/ezviz_global_token_cache/
技能会读取以下路径中的萤石配置(仅当环境变量未设置时):
~/.openclaw/config.json
~/.openclaw/gateway/config.json
~/.openclaw/channels.json配置格式:
json{ "channels": { "ezviz": { "appId": "your_app_id", "appSecret": "your_app_secret", "domain": "https://openai.ys7.com", "enabled": true } } }
安全建议:
禁用配置文件扫描(环境变量优先):
bashexport EZVIZ_APP_KEY="your_key" export EZVIZ_APP_SECRET="your_secret" # 环境变量优先级高于配置文件
Linux Crontab (每 5 分钟):
bash*/5 * * * * cd /path/to/multimodal-analysis && python3 scripts/multimodal_analysis.py >> /var/log/analysis.log 2>&1
macOS Launchd:
xml<key>StartInterval</key> <integer>300</integer>
根据安全审计建议,请在安装前完成以下检查:
scripts/multimodal_analysis.py 和 lib/token_manager.pyopenai.ys7.com 和 aidialoggw.ys7.com 是萤石官方端点~/.openclaw/*.json 中是否有敏感凭证/tmp/ezviz_global_token_cache/ 可接受EZVIZ_APP_KEY 等环境变量EZVIZ_TOKEN_CACHE=0requests 等依赖的安全更新更新日志:
| 日期 | 版本 | 变更 | 说明 | |------|------|------|------| | 2026-03-18 | 1.0.1 | 初始版本 | 与 ezviz-open-picture 文档结构对齐 | | 2026-03-18 | 1.0.1 | 添加 channels.json 支持 | 从 OpenClaw 配置文件读取凭证,优先级低于环境变量 | | 2026-03-18 | 1.0.1 | 添加安全验证 | 设备序列号格式验证、凭证来源警告 | | 2026-03-18 | 1.0.1 | 添加 Token 缓存说明 | 明确缓存行为,支持 EZVIZ_TOKEN_CACHE=0 禁用 | | 2026-03-18 | 1.0.1 | 添加安全审计清单 | 根据安全建议添加完整检查清单 |
最后更新: 2026-03-18 版本: 1.0.1 (Channels 配置支持版)
| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | fail→fail | 8,517 | 15,898 | +87% | 1 | 1 | 0% | 1,241 | 8,975 | +623% | 0 | 0 | — |
case-02 | fail→pass | 8,223 | 11,076 | +35% | 1 | 1 | 0% | 700 | 9,065 | +1195% | 0 | 0 | — |
case-03 | fail→pass | 7,281 | 14,535 | +100% | 1 | 1 | 0% | 1,496 | 9,746 | +551% | 0 | 0 | — |
case-04 | fail→pass | 12,363 | 6,119 | -51% | 1 | 1 | 0% | 2,374 | 7,934 | +234% | 0 | 0 | — |
case-05 | fail→pass | 13,458 | 6,940 | -48% | 1 | 1 | 0% | 2,413 | 8,000 | +232% | 0 | 0 | — |
case-06 | fail→pass | 9,572 | 11,119 | +16% | 1 | 1 | 0% | 1,871 | 9,013 | +382% | 0 | 0 | — |
case-07 | fail→pass | 4,050 | 4,570 | +13% | 1 | 1 | 0% | 704 | 7,707 | +995% | 0 | 0 | — |
case-08 | fail→pass | 14,263 | 9,024 | -37% | 1 | 1 | 0% | 1,203 | 7,214 | +500% | 0 | 0 | — |
case-09 | fail→fail | 4,877 | 1,953 | -60% | 1 | 1 | 0% | 979 | 7,109 | +626% | 0 | 0 | — |
case-10 | fail→pass | 10,139 | 4,190 | -59% | 1 | 1 | 0% | 1,589 | 7,294 | +359% | 0 | 0 | — |
case-11 | fail→fail | 9,144 | 5,460 | -40% | 1 | 1 | 0% | 1,795 | 7,644 | +326% | 0 | 0 | — |
case-12 | fail→pass | 17,604 | 2,156 | -88% | 1 | 1 | 0% | 1,492 | 7,121 | +377% | 0 | 0 | — |
case-13 | pass→pass | 8,280 | 3,882 | -53% | 1 | 1 | 0% | 1,395 | 7,470 | +435% | 0 | 0 | — |
case-14 | fail→fail | 6,349 | 4,062 | -36% | 1 | 1 | 0% | 1,152 | 7,494 | +551% | 0 | 0 | — |
case-15 | fail→pass | 4,041 | 3,121 | -23% | 1 | 1 | 0% | 706 | 7,042 | +897% | 0 | 0 | — |
case-16 | fail→fail | 8,080 | 1,779 | -78% | 1 | 1 | 0% | 1,350 | 7,038 | +421% | 0 | 0 | — |
case-17 | fail→pass | 16,703 | 8,304 | -50% | 1 | 1 | 0% | 1,574 | 7,355 | +367% | 0 | 0 | — |
case-18 | fail→fail | 5,338 | 3,766 | -29% | 1 | 1 | 0% | 885 | 7,208 | +714% | 0 | 0 | — |
case-19 | fail→fail | 4,400 | 1,729 | -61% | 1 | 1 | 0% | 705 | 7,054 | +901% | 0 | 0 | — |
case-20 | fail→pass | 7,968 | 4,792 | -40% | 1 | 1 | 0% | 1,613 | 7,280 | +351% | 0 | 0 | — |
case-21 | fail→pass | 8,818 | 4,537 | -49% | 1 | 1 | 0% | 1,624 | 7,338 | +352% | 0 | 0 | — |
case-22 | fail→pass | 6,624 | 1,811 | -73% | 1 | 1 | 0% | 1,055 | 7,085 | +572% | 0 | 0 | — |
case-23 | fail→pass | 11,645 | 5,384 | -54% | 1 | 1 | 0% | 2,037 | 7,482 | +267% | 0 | 0 | — |
case-24 | fail→pass | 5,073 | 2,527 | -50% | 1 | 1 | 0% | 1,028 | 7,186 | +599% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 24 cases were attempted, and 23 counted toward the lift figure. The other 1 produced results that are not comparable between the two arms, so they are excluded from the headline rather than averaged into it. The headline lift of +67 percentage points is the difference between those two pass rates over the 23 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.