openrouter

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

OpenRouter Skill

OpenRouter Skill

Provides AI integration capabilities via OpenRouter — a unified API for 100+ LLMs.
  • Model Discovery — List available OpenRouter models with capabilities, context windows, and pricing.
  • Integration Guide — Get code examples and patterns for integrating OpenRouter in different environments (Node.js, Cloudflare Workers, browser).
  • Chat — Send a prompt to any OpenRouter model and return the response. Requires
    OPENROUTER_API_KEY
    env var.
提供基于OpenRouter的AI集成能力——这是一个支持100+大语言模型(LLM)的统一API。
  • 模型发现——列出可用的OpenRouter模型,包含其能力、上下文窗口和定价信息。
  • 集成指南——获取在不同环境(Node.js、Cloudflare Workers、浏览器)中集成OpenRouter的代码示例和模式。
  • 聊天功能——向任何OpenRouter模型发送提示词并返回响应。需要配置
    OPENROUTER_API_KEY
    环境变量。

Usage

使用方法

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

Subcommands

子命令

models

models

List available OpenRouter models with capabilities and pricing.
bun run openrouter/openrouter.ts models [--filter <term>]
Options:
  • --filter
    (optional) — Filter models by name (case-insensitive substring match)
列出可用的OpenRouter模型及其能力和定价信息。
bun run openrouter/openrouter.ts models [--filter <term>]
选项:
  • --filter
    (可选)——按名称过滤模型(不区分大小写的子字符串匹配)

guide

guide

Print integration code examples for a target environment.
bun run openrouter/openrouter.ts guide [--env <environment>] [--feature <feature>]
Options:
  • --env
    — Target environment:
    nodejs
    |
    cloudflare-worker
    |
    browser
    |
    all
    (default:
    all
    )
  • --feature
    — Feature to show:
    chat
    |
    completion
    |
    streaming
    |
    function-calling
    |
    all
    (default:
    all
    )
打印针对目标环境的集成代码示例。
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

chat

Send a prompt to an OpenRouter model. Requires
OPENROUTER_API_KEY
environment variable.
bun run openrouter/openrouter.ts chat --prompt "Hello" [--model <model-id>] [--max-tokens <n>]
Options:
  • --prompt
    (required) — The prompt to send
  • --model
    (optional) — Model ID (default:
    openai/gpt-4o-mini
    )
  • --max-tokens
    (optional) — Max tokens in response (default: 1024)
向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
    (可选)——响应中的最大token数(默认值:1024)

Notes

注意事项

  • models
    and
    guide
    work without an API key.
  • chat
    requires
    OPENROUTER_API_KEY
    environment variable (get from https://openrouter.ai/keys).
  • OpenRouter API base:
    https://openrouter.ai/api/v1
  • models
    guide
    功能无需API密钥即可使用。
  • chat
    功能需要
    OPENROUTER_API_KEY
    环境变量(可从https://openrouter.ai/keys获取)。
  • OpenRouter API基础地址:
    https://openrouter.ai/api/v1