SuperAPI AI 工具集

openrouter-free

通用与其它

查看项目

更新于 10-16 09:58

技能介绍

用途:通过命令行把 OpenRouter 的免费模型接入工作流,支持模型发现、健康检查与对话。

主要能力:首次运行或 init 时从 GET https://openrouter.ai/api/v1/models 抓取模型,缓存到 ~/.opencode/openrouter-model-cache.json,使用 0o600 权限,遵循 CACHE_TTL_MS(默认 1 小时);按 :free 或能力标签过滤,映射短别名(如 r1、qwen、gemma)到完整 ID;提供 models [filter]、use <model|alias>、chat "<msg>" [--model <id>]、health [model] 等命令;对话输出流式 SSE;遇 429/5xx 以 1s、2s、4s 指数退避重试,模型失败时经 fallback-router.ts 回退到下一可用模型。

使用方式:设置 OPENROUTER_API_KEY(export OPENROUTER_API_KEY="sk-or-v1-..."),再调用 /openrouter-free [command] [args]。示例:openrouter-free models vision;openrouter-free use best-free;openrouter-free chat "Write a Python HTTP server" --model r1;openrouter-free health。

限制:仅面向免费模型,除非明确要求否则不管理付费模型;不保存当前 REPL 会话之外的聊天历史;不修改 ~/.opencode/ 缓存以外的项目文件;模型 ID 使用完整 provider/model 字符串,不臆造命令参数。官方页面、价格、平台支持等更多事实暂未提供。