@joaogsbarbosa/opencode-9router 0.0.0-stage → 0.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,3 +1,506 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
1
+ # @vheins/opencode-9router
2
+
3
+ OpenCode plugin provider for [9Router](https://github.com/decolua/9router) — FREE AI Router & Token Saver. 40+ providers, 100+ models.
4
+
5
+ Registers 9Router as a custom provider in OpenCode with auto-discovery of models.
6
+
7
+ > **Dual V1 + V2 support.** This package ships a single entrypoint that works on both **OpenCode V1** (via the V1 `server` hook, OpenCode `1.18.29`+) and **OpenCode V2** (via the V2 `Plugin.define({ id, setup })` API). The discovery core is shared; only the plugin entrypoint differs. No separate package is needed.
8
+
9
+ ## Quick Start
10
+
11
+ ### OpenCode V1
12
+
13
+ ```json
14
+ {
15
+ "$schema": "https://opencode.ai/config.json",
16
+ "plugin": ["@vheins/opencode-9router@latest"]
17
+ }
18
+ ```
19
+
20
+ 1. Add the plugin to `opencode.json`
21
+ 2. Restart OpenCode
22
+ 3. `/models` → select a 9Router model
23
+
24
+ ### OpenCode V2
25
+
26
+ ```json
27
+ {
28
+ "$schema": "https://opencode.ai/config.json",
29
+ "plugins": ["@vheins/opencode-9router@latest"]
30
+ }
31
+ ```
32
+
33
+ Or with plugin options (object form):
34
+
35
+ ```json
36
+ {
37
+ "$schema": "https://opencode.ai/config.json",
38
+ "plugins": [
39
+ {
40
+ "package": "@vheins/opencode-9router@latest",
41
+ "options": {
42
+ "baseURL": "http://localhost:20128",
43
+ "apiKey": "{env:ROUTER_API_KEY}",
44
+ "cache": true,
45
+ "cacheTTL": 10800000,
46
+ "discoveryTimeout": 30000
47
+ }
48
+ }
49
+ ]
50
+ }
51
+ ```
52
+
53
+ The plugin will auto-discover models from `http://localhost:20128` (default).
54
+
55
+ ## Features
56
+
57
+ - **Auto-discover models** — Models from 9Router are automatically detected on startup
58
+ - **Smart caching** — Discovery results cached for 3 hours (configurable) for instant subsequent loads
59
+ - **Stale fallback** — If the backend is unreachable, returns cached models instead of failing
60
+ - **Configurable timeout** — Adjustable discovery timeout (default 30s) for slow backends
61
+ - **Dynamic model list** — All models from 9Router are available, including custom combos
62
+ - **Combo multimodal defaults** — Combo models (`owned_by: "combo"`) that expose no capability info are forced to accept text/image/audio input with tool calling, reasoning, 256K context, 128K output, and `low`/`medium`/`high`/`xhigh`/`max`/`minimal`/`thinking` variants
63
+ - **Catalog thinking modes (V2)** — Reasoning variants from exact provider/model matches in models.dev, preserving configured overrides and combo variants
64
+ - **OpenAI-compatible** — Uses `@ai-sdk/openai-compatible` (V1) / `@opencode/ai/providers/openai-compatible` (V2)
65
+ - **Type-safe** — Uses the `config` hook (V1) / provider transforms (V2) for provider registration that conforms to the OpenCode config schema
66
+
67
+ ### Catalog thinking modes (V2)
68
+
69
+ Raw models expose effort and toggle variants from models.dev `reasoning_options`. Efforts use `reasoningEffort`; toggles use 9Router's `enable_thinking` body field and clear inherited effort with `reasoningEffort: null` in variant settings so it cannot override the toggle. The adapter omits the cleared effort from the request. Native OpenCode configuration merges variants by ID: settings/body fields you supply win, while unspecified catalog fields remain; an empty configured variants array does not remove catalog variants. Unknown controls and numeric budgets are omitted. Leaving the variant unselected preserves upstream defaults. These controls remain subject to 9Router's downstream effort rewriting and toggle handling.
70
+
71
+ `src/reasoning.ts` translates provider IDs using a subset of 9Router's [`PROVIDER_ALIASES`](https://github.com/decolua/9router/blob/89ffac5a2c8108449c432afd1ad6531578fa81cd/src/lib/modelCatalog/sync.js#L22-L40) at commit `89ffac5a2c8108449c432afd1ad6531578fa81cd` (`hunyuan` is omitted). The additional `gh` prefix comes from that revision's [GitHub provider registry](https://github.com/decolua/9router/blob/89ffac5a2c8108449c432afd1ad6531578fa81cd/open-sse/providers/registry/github.js#L1-L5). These aliases translate identities, not reasoning levels; controls still require an exact full model ID within the matched provider. Alias identity does not guarantee capability parity across authentication modes, notably Kimi's OAuth and API-key routes.
72
+
73
+ ## OpenCode V2
74
+
75
+ OpenCode V2 replaces the V1 `plugin` config key with `plugins` and the single-function plugin shape with `Plugin.define({ id, setup })`. This package handles both — the same published entrypoint is loaded by V1 and V2.
76
+
77
+ ### Configure (V2)
78
+
79
+ ```jsonc
80
+ {
81
+ "$schema": "https://opencode.ai/config.json",
82
+ "plugins": ["@vheins/opencode-9router@latest"]
83
+ }
84
+ ```
85
+
86
+ For a local checkout, keep the directory path in the V2 `plugins` list:
87
+
88
+ ```jsonc
89
+ {
90
+ "plugins": ["/absolute/path/to/opencode-9router"]
91
+ }
92
+ ```
93
+
94
+ The local directory must expose a root `server` entrypoint; this repository provides `server.js` for that purpose. The V1 configuration key remains `plugin` and can continue to use the published package name as shown above.
95
+
96
+ Plugin options use the object form (`{ "package": ..., "options": { ... } }`) and are read from `ctx.options`:
97
+
98
+ ```jsonc
99
+ {
100
+ "$schema": "https://opencode.ai/config.json",
101
+ "plugins": [
102
+ {
103
+ "package": "@vheins/opencode-9router@latest",
104
+ "options": {
105
+ "baseURL": "http://localhost:20128",
106
+ "apiKey": "{env:ROUTER_API_KEY}",
107
+ "cache": true,
108
+ "cacheTTL": 10800000,
109
+ "discoveryTimeout": 30000
110
+ }
111
+ }
112
+ ]
113
+ }
114
+ ```
115
+
116
+ ### Providers (V2)
117
+
118
+ In V2, providers are declared under the `providers` key. Each 9router-family provider uses the OpenAI-compatible runtime package and carries the endpoint in `settings.baseURL`. The plugin discovers models for every provider whose ID starts with `9router` and fills in the model list.
119
+
120
+ ```jsonc
121
+ {
122
+ "$schema": "https://opencode.ai/config.json",
123
+ "plugins": ["@vheins/opencode-9router@latest"],
124
+ "providers": {
125
+ "9router": {
126
+ "name": "9Router",
127
+ "package": "@opencode/ai/providers/openai-compatible",
128
+ "settings": {
129
+ "baseURL": "http://localhost:20128/v1",
130
+ "apiKey": "{env:ROUTER_API_KEY}"
131
+ }
132
+ },
133
+ "9router-remote": {
134
+ "name": "Remote 9Router",
135
+ "package": "@opencode/ai/providers/openai-compatible",
136
+ "settings": {
137
+ "baseURL": "https://your-9router-endpoint.example.com/v1"
138
+ }
139
+ }
140
+ }
141
+ }
142
+ ```
143
+
144
+ If no 9router-family provider exists, the plugin registers a default `9router` provider pointing at `http://localhost:20128`. A background refresh re-discovers models and calls `ctx.provider.reload()` every 5 minutes; the discovery interval is cleaned up when the plugin unloads.
145
+
146
+ ### Dual V1 + V2 entrypoint
147
+
148
+ The default export exposes both implementations:
149
+
150
+ ```ts
151
+ import { Plugin } from "@opencode/plugin"
152
+ import { NineRouterPlugin } from "./plugin.js" // V1
153
+ import { nineRouterV2 } from "./v2.js" // V2
154
+
155
+ const v2 = Plugin.define(nineRouterV2)
156
+ export default { id: v2.id, setup: v2.setup, server: NineRouterPlugin }
157
+ export { NineRouterPlugin }
158
+ ```
159
+
160
+ V2 reads `id`/`setup`; V1 (1.18.29+) reads `server`. The named `NineRouterPlugin` export is kept for older V1 consumers. For local development, the repository also includes a root `server.js` bridge because OpenCode resolves an absolute plugin directory through its `server` entrypoint. The published package exposes the same entry through the `./server` export.
161
+
162
+ ## Installation
163
+
164
+ ### From npm (recommended)
165
+
166
+ ```json
167
+ {
168
+ "$schema": "https://opencode.ai/config.json",
169
+ "plugin": ["@vheins/opencode-9router@latest"]
170
+ }
171
+ ```
172
+
173
+ No need to define a provider manually — the plugin registers it automatically.
174
+
175
+ ### Automated install (script)
176
+
177
+ The repository ships an interactive installer for bash and PowerShell. It clones
178
+ and builds the plugin locally, verifies the endpoint, and writes the `plugins`
179
+ entry for you.
180
+
181
+ **One-liner** (works once the scripts are committed/pushed):
182
+
183
+ ```bash
184
+ curl -fsSL https://raw.githubusercontent.com/joaogsbarbosa/opencode-9router/main/install.sh | bash
185
+ ```
186
+
187
+ ```powershell
188
+ irm https://raw.githubusercontent.com/joaogsbarbosa/opencode-9router/main/install.ps1 | iex
189
+ ```
190
+
191
+ **From a local checkout:**
192
+
193
+ ```bash
194
+ bash ./install.sh
195
+ # or a specific command
196
+ bash ./install.sh install
197
+ ```
198
+
199
+ ```powershell
200
+ .\install.ps1
201
+ # or a specific command
202
+ .\install.ps1 install
203
+ ```
204
+
205
+ **Commands:** `install`, `update`, `configure`, `uninstall` (interactive menu when run with no argument).
206
+
207
+ **Prompts:** base URL (default `http://localhost:20128`), API key (optional), cache (default `Y`). The connection is verified before installing or configuring.
208
+
209
+ **What it does:**
210
+
211
+ - Clones (or `git pull`) the repo into `~/.local/share/opencode-9router` (Linux/macOS) or `%LOCALAPPDATA%\opencode-9router` (Windows), then runs `npm install` + `npm run build`.
212
+ - Adds `{ "package": "file://...", "options": { ... } }` to the global `opencode.jsonc`.
213
+ - `uninstall` removes the config entry, the local clone, and the plugin cache.
214
+
215
+ Requires `git`, `node`, and `npm`. JSONC comments are not preserved.
216
+
217
+ ### Multiple Providers
218
+
219
+ Add one or more 9Router-family providers with custom options:
220
+
221
+ ```json
222
+ {
223
+ "$schema": "https://opencode.ai/config.json",
224
+ "plugin": ["@vheins/opencode-9router@latest"],
225
+ "provider": {
226
+ "9router": {
227
+ "npm": "@ai-sdk/openai-compatible",
228
+ "name": "Your Provider",
229
+ "options": {
230
+ "baseURL": "https://your-9router-endpoint.example.com/v1",
231
+ "apiKey": "{env:ROUTER_API_KEY}",
232
+ "cache": true,
233
+ "cacheTTL": 10800000,
234
+ "discoveryTimeout": 60000
235
+ }
236
+ },
237
+ "9router-local": {
238
+ "npm": "@ai-sdk/openai-compatible",
239
+ "name": "Local Router",
240
+ "options": {
241
+ "baseURL": "http://127.0.0.1:20128/v1",
242
+ "apiKey": "sk-...",
243
+ "cache": true,
244
+ "discoveryTimeout": 60000
245
+ }
246
+ }
247
+ }
248
+ }
249
+ ```
250
+
251
+ Each provider key must start with `9router`. The `npm` must be `@ai-sdk/openai-compatible`. The `name` is a display label shown in OpenCode.
252
+
253
+ > **Never commit real API keys.** Replace the `baseURL`/`apiKey` above with your own endpoint and a placeholder such as `{env:ROUTER_API_KEY}` (or a dummy value like `sk-...`). Real keys belong in environment variables, not in `opencode.json` or this README.
254
+
255
+ ### With Environment Variable
256
+
257
+ ```json
258
+ {
259
+ "provider": {
260
+ "9router": {
261
+ "npm": "@ai-sdk/openai-compatible",
262
+ "name": "Remote 9Router",
263
+ "options": {
264
+ "baseURL": "https://example.com/v1",
265
+ "apiKey": "{env:ROUTER_API_KEY}",
266
+ "cache": true,
267
+ "discoveryTimeout": 30000
268
+ }
269
+ }
270
+ }
271
+ }
272
+ ```
273
+
274
+ ```bash
275
+ export ROUTER_API_KEY=your-api-key-here
276
+ opencode
277
+ ```
278
+
279
+ ## Provider Options
280
+
281
+ | Option | Type | Default | Description |
282
+ | --------------------- | --------- | ----------- | ------------------------------------------------------ |
283
+ | `baseURL` | `string` | `http://localhost:20128` | 9Router API endpoint |
284
+ | `apiKey` | `string` | — | API key (if required by backend) |
285
+ | `cache` | `boolean` | `true` | Cache discovery results to `~/.cache/opencode-9router/` |
286
+ | `cacheTTL` | `number` | `10800000` (3h) | Cache TTL in milliseconds |
287
+ | `discoveryTimeout` | `number` | `30000` (30s) | Timeout for `/v1/models` request in milliseconds |
288
+
289
+ ### Example with cache and timeout tuning
290
+
291
+ ```json
292
+ {
293
+ "provider": {
294
+ "9router": {
295
+ "npm": "@ai-sdk/openai-compatible",
296
+ "name": "Local Router",
297
+ "options": {
298
+ "baseURL": "http://localhost:20128",
299
+ "cache": true,
300
+ "discoveryTimeout": 60000
301
+ }
302
+ },
303
+ "9router-remote": {
304
+ "npm": "@ai-sdk/openai-compatible",
305
+ "name": "Remote API",
306
+ "options": {
307
+ "baseURL": "https://your-9router-endpoint.example.com/v1",
308
+ "apiKey": "{env:ROUTER_API_KEY}",
309
+ "cacheTTL": 3600000
310
+ }
311
+ }
312
+ }
313
+ }
314
+ ```
315
+
316
+ ### Disable cache
317
+
318
+ ```json
319
+ {
320
+ "provider": {
321
+ "9router": {
322
+ "npm": "@ai-sdk/openai-compatible",
323
+ "name": "Local Router",
324
+ "options": {
325
+ "baseURL": "http://localhost:20128",
326
+ "apiKey": "sk-...",
327
+ "cache": false,
328
+ "discoveryTimeout": 30000
329
+ }
330
+ }
331
+ }
332
+ }
333
+ ```
334
+
335
+ ## Usage
336
+
337
+ ### Select a model
338
+
339
+ ```
340
+ /models
341
+ → Find the 9Router provider
342
+ → Pick any model (e.g., kr/claude-sonnet-4.5, cc/claude-opus-4-7)
343
+ ```
344
+
345
+ ## Model Prefixes
346
+
347
+ | Prefix | Provider | Tier |
348
+ |--------|----------|------|
349
+ | `cc/` | Claude Code | Subscription |
350
+ | `cx/` | Codex | Subscription |
351
+ | `gh/` | GitHub Copilot | Subscription |
352
+ | `cu/` | Cursor IDE | Subscription |
353
+ | `kr/` | Kiro AI | **FREE** |
354
+ | `oc/` | OpenCode Free | **FREE** |
355
+ | `vertex/` | Vertex AI | $300 credits |
356
+ | `glm/` | GLM | $0.6/1M |
357
+ | `minimax/` | MiniMax | $0.2/1M |
358
+ | `kimi/` | Kimi | $9/mo flat |
359
+ | `openrouter/` | OpenRouter | API key |
360
+ | `deepseek/` | DeepSeek | API key |
361
+ | `groq/` | Groq | API key |
362
+
363
+ ## How It Works
364
+
365
+ ```
366
+ opencode.json "plugin": ["@vheins/opencode-9router@latest"]
367
+ ↓
368
+ Plugin loads at startup detects 9Router-family providers in config
369
+ ↓
370
+ For each provider:
371
+ 1. Check local cache (~/.cache/opencode-9router/discovery-*.json)
372
+ └─ Fresh cache (≤3h) → return cached models instantly
373
+ 2. If cache miss/stale:
374
+ └─ GET {baseURL}/v1/models with 30s timeout (configurable)
375
+ └─ If OK → register live models + save to cache
376
+ └─ If fail → fallback to stale cache (if exists), else skip
377
+ ↓
378
+ config hook creates/updates provider with discovered models
379
+ ↓
380
+ Provider appears in /models
381
+ ```
382
+
383
+ ### Cache storage
384
+
385
+ Cache files are stored at `~/.cache/opencode-9router/discovery-{base64url}.json`, one per unique `baseURL`. The cache directory also stores the models.dev capability catalog (`models-dev.json`).
386
+
387
+ ## Changelog
388
+
389
+ ### v0.9.1 — V2 model registration for configured providers
390
+ - Fix V2 plugin setup ordering: external plugins run before OpenCode's internal config-provider plugin, so config-defined `9router*` providers are not visible during setup
391
+ - Register a model transform (`ctx.model.transform`) that injects the discovered inventory into providers once they become available
392
+ - Refresh targets after setup with bounded retries and `provider.updated` events, then `ctx.model.reload()`
393
+ - Add a root `server.js` entrypoint and `./server` package export so an absolute local plugin path resolves
394
+ - Add `test-v2.mjs` covering the package entrypoint and the late config-provider lifecycle
395
+
396
+ ### v0.9.0 — OpenCode V2 support (dual V1 + V2)
397
+ - Add a 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()`
398
+ - Add `src/v2-map.ts` mapping the discovered `ModelConfig` onto V2 `Model.Info` (capabilities, required `limit.context`/`limit.output`, variants)
399
+ - Add `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
400
+ - Package entry (`exports`, `main`, `types`) now points at `dist/index.js` / `dist/index.d.ts`
401
+ - `@opencode/plugin@^2.0.12` added as a runtime dependency; `@opencode-ai/plugin` / `@opencode-ai/sdk` kept for V1 types
402
+ - V1 behavior unchanged; discovery/capability/cache algorithms untouched
403
+
404
+ ### v0.8.1 — Strict combo enrichment
405
+ - Combos count as enriched only on an **exact** models.dev segment match (no more loose substring hits like `vision` → `gpt-4-turbo-vision`)
406
+ - Ignore bare `/models/info` capability stubs (`{tools: true}`) for combos, so backends that return stubs still get forced multimodal defaults
407
+
408
+ ### v0.8.0 — Combo multimodal defaults
409
+ - Detect combo models via `owned_by: "combo"` (fallback: no provider prefix)
410
+ - Force multimodal defaults on combos with no resolved capability info: text/image/audio input, tool calling, reasoning, 256K context, 128K output
411
+ - Add `low`/`medium`/`high`/`xhigh`/`max`/`minimal`/`thinking` variants, plus `search: false`, `context_length`, and `max_completion_tokens`
412
+ - Version discovery cache so older entries are refetched
413
+
414
+ ### v0.7.1 — Discovery logging
415
+ - Add INFO-level logging for cache hit/miss, fetch status, timeout, and stale fallback
416
+
417
+ ### v0.7.0 — Caching & timeout
418
+ - **Model discovery cache** — 3-hour TTL with stale fallback when backend is unreachable
419
+ - **Configurable timeout** — 30s default, adjustable via `discoveryTimeout` option
420
+ - **Provider options** — `cache`, `cacheTTL`, `discoveryTimeout`
421
+ - New constant: `DISCOVERY_CACHE_TTL`, `DISCOVERY_TIMEOUT`
422
+
423
+ ### v0.6.0 — Multi-provider & fallback
424
+ - Support multiple 9Router-family providers (`9router`, `9router-local`, etc.)
425
+ - Fallback models catalog via `models.dev` API
426
+ - Per-model capability resolution (vision, tools, reasoning)
427
+
428
+ ### v0.5.x — Initial releases
429
+ - Basic auto-discovery from `localhost:20128`
430
+ - Fallback models when API unreachable
431
+ - Single provider support
432
+
433
+ ## Development
434
+
435
+ ```bash
436
+ git clone https://github.com/vheins/opencode-9router
437
+ cd opencode-9router
438
+ npm install
439
+ npm run build
440
+ ```
441
+
442
+ ### Test
443
+
444
+ ```bash
445
+ node test-minimal.mjs
446
+ opencode models 9router --print-logs
447
+ ```
448
+
449
+ ### Validate after publish
450
+
451
+ After publishing to npm, verify the plugin works end-to-end:
452
+
453
+ ```bash
454
+ opencode models 9router-local --print-logs --log-level DEBUG
455
+ ```
456
+
457
+ This runs model discovery against the published package with full debug logging to confirm caching, timeout, and capability resolution are working correctly.
458
+
459
+ ### Publish
460
+
461
+ ```bash
462
+ npm login
463
+ npm version patch # or minor, major
464
+ npm publish --access public
465
+ git push --follow-tags
466
+ ```
467
+
468
+ ## Files
469
+
470
+ ```
471
+ opencode-9router/
472
+ src/
473
+ index.ts # Dual V1 + V2 package entry
474
+ plugin.ts # V1 plugin entry (provider registration + config hook)
475
+ v2.ts # V2 plugin entry (Plugin.define + provider transform)
476
+ v2-map.ts # V1 ModelConfig → V2 Model.Info mapping
477
+ discovery.ts # Model discovery pipeline
478
+ capabilities.ts # Capability resolution (catalog + per-model API)
479
+ cache.ts # Discovery + models.dev cache
480
+ reasoning.ts # Catalog reasoning options (effort + toggle) from models.dev
481
+ types.ts # Shared types
482
+ utils.ts # Shared helpers
483
+ constants.ts # Models, defaults, prefixes
484
+ dist/ # Compiled output (generated)
485
+ install.sh # Linux/macOS installer (bash)
486
+ install.ps1 # Windows installer (PowerShell)
487
+ package.json # npm package config
488
+ tsconfig.json # TypeScript config
489
+ README.md # This file
490
+ README.id.md # Bahasa Indonesia version
491
+ LICENSE # MIT
492
+ ```
493
+
494
+ ## Related Projects
495
+
496
+ - [local-memory-mcp](https://github.com/vheins/local-memory-mcp) — A lightweight MCP server that gives AI agents persistent memory with semantic search, backed by SQLite. Local-first, with domain-based context isolation and no external database. Available on [npm](https://www.npmjs.com/package/@vheins/local-memory-mcp).
497
+
498
+ - [RustaSea framework](https://github.com/rustasea/framework) — An expressive, Laravel-inspired web framework for Rust, with Rust-native safety, performance, and concurrency.
499
+ - [RustaSea skeleton](https://github.com/rustasea/rustasea) — The RustaSea application skeleton (Blade variant), scaffolded with `cargo rustasea new`.
500
+
501
+ ## Links
502
+
503
+ - [OpenCode Plugin Docs](https://opencode.ai/docs/plugins/)
504
+ - [OpenCode Custom Provider](https://opencode.ai/docs/providers/#custom-provider)
505
+ - [9Router GitHub](https://github.com/decolua/9router)
506
+ - [9Router Website](https://9router.com)
@@ -0,0 +1,28 @@
1
+ import type { ModelConfig, ModelsDevEntry } from "./types.js";
2
+ /**
3
+ * Read a valid (fresh) discovery cache entry.
4
+ * Returns `null` if missing, stale, or corrupted.
5
+ */
6
+ export declare function readDiscoveryCache(baseURL: string, ttl: number, providerKey: string): Record<string, ModelConfig> | null;
7
+ /**
8
+ * Read a stale (expired) discovery cache entry as fallback.
9
+ */
10
+ export declare function readStaleDiscoveryCache(baseURL: string, providerKey: string): Record<string, ModelConfig> | null;
11
+ /**
12
+ * Persist discovery results to cache (best-effort).
13
+ */
14
+ export declare function writeDiscoveryCache(baseURL: string, models: Record<string, ModelConfig>, providerKey: string): void;
15
+ /**
16
+ * Fetch the models.dev capability catalog, cached for MODELS_DEV_CACHE_TTL.
17
+ * Returns the flattened entry list, or `null` when the catalog is unreachable
18
+ * and no fresh cache exists.
19
+ */
20
+ export declare function fetchModelsDevCatalog(): Promise<ModelsDevEntry[] | null>;
21
+ /**
22
+ * models.dev/api.json returns a dict of providers, each with a nested
23
+ * models dict. Flatten into a list of entries preserving catalogProvider
24
+ * for exact matching in reasoning control lookup.
25
+ */
26
+ export declare function flattenModelsDevCatalog(raw: Record<string, {
27
+ models?: Record<string, ModelsDevEntry>;
28
+ }>): ModelsDevEntry[];