@plurnk/plurnk-models 1.3.12 → 1.4.0

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,35 +1,63 @@
1
1
  # @plurnk/plurnk-models
2
2
 
3
- A build-time-vendored snapshot of model metadata — **context window + per-token pricing** — sourced from [models.dev](https://models.dev/). Consumed by [plurnk-providers](https://github.com/plurnk/plurnk-providers) and clients.
3
+ A release-time snapshot of provider and model metadata from
4
+ [Models.dev](https://models.dev/). `@plurnk/plurnk-providers` uses it to
5
+ construct cataloged providers and resolve model facts without a Models.dev
6
+ request during installation or runtime. Clients may use the same snapshot for
7
+ model discovery.
4
8
 
5
- ## Fallback only — live data wins
6
-
7
- This snapshot is a **last resort**, never a primary source. A backend's probed context window and a provider's fetched per-token pricing are ground truth and can change; a vendored snapshot must never shadow them — especially cost. Consumers resolve in this order:
9
+ ## Data
8
10
 
9
- ```
10
- env override → live probe / live pricing fetch → THIS catalog → null
11
- ```
11
+ The generated snapshot retains only the facts PLURNK consumes:
12
12
 
13
- The catalog only fills the gap for a known cloud model whose endpoint doesn't self-report (e.g. a relay model behind `openrouter`). A local model (`macher.gguf` on llama-server) is a deliberate **miss** — the probe owns that.
13
+ | Lookup | Snapshot facts |
14
+ | ------------------ | ---------------------------------------------------------------------- |
15
+ | `lookupProvider()` | Provider id, AI SDK package, credential names, and optional API URL. |
16
+ | `lookup()` | Context window, optional output limit, reasoning flag, and USD prices. |
14
17
 
15
- ## Use
18
+ Model entries without a positive context window are omitted. `reasoning: true`
19
+ means the source asserted that capability; absence does not activate or disable
20
+ runtime reasoning. A missing cost means Models.dev supplied no complete
21
+ input/output rate pair.
16
22
 
17
23
  ```ts
18
24
  import { lookup } from "@plurnk/plurnk-models";
19
25
 
20
26
  const info = lookup("openrouter", "anthropic/claude-sonnet-4");
21
- // → { contextWindow: 1000000, cost: { inputPer1M: 3, outputPer1M: 15, cacheReadPer1M: 0.3, cacheWritePer1M: 3.75 } }
27
+ // → {
28
+ // contextWindow: 1_000_000,
29
+ // maxOutput: 64_000,
30
+ // reasoning: true,
31
+ // cost: {
32
+ // inputPer1M: 3,
33
+ // outputPer1M: 15,
34
+ // cacheReadPer1M: 0.3,
35
+ // cacheWritePer1M: 3.75,
36
+ // },
37
+ // }
22
38
  // miss → null
23
39
  ```
24
40
 
25
- `provider` is the plurnk provider name (the alias-cascade segment); `model` is the provider-native id (for relays, `publisher/model`). `catalogSnapshot()` returns the whole read-only map for a client's model picker.
41
+ `provider` is the PLURNK provider name. `model` is the provider-native id; for
42
+ relays this is commonly `publisher/model`. `resolveModel()` also accepts an
43
+ unambiguous provider-native suffix. `catalogSnapshot()` and
44
+ `providerCatalogSnapshot()` expose the complete read-only maps.
26
45
 
27
- ## Data
46
+ ## Resolution boundary
28
47
 
29
- Pruned to the two fields plurnk uses, across plurnk's supported providers only (~620 models, ~64 KB). Four provider names diverge from models.dev's ids (`together→togetherai`, `fireworks→fireworks-ai`, `cloudflare→cloudflare-workers-ai`, `ollama→ollama-cloud`); the rest are identity.
48
+ This package owns snapshot generation and lookup, not runtime precedence.
49
+ Context windows, output envelopes, reasoning activation, and prices resolve by
50
+ different rules in the provider contract ({§model-fact-resolution}). In
51
+ particular, PLURNK does not fetch live per-token prices.
30
52
 
31
- **No network at install or runtime** — the snapshot is committed. Refresh on the release cadence:
53
+ ## Refresh
32
54
 
55
+ The committed snapshot is refreshed deliberately at release time:
56
+
57
+ ```sh
58
+ npm run generate
33
59
  ```
34
- npm run generate # fetch models.dev/api.json → prune → src/catalog.json
35
- ```
60
+
61
+ That command fetches `https://models.dev/api.json`, retains providers whose AI
62
+ SDK package PLURNK supports, prunes the model facts, and rewrites the two source
63
+ JSON files.