dxt-openrouter-router

dxt-openrouter-router

A tiny MCP server that constructs OpenRouter request bodies from presets and energy levels, with zero data retention by default, enabling routing decisions without exposing API keys.

Category
访问服务器

README

DXT OpenRouter Router

npm license

A tiny MCP (stdio) server that returns a ready-to-send OpenRouter request body from a named preset and your current energy budget:

energy Model slug becomes Meaning
low …:floor cheapest provider serving that model
balanced (base slug) the model's default provider
high …:nitro highest-throughput provider

Two things make this different from a normal cost router:

  1. It routes on energy, not just cost. The input is a fact about you, not about the task. "Cheap" and "fast" are the same axis viewed from different energy levels.
  2. Zero Data Retention is the default. Every body ships provider.data_collection: "deny", so a preset has to explicitly opt out of privacy rather than opt in to it.

It builds the request. It does not send it — so it never needs your API key in-process, and never sees a response.


Install

npm install -g dxt-openrouter-router

Or run it without installing:

npx dxt-openrouter-router

Register it with an MCP host

Claude Desktop (claude_desktop_config.json) or any MCP client:

{
  "mcpServers": {
    "openrouter-router": {
      "command": "npx",
      "args": ["-y", "dxt-openrouter-router"],
      "env": {
        "ROUTING_PRESETS_PATH": "C:\\path\\to\\routing.presets.json"
      }
    }
  }
}

ROUTING_PRESETS_PATH is optional — omit it and the bundled routing.presets.json is used. The file is re-read on every call, so you can edit presets without restarting the host.

The routeLLM tool

Argument Required Description
preset A key from routing.presets.json, e.g. research_long_context
energy low | balanced | high (default balanced)
user_prompt The user message to place in the body
system Overrides the preset's own system prompt
overrides Extra body fields merged in last, e.g. { "temperature": 0.2 }

Example

// call
{ "preset": "research_long_context", "energy": "low", "user_prompt": "Synthesize these sources..." }
// result
{
  "url": "https://openrouter.ai/api/v1/chat/completions",
  "method": "POST",
  "headers": {
    "Authorization": "Bearer $OPENROUTER_API_KEY",  // literal placeholder — never your real key
    "Content-Type": "application/json"
  },
  "api_key_configured": true,
  "body": {
    "temperature": 0.2,
    "model": "meta-llama/llama-3.1-70b-instruct:floor",
    "messages": [
      { "role": "system", "content": "You are a careful research synthesist. ..." },
      { "role": "user", "content": "Synthesize these sources..." }
    ],
    "provider": { "data_collection": "deny" }
  }
}

Presets

routing.presets.json is a plain map of name → preset:

{
  "presets": {
    "daily_driver": {
      "model": "google/gemini-3.6-flash",   // no :floor/:nitro here — energy adds that
      "description": "Default workhorse — unit tests, refactors, docs, CLI loops.",
      "system": "Optional default system prompt.",
      "provider": { "data_collection": "deny" },      // merged over the ZDR default
      "response_format": { "type": "json_object" },   // passed straight through
      "params": { "temperature": 0.4 }                // any other OpenRouter body field
    }
  }
}

Bundled presets mirror a simple decision tree:

Preset Model Reach for it when
quick_ping x-ai/grok-4.5 formats, clarifications, vibe checks
daily_driver google/gemini-3.6-flash ~80% of volume — tests, refactors, docs
logic_engine openai/gpt-5.6-sol math, symbolic logic, formal reasoning
high_reasoning anthropic/claude-opus-4.8 architecture, nuanced review, agentic work
research_long_context meta-llama/llama-3.1-70b-instruct long-context synthesis across sources
structured_json google/gemini-3.6-flash extraction that must return parseable JSON

Slugs were verified against https://openrouter.ai/api/v1/models on 2026-07-22. OpenRouter slugs change as models ship — re-check before relying on them.

Secrets

🔒 This package contains no API key, and the tool output never includes one.

  • OPENROUTER_API_KEY is read from the environment, and only ever reported as the boolean api_key_configured.
  • The Authorization header is emitted as the literal string Bearer $OPENROUTER_API_KEY, so tool output is safe to paste into a chat log, an issue, or a commit.
  • Copy .env.example.env for local use. .env is gitignored.

Use as a library

The pure core is exported, so you can build bodies without MCP:

import { buildRequestBody, loadPresets } from "dxt-openrouter-router";

const presets = loadPresets("./routing.presets.json");
const body = buildRequestBody(presets, { preset: "daily_driver", energy: "low" });

Develop

npm install
npm run build     # tsc -> dist/
npm test          # node --test test/

License

MIT © Sasha Philius

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选