← 返回 Skills 市场
37
总下载
0
收藏
0
当前安装
1
版本数
在 OpenClaw 中安装
/install openrouter-model-picker
功能描述
从 OpenRouter 拉取所有 AI 模型,在交互式 Canvas UI 中让用户选择启用模型并一键热更新 OpenClaw 配置。当用户说"模型选择器"、"换模型"、"更新模型列表"、"选择 OpenRouter 模型"、"管理模型"、"模型管理"、"切换模型"、"换个模型"时使用。支持按厂商分组、按能力筛...
使用说明 (SKILL.md)
OpenRouter Model Picker
交互式 Canvas 模型选择器:拉取 OpenRouter 全部模型 → UI 选择 → 一键 apply → 配置热更新。
架构
fetch_models.py ──→ picker.html (Canvas embed) ──→ config_server.py ──→ openclaw config patch
↑ 拉数据 ↑ 交互 UI ↑ POST /apply ↑ 热更新
- fetch_models.py: 从 OpenRouter API 拉取模型列表,归一化 ID,注入 picker.html
- config_server.py: 监听
127.0.0.1:18790,接受 POST /apply →openclaw config patch --stdin- apply 成功后立即退出
- idle 超过
--idle秒自动退出(默认 600s);设--idle 0禁自动退出
- picker.html: 前端 UI,部署到 Canvas,内联模型 JSON + 时间戳
路径约定
所有路径相对于 skill 根目录。将 skill 目录路径存为变量:
SKILL_DIR="$(dirname $(find ${HOME}/.openclaw/workspace/skills -name SKILL.md -path '*/openrouter-model-picker/*' 2>/dev/null | head -1 | xargs dirname))"
# 如果上面找不到,直接用 workspace 相对路径:
# SKILL_DIR="${HOME}/.openclaw/workspace/skills/openrouter-model-picker"
OPENCLAW_CANVAS="${HOME}/.openclaw/canvas"
完整工作流程
每一步必须按顺序执行,不可跳过。
1. 检查 config_server 状态
curl -s --connect-timeout 2 http://127.0.0.1:18790/health 2>/dev/null && echo "RUNNING" || echo "DEAD"
如果 RUNNING,跳到步骤 3。如果 DEAD,执行步骤 2。
2. 拉取模型数据 + 启动 config_server
# 拉取数据(验证 API 可达)
python3 ${SKILL_DIR}/scripts/fetch_models.py > /dev/null || { echo "Failed to fetch models"; exit 1; }
# 后台启动 config_server
python3 ${SKILL_DIR}/scripts/config_server.py --port 18790 --idle 600 &
sleep 1
curl -s http://127.0.0.1:18790/health
3. 部署到 Canvas
DOC_ID="model-picker-$(date +%Y%m%d-%H%M%S)"
CANVAS_DIR="${OPENCLAW_CANVAS}/documents/${DOC_ID}"
mkdir -p "$CANVAS_DIR"
cp ${SKILL_DIR}/assets/picker.html "$CANVAS_DIR/index.html"
DATA=$(python3 ${SKILL_DIR}/scripts/fetch_models.py 2>/dev/null)
python3 -c "
import json, sys, os
data = sys.stdin.read()
ts = '${DOC_ID}'
html_path = '${CANVAS_DIR}/index.html'
with open(html_path) as f:
html = f.read()
inject = '\x3Cscript>var MY_PICKER_TS = \"' + ts + '\";\
window.__PICKER_DATA__ = ' + data + ';\
initWithData(window.__PICKER_DATA__);\
\x3C/script>'
html = html.replace('\x3C/body>', inject + '\x3C/body>')
# 让旧的固定-ref picker 显示过期提示
stale_dir = '${OPENCLAW_CANVAS}/documents/model-picker'
if os.path.exists(stale_dir):
with open(os.path.join(stale_dir, 'index.html'), 'w') as f:
f.write('\x3Chtml>\x3Cbody style=\"background:#0f0f10;color:#666;display:flex;align-items:center;justify-content:center;height:100vh;font-family:sans-serif\">\x3Cp>选择器已过期,请重新触发「选择模型」\x3C/p>\x3C/body>\x3C/html>')
with open(html_path, 'w') as f:
f.write(html)
print('OK')
" \x3C\x3C\x3C "$DATA"
4. 渲染 embed
[embed ref="\x3CDOC_ID>" title="OpenRouter 模型选择器" height="600" /]
5. 用户操作完成后
用户点击「应用选择」→ 无需额外操作。config_server 自动执行 apply → 退出。
Picker 前端行为
- 初始化时:立即检查 server 健康(
GET /health),每 10s 轮询。如果 server 不在 → 显示 ⏳ "选择器已超时" 遮罩 - 应用中:POST /apply → 成功后显示 ✅ 遮罩 → 3s 后自动刷新父页面
- 刷新后:页面重载 → server 已退出 → health check 失败 → 显示 ⏳ 超时遮罩
- 沙盒兼容:localStorage 访问包在 try/catch 中,sandboxed iframe 下优雅降级
备用方案:命令行直接修改配置
不走 UI 时用:
python3 ${SKILL_DIR}/scripts/update_config.py \
--primary "auto" \
--enabled "auto,anthropic/claude-sonnet-4.6,deepseek/deepseek-v3.2" \
--fallbacks "deepseek/deepseek-v3.2,free"
参考
- config_server 完整参数和生命周期:见
references/config-server.md - ID 归一化规范:Picker 内部所有 ID 去掉
openrouter/前缀,config_server 写回时自动加回 - 热更新范围:
agents.*和models.*全部热更新,无需重启 Gateway - 代理:
fetch_models.py需要访问openrouter.ai,走https_proxy环境变量
安全使用建议
Install only if you trust the publisher and are comfortable with a temporary localhost service that can change your OpenClaw model configuration. Avoid leaving the picker open while browsing untrusted pages, review the selected enabled models before applying, and prefer a version that adds a per-session token, origin checks, and server-side model allowlist validation.
能力评估
Purpose & Capability
The model-fetching UI, OpenRouter API access, Canvas deployment, and OpenClaw config patching are coherent with the stated purpose of selecting and hot-applying models.
Instruction Scope
The invocation phrases are broad for a state-changing skill, and the workflow starts a local service and prepares configuration mutation after normal model-management requests.
Install Mechanism
No package install or hidden installer behavior is present; the artifacts are plain Markdown, Python scripts, an HTML UI, and a reference document.
Credentials
The local server binds only to 127.0.0.1, but it allows wildcard CORS and accepts unauthenticated POST /apply requests that feed directly into openclaw config patch.
Persistence & Privilege
Successful use persistently changes agent model settings and may remove unselected configured models; the server is temporary by default, but the mutation authority is broad and not protected by a per-session token or allowlist.
如何使用
- 确保已安装 OpenClaw(本地或 Docker 部署)
- 在对话框中输入安装命令:
/install openrouter-model-picker - 安装完成后,直接呼叫该 Skill 的名称或使用
/openrouter-model-picker触发 - 根据 Skill 的参数说明提供必要输入,即可获得结构化输出
版本历史
v1.0.0
OpenRouter Model Picker v1.0.0
- New interactive Canvas UI for selecting and managing OpenRouter AI models.
- Fetches the full model list from OpenRouter, supports grouping, filtering, and search.
- One-click apply updates your OpenClaw configuration instantly—no Gateway restart required.
- Health-checked background server auto-applies config and exits after use.
- Fully hot-patches agent/model settings and auto-refreshes UI for users.
- CLI fallback provided for direct configuration if UI is not used.
元数据
常见问题
Openrouter Model Picker 是什么?
从 OpenRouter 拉取所有 AI 模型,在交互式 Canvas UI 中让用户选择启用模型并一键热更新 OpenClaw 配置。当用户说"模型选择器"、"换模型"、"更新模型列表"、"选择 OpenRouter 模型"、"管理模型"、"模型管理"、"切换模型"、"换个模型"时使用。支持按厂商分组、按能力筛... 它是一个面向 Claude Code / OpenClaw 的 AI Agent Skill 插件,目前累计下载 37 次。
如何安装 Openrouter Model Picker?
在 OpenClaw 或 Claude Code 对话框中运行命令「/install openrouter-model-picker」即可一键安装,无需额外配置。
Openrouter Model Picker 是免费的吗?
是的,Openrouter Model Picker 完全免费,采用 MIT-0 许可证,可自由下载、安装和使用。
Openrouter Model Picker 支持哪些平台?
Openrouter Model Picker 跨平台运行,可在任意部署了 OpenClaw / Claude Code 的环境中使用(cross-platform)。
谁开发了 Openrouter Model Picker?
由 Forrest(@ys727469926)开发并维护,当前版本 v1.0.0。
推荐 Skills