mcpField
O
openrouter

openrouter

github.com/aibtcdev开发11162 次安装2 天前更新
代码仓库

关于 openrouter

openrouter 是通过 OpenRouter 发现模型并发送提示词的命令行技能。它还提供适用于 Node.js、Cloudflare Workers 和浏览器的集成示例。

主要功能

  1. 01列出模型、能力和价格
  2. 02按名称筛选模型
  3. 03按环境输出集成示例
  4. 04向 OpenRouter 模型发送提示词

适用场景

  1. 01比较可用模型及价格
  2. 02查找目标环境的示例代码
  3. 03向选定模型请求回复

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/aibtcdev/skills --skill openrouter

安装后在 Claude Code 中输入/openrouter确认已加载。

附带文件AGENT.mdopenrouter.ts

详细介绍

OpenRouter 技能

通过 OpenRouter 提供 AI 集成能力——这是一个支持 100 多种大模型的统一 API。

  • 模型发现 — 列出 OpenRouter 上可用的模型及其能力、上下文窗口和定价。
  • 集成指南 — 获取在不同环境(Node.js、Cloudflare Workers、浏览器)中集成 OpenRouter 的代码示例和模式。
  • 聊天 — 向任意 OpenRouter 模型发送提示词并返回回复。需要 OPENROUTER_API_KEY 环境变量。

用法

bun run openrouter/openrouter.ts <subcommand> [options]

子命令

models

列出 OpenRouter 上可用的模型及其能力和定价。

bun run openrouter/openrouter.ts models [--filter <term>]

选项:

  • --filter(可选)— 按名称筛选模型(不区分大小写的子字符串匹配)
guide

打印适用于目标环境的集成代码示例。

bun run openrouter/openrouter.ts guide [--env <environment>] [--feature <feature>]

选项:

  • --env — 目标环境:nodejs | cloudflare-worker | browser | all(默认值:all)
  • --feature — 要显示的功能:chat | completion | streaming | function-calling | all(默认值:all)
chat

向 OpenRouter 模型发送提示词。需要 OPENROUTER_API_KEY 环境变量。

bun run openrouter/openrouter.ts chat --prompt "Hello" [--model <model-id>] [--max-tokens <n>]

选项:

  • --prompt(必填)— 要发送的提示词
  • --model(可选)— 模型 ID(默认值:openai/gpt-4o-mini)
  • --max-tokens(可选)— 回复中的最大令牌数(默认值:1024)

备注

  • models 和 guide 无需 API 密钥即可使用。
  • chat 需要 OPENROUTER_API_KEY 环境变量(从 https://openrouter.ai/keys 获取)。
  • OpenRouter API 基础 URL:https://openrouter.ai/api/v1

评论

支持 Markdown