@synthryn/sypi-openrouter
v0.6.0-beta.20260816.6a00fcae
Published
Optional extension: Pin selected OpenRouter models to a specific upstream provider without changing other model requests. Use it when provider choice must be deterministic for a model. Primary capability: /provider and the provider-routing settings; an Op
Downloads
77
Maintainers
Readme
sypi-openrouter
Per-model OpenRouter provider pinning. OpenRouter selects an upstream
provider per request by default. This extension can force a provider for one
model, such as routing deepseek/deepseek-v3 to deepinfra and
deepseek/deepseek-v4 to deepseek. A pin is keyed by model ID and affects
only that model. With no pins, the extension is a no-op and OpenRouter routes as
usual.
How it works. A before_provider_request hook injects OpenRouter's routing
field (provider: { only: [<slug>], allow_fallbacks: false }) when
payload.model matches a pinned model ID. It returns a modified payload and
never mutates the original. Matching payload.model against an OpenRouter slug
such as vendor/model is the safety gate. A non-OpenRouter request is not
changed. The hook returns undefined unless a pin matches. With zero pins, it
returns before inspecting the payload.
Settings > Models > Provider routing manages the pins with a two-step centered board: choose an available OpenRouter model, then automatic routing, explicit refresh, or a cached upstream provider. Both pickers type-to-filter; backspace edits the filter, Esc clears it before closing, and keyboard and pointer activation share the same rows. Network lookup happens only after explicit refresh. /provider <model> [slug] remains the direct fast path; bare /provider points to Settings.
Where pins live. Pins are one config surface: openrouter.pins (a { <modelId>: <providerSlug> } map) in the active profile. The host projects only that settings block into the package and owns atomic updates, preserving sibling profile settings. A malformed openrouter.pins warns once and falls back to no pins.
There is no side-file fallback or migration for pins and no environment override for the map. OPENROUTER_API_KEY is read only from the environment for an explicit provider-catalog refresh and never from the profile. The package uses only the public extension API for scoped settings, state paths, and board mounting; external settings and catalog data are validated with Typebox.
