Skip to content

Releases

v0.9.0 — OpenCode V2 support

Choose a tag to compare

@vheins vheins released this 22 Sep 07:41

OpenCode V2 support (dual V1 + V2)

One package now works on both OpenCode V2 (Plugin.define({ id, setup })) and OpenCode V1 (1.18.29+, via the server hook). The discovery core is shared; only the entrypoint differs.

Highlights

  • New V2 plugin (src/v2.ts) built with Plugin.define({ id: "9router", setup }), registering providers/models through ctx.provider.transform(...) and refreshing via ctx.provider.reload()
  • New src/v2-map.ts mapping the discovered ModelConfig onto V2 Model.Info (capabilities, required limit.context/limit.output, variants)
  • New src/index.ts dual entrypoint: default export merges the V2 definition with server: NineRouterPlugin (V1 1.18.29+); named NineRouterPlugin export retained for older V1
  • Package entry (exports, main, types) now points at dist/index.js / dist/index.d.ts
  • @opencode/plugin@^2.0.12 added as a runtime dependency; @opencode-ai/plugin / @opencode-ai/sdk kept for V1 types

Install

{
  "$schema": "https://opencode.ai/config.json",
  "plugins": ["@vheins/opencode-9router@latest"]
}

Config for V2 uses "plugins": [...]; custom providers use package: "@opencode/ai/providers/openai-compatible" + settings.baseURL under the providers key. See README "OpenCode V2" section for full config.

Compatibility & notes

  • V1 behavior unchanged; discovery/capability/cache algorithms untouched (no V1 regression).

Changelog

  • f3ac6ca feat(plugin): add OpenCode V2 support with dual V1/V2 entrypoint
  • d2a46d2 chore(release): bump to 0.9.0 for OpenCode V2 support
  • c978af5 docs: document OpenCode V2 configuration and dual V1/V2 support

v0.8.1 — Strict combo enrichment

Choose a tag to compare

@vheins vheins released this 10 Sep 15:26

Strict combo enrichment

  • Combos count as enriched only on an exact models.dev segment match (no more loose substring hits like vision → gpt-4-turbo-vision)
  • Ignore bare /models/info capability stubs ({tools: true}) for combos, so backends that return stubs still get forced multimodal defaults

Install: "plugin": ["@vheins/opencode-9router@0.8.1"] or @latest

v0.8.0 — Combo multimodal defaults

Choose a tag to compare

@vheins vheins released this 10 Sep 14:50

Combo multimodal defaults

  • Detect combo models via owned_by: "combo" (fallback: no provider prefix)
  • Force multimodal defaults on combos with no resolved capability info: text/image/audio input, tool calling, reasoning, 256K context, 128K output
  • Add low/medium/high/xhigh/max/minimal/thinking variants, plus search: false, context_length, and max_completion_tokens
  • Already-enriched combos (e.g. gpt-5.6-luna) are left untouched
  • Version discovery cache so older entries are refetched

Install: "plugin": ["@vheins/opencode-9router@0.8.0"] or @latest

v0.7.10

Choose a tag to compare

@vheins vheins released this 09 Sep 10:05

v0.7.10 — fix(discovery): populate limit.context/output

Changes

  • fix(discovery): populate limit.context/limit.output so context usage % is not stuck at 0 (#2)
  • hardened validation: numeric token limits normalized through a single toPositiveInt path — invalid/zero/negative values never produce a limit
  • refactor: split monolithic src/plugin.ts (485 lines) into cache.ts, capabilities.ts, discovery.ts, types.ts, utils.ts (<500 lines/file)
  • test: add test-limit.mjs regression suite — top-level fallback, nested-capability precedence, invalid-value rejection, models.dev catalog flow (5/5 minimal + 9/9 limit, all passing)

Artifacts

v0.7.9

Choose a tag to compare

@vheins vheins released this 19 Jul 01:47

Performance & Hardening Release

Performance Optimizations

  • models.dev-first capability resolution — Fetch capability catalog before per-model API. Eliminates most HTTP calls when models exist in the models.dev catalog.
  • Retry on transient failures — fetchModelInfo now retries once with exponential backoff (500ms × 2^attempt) for network glitches.
  • Higher concurrency — MAX_CONCURRENT_INFO increased from 5 to 15.
  • Generous per-model timeout — MODEL_INFO_TIMEOUT raised from 3s to 5s for slow networks.
  • Longer models.dev cache — TTL increased from 5 minutes to 1 hour.
  • Cross-platform cache path — Uses os.homedir() + XDG_CACHE_HOME fallback (works on Windows).
  • Capability budget — 10-second cap on per-model API work to prevent startup blocking.

Security & Resilience Fixes

  • Path traversal sanitizer — safeFilename() in cache path construction prevents providerKey-based directory escape.
  • Prototype pollution defense — Object.create(null) for models dictionary.
  • Empty payload fallback — /v1/models returning empty/invalid data now throws to engage stale cache fallback.
  • Crash resilience — cacheDir() falls back to os.tmpdir() if homedir() throws.
  • HTTP error fallback — Non-OK responses now throw to engage stale cache (instead of returning null).

Docs

  • Added "Validate after publish" / "Validasi setelah publikasi" sections with the opencode models 9router-local --print-logs --log-level DEBUG command for end-to-end validation after release.

Test

opencode models 9router-local --print-logs --log-level DEBUG

Installation

{
  "$schema": "https://opencode.ai/config.json",
  "plugin": ["@vheins/opencode-9router@latest"]
}

v0.7.8

Choose a tag to compare

@vheins vheins released this 18 Jul 06:59

refactor(plugin): add provider prefix to cache filenames, fix models-dev cache storage

  • Discovery cache filenames now include provider key prefix for clarity
  • models-dev.json now stores raw API response (dict), flattened on read
    instead of storing the flattened array (which broke cache reads)
  • Backward compat: old flat-array caches are treated as cache miss
  • auth.json no longer needs metadata.baseURL — plugin handles URL

v0.7.7

Choose a tag to compare

@vheins vheins released this 18 Jul 06:55

fix(plugin): flatten models.dev catalog response

models.dev/api.json returns a dict of providers with nested models, not
an array. findModelsDevMatch iterated with for...of over the raw response,
causing TypeError: {} is not iterable. This fix flattens the nested
provider dict into a flat array of {id, capabilities} entries before use.

Also fixes the provider api field to ensure opencode's built-in plugin
can resolve the endpoint URL for 9router-family providers.

v0.7.6

Choose a tag to compare

@vheins vheins released this 18 Jul 06:47

fix(plugin): set provider api field for opencode internal resolution

opencode's built-in provider plugin reads m.api from the provider config
to construct the aisdk provider endpoint URL. Without entry.api being set,
the provider URL was undefined, causing 'Provider not found' for all
9router-family providers.

v0.7.5

Choose a tag to compare

@vheins vheins released this 18 Jul 06:38

fix(plugin): mutate existing provider entry instead of replacing it

Replacing the entire provider entry (provider[key] = {...}) broke
opencode's internal reference to the provider, causing 'Provider not
found' errors after the config hook completed. Mutation preserves the
object reference so opencode can still find the provider.

v0.7.4

Choose a tag to compare

@vheins vheins released this 11 Jul 13:35

Changes

  • Add cache, cacheTTL, discoveryTimeout options to all provider examples in README
  • Same updates applied to README.id.md