dsh-openrouter-live
OpenRouter provider that reads the live /models list, so new models appear without a harness release: models sorted by name with input/output prices, per-model reasoning levels, image input, reasoning_details replay, Anthropic prompt caching, and actual spend per session including subagents from Ope
Install
dsh plugin --profile web add dsh-openrouter-live
Sandbox test results
| Stage | Result |
|---|---|
| 1 install | ✗ |
| 2 list | — |
| 3 mount | — |
| 4 boot | — |
dsh: initialized profile web at /home/node/.dsh/profiles/webFour stages run in an isolated sandbox: install (network on) → list → mount → boot (last three with no network).
README
dsh-openrouter-live
An OpenRouter provider for DeepSeek Harness (dsh) that reads OpenRouter's live model list, so a model shows up in the picker as soon as OpenRouter serves it.
The harness's built-in openrouter route lists models from a catalog bundled with each release. A model released after that snapshot, such as deepseek/deepseek-v4.1-flash, does not appear in the picker until the next harness release. This plugin adds a second route, OpenRouter (live). It reads OpenRouter's /models endpoint and takes each model's metadata from there.
What it does
- Live model list. It lists every OpenRouter model that accepts tools, sorted by name, so models from one vendor stay together. Each name ends with the input/output price per million tokens. The list is refreshed every 10 minutes. If a refresh fails, the previous list stays in use.
- Per-model metadata. The context window and output cap come from OpenRouter. The reasoning levels come from the model's own
reasoning.supported_efforts, so the composer offers only levels the model accepts, including Off when reasoning is optional. - Image input. It inlines images for models whose
/modelsentry listsimageinput. It follows the harness image budget: images are downscaled, and the oldest images are offloaded when a request grows too large. - Reasoning continuity. It sends
reasoning_detailsback on later requests, including signed and encrypted entries. This lets models such as Claude and DeepSeek keep their reasoning across tool calls. - Prompt caching.
- Anthropic models get cache breakpoints on the system prompt and the newest message. In a live check, a second request read 7209 of 7223 prompt tokens from cache.
- Other providers cache automatically. The
x-session-idheader keeps each conversation on one upstream provider, so its cache stays warm. - Classified failures. Errors map to the harness failure codes, so the harness retry plugin retries only what is worth retrying:
- Retried: rate limits, with OpenRouter's
Retry-Afterhonored; upstream 5xx errors; idle streams; truncated streams; empty responses. - Not retried: bad keys, exhausted credits, and context overflow.
- Actual spend, including subagents. The plugin records the charge OpenRouter reports for every response (
usage.cost), so these are real charges, not token estimates. Each charge is attributed to the session that made the request and to every session it was delegated from. Type/costin the CLI or Web UI:
OpenRouter spend in this session: $0.0022 (5 requests)
this agent: $0.0011 (3 requests)
subagents: $0.0011 (2 requests in 1 session)
All recorded sessions: $0.0022 (5 requests).
In the Web UI the session total is always visible under the composer, next to the built-in statistics and context meter. It updates during a turn, including subagent charges, and its tooltip splits the total between the agent and its subagents. It is hidden in sessions with no OpenRouter charges.
Charges are appended to ~/.dsh/openrouter-live/costs.jsonl, one JSON line per response, so totals survive restarts. Each line carries the OpenRouter generation id, so any charge can be matched against your OpenRouter activity page.
- Shared credential. By default the route reads the same
OPENROUTER_API_KEYcredential as the built-inopenrouterroute, so a key you already stored works without extra setup.
Requirements
- DeepSeek Harness
0.1.6-alpha.2through0.1.7. It has been tested on0.1.6-alpha.2and0.1.7-alpha.2. The harness API is pre-stable, so later harness versions are added to the peer range after they are tested. - Node.js
^22.19 || >=24. - An OpenRouter API key.
Install
From npm:
dsh plugin --profile web add dsh-openrouter-live
From a local checkout:
git clone https://github.com/Boomerangz/dsh-openrouter-live.git cd dsh-openrouter-live npm install npm pack --pack-destination dist # runs typecheck and tests first dsh plugin --profile web add "$PWD/dist/dsh-openrouter-live-0.2.0.tgz"
[!IMPORTANT]
Install the packed.tgz, not the directory. When you add a directory, pnpm links it, Node resolves the link to its real path outside the profile, and the harness packages (@deepseek-ai/*) can't be found there. The whole profile then fails to boot.
Restart the profile after installing. OpenRouter (live) then appears in the model picker. If you haven't stored a key yet, choose one of these:
- Enter it on the built-in OpenRouter card under Settings → Models. It is stored as
OPENROUTER_API_KEY, which both routes read. - Export
OPENROUTER_API_KEYbefore launchingdsh.
To choose it as the default model, pick it in the composer's model picker. You can also set it in ~/.dsh/settings.yaml:
agent-default-model: provider: openrouter-live model: deepseek/deepseek-v4.1-flash
Configuration
Every field is optional. Set fields in the profile's patch layer, ~/.dsh/profiles/<profile>/cordis.patch.yml, under the plugin's entry id openrouter-live:
- id: openrouter-live
config:
models: ['deepseek/*', 'anthropic/claude-*', 'openai/gpt-5*']
extraBody:
provider:
sort: throughput
Field · Default · Meaning
models · [] · Glob patterns over model ids. An empty list lists every model. Ids outside the filter still work when typed.
toolsOnly · true · List only models whose OpenRouter entry accepts tools. Agent turns need tools.
priceInName · true · Append input/output prices per 1M tokens to model names, such as `DeepSeek: D
…(truncated)
Rendered from the README published on npm. Formatted only, not edited.
Versions
Published on npm::3,最后更新 2026-09-23