modelrig 0.1.0 → 0.2.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.
Files changed (309) hide show
  1. package/CHANGELOG.md +94 -0
  2. package/README.md +41 -11
  3. package/data/PROVENANCE.md +19 -0
  4. package/data/pricing-manual.json +22 -0
  5. package/data/pricing-map.json +46362 -0
  6. package/data/pricing-overlay.json +419 -0
  7. package/dist/adapters/anthropic.d.ts +50 -6
  8. package/dist/adapters/anthropic.d.ts.map +1 -1
  9. package/dist/adapters/anthropic.js +123 -29
  10. package/dist/adapters/build-adapters.d.ts +11 -0
  11. package/dist/adapters/build-adapters.d.ts.map +1 -0
  12. package/dist/adapters/build-adapters.js +45 -0
  13. package/dist/adapters/deepseek.d.ts +6 -0
  14. package/dist/adapters/deepseek.d.ts.map +1 -1
  15. package/dist/adapters/deepseek.js +54 -1
  16. package/dist/adapters/gemini.d.ts.map +1 -1
  17. package/dist/adapters/gemini.js +46 -6
  18. package/dist/adapters/grok.d.ts +9 -0
  19. package/dist/adapters/grok.d.ts.map +1 -1
  20. package/dist/adapters/grok.js +67 -3
  21. package/dist/adapters/openai-compat.d.ts +6 -0
  22. package/dist/adapters/openai-compat.d.ts.map +1 -1
  23. package/dist/adapters/openai-compat.js +58 -1
  24. package/dist/adapters/openai-stream.d.ts +58 -0
  25. package/dist/adapters/openai-stream.d.ts.map +1 -0
  26. package/dist/adapters/openai-stream.js +120 -0
  27. package/dist/adapters/openai.d.ts +6 -0
  28. package/dist/adapters/openai.d.ts.map +1 -1
  29. package/dist/adapters/openai.js +60 -1
  30. package/dist/adapters/sampling.d.ts +28 -0
  31. package/dist/adapters/sampling.d.ts.map +1 -0
  32. package/dist/adapters/sampling.js +34 -0
  33. package/dist/adapters/tool-mapping.d.ts +92 -0
  34. package/dist/adapters/tool-mapping.d.ts.map +1 -0
  35. package/dist/adapters/tool-mapping.js +143 -0
  36. package/dist/artifacts/artifact.d.ts +137 -0
  37. package/dist/artifacts/artifact.d.ts.map +1 -0
  38. package/dist/artifacts/artifact.js +377 -0
  39. package/dist/artifacts/content-uploader.d.ts +87 -0
  40. package/dist/artifacts/content-uploader.d.ts.map +1 -0
  41. package/dist/artifacts/content-uploader.js +124 -0
  42. package/dist/artifacts/index.d.ts +63 -0
  43. package/dist/artifacts/index.d.ts.map +1 -0
  44. package/dist/artifacts/index.js +80 -0
  45. package/dist/artifacts/run-context.d.ts +129 -0
  46. package/dist/artifacts/run-context.d.ts.map +1 -0
  47. package/dist/artifacts/run-context.js +208 -0
  48. package/dist/artifacts/scrub.d.ts +60 -0
  49. package/dist/artifacts/scrub.d.ts.map +1 -0
  50. package/dist/artifacts/scrub.js +139 -0
  51. package/dist/artifacts/step.d.ts +26 -0
  52. package/dist/artifacts/step.d.ts.map +1 -0
  53. package/dist/artifacts/step.js +37 -0
  54. package/dist/artifacts/taint.d.ts +63 -0
  55. package/dist/artifacts/taint.d.ts.map +1 -0
  56. package/dist/artifacts/taint.js +76 -0
  57. package/dist/bakeoff/cache-sim.d.ts +99 -0
  58. package/dist/bakeoff/cache-sim.d.ts.map +1 -0
  59. package/dist/bakeoff/cache-sim.js +126 -0
  60. package/dist/bakeoff/eval-cases.d.ts +96 -0
  61. package/dist/bakeoff/eval-cases.d.ts.map +1 -0
  62. package/dist/bakeoff/eval-cases.js +105 -0
  63. package/dist/bakeoff/report.d.ts +41 -0
  64. package/dist/bakeoff/report.d.ts.map +1 -0
  65. package/dist/bakeoff/report.js +142 -0
  66. package/dist/bakeoff/samples.d.ts +15 -0
  67. package/dist/bakeoff/samples.d.ts.map +1 -1
  68. package/dist/bakeoff/samples.js +20 -0
  69. package/dist/cli.d.ts +1 -3
  70. package/dist/cli.d.ts.map +1 -1
  71. package/dist/cli.js +134 -116
  72. package/dist/config.d.ts +100 -0
  73. package/dist/config.d.ts.map +1 -1
  74. package/dist/config.js +104 -0
  75. package/dist/deprecations.d.ts +32 -0
  76. package/dist/deprecations.d.ts.map +1 -0
  77. package/dist/deprecations.js +59 -0
  78. package/dist/gateway/http-protocol.d.ts +175 -0
  79. package/dist/gateway/http-protocol.d.ts.map +1 -0
  80. package/dist/gateway/http-protocol.js +105 -0
  81. package/dist/index.d.ts +105 -18
  82. package/dist/index.d.ts.map +1 -1
  83. package/dist/index.js +266 -138
  84. package/dist/init/finder.d.ts +15 -0
  85. package/dist/init/finder.d.ts.map +1 -1
  86. package/dist/init/finder.js +46 -0
  87. package/dist/init/init-cli.d.ts +10 -0
  88. package/dist/init/init-cli.d.ts.map +1 -0
  89. package/dist/init/init-cli.js +86 -0
  90. package/dist/init/observe-cli.d.ts +19 -0
  91. package/dist/init/observe-cli.d.ts.map +1 -0
  92. package/dist/init/observe-cli.js +73 -0
  93. package/dist/init/observe.d.ts +81 -0
  94. package/dist/init/observe.d.ts.map +1 -0
  95. package/dist/init/observe.js +245 -0
  96. package/dist/registry/build.d.ts +94 -1
  97. package/dist/registry/build.d.ts.map +1 -1
  98. package/dist/registry/build.js +125 -4
  99. package/dist/registry/cache-policy.d.ts +94 -0
  100. package/dist/registry/cache-policy.d.ts.map +1 -0
  101. package/dist/registry/cache-policy.js +238 -0
  102. package/dist/registry/call-notes.d.ts.map +1 -1
  103. package/dist/registry/call-notes.js +40 -2
  104. package/dist/registry/effective-rate.d.ts +151 -0
  105. package/dist/registry/effective-rate.d.ts.map +1 -0
  106. package/dist/registry/effective-rate.js +156 -0
  107. package/dist/registry/facts.d.ts.map +1 -1
  108. package/dist/registry/facts.js +16 -0
  109. package/dist/registry/parity.d.ts +26 -0
  110. package/dist/registry/parity.d.ts.map +1 -1
  111. package/dist/registry/parity.js +43 -2
  112. package/dist/registry/pricing-shape.d.ts +113 -0
  113. package/dist/registry/pricing-shape.d.ts.map +1 -0
  114. package/dist/registry/pricing-shape.js +123 -0
  115. package/dist/registry/pricing.d.ts +25 -1
  116. package/dist/registry/pricing.d.ts.map +1 -1
  117. package/dist/registry/pricing.js +64 -6
  118. package/dist/rigindex/bootstrap.d.ts +36 -0
  119. package/dist/rigindex/bootstrap.d.ts.map +1 -0
  120. package/dist/rigindex/bootstrap.js +97 -0
  121. package/dist/rigindex/fit.d.ts +24 -0
  122. package/dist/rigindex/fit.d.ts.map +1 -0
  123. package/dist/rigindex/fit.js +76 -0
  124. package/dist/rigindex/gates.d.ts +52 -0
  125. package/dist/rigindex/gates.d.ts.map +1 -0
  126. package/dist/rigindex/gates.js +109 -0
  127. package/dist/rigindex/graph.d.ts +31 -0
  128. package/dist/rigindex/graph.d.ts.map +1 -0
  129. package/dist/rigindex/graph.js +120 -0
  130. package/dist/rigindex/index.d.ts +23 -0
  131. package/dist/rigindex/index.d.ts.map +1 -0
  132. package/dist/rigindex/index.js +112 -0
  133. package/dist/rigindex/types.d.ts +76 -0
  134. package/dist/rigindex/types.d.ts.map +1 -0
  135. package/dist/rigindex/types.js +8 -0
  136. package/dist/routes/cache-lint.d.ts +41 -0
  137. package/dist/routes/cache-lint.d.ts.map +1 -0
  138. package/dist/routes/cache-lint.js +81 -0
  139. package/dist/routes/loader.d.ts +37 -0
  140. package/dist/routes/loader.d.ts.map +1 -1
  141. package/dist/routes/loader.js +138 -0
  142. package/dist/routes/resolved-bundle.d.ts +79 -0
  143. package/dist/routes/resolved-bundle.d.ts.map +1 -0
  144. package/dist/routes/resolved-bundle.js +148 -0
  145. package/dist/routes/sampling-config.d.ts +32 -0
  146. package/dist/routes/sampling-config.d.ts.map +1 -0
  147. package/dist/routes/sampling-config.js +91 -0
  148. package/dist/run/ajv.d.ts +22 -0
  149. package/dist/run/ajv.d.ts.map +1 -0
  150. package/dist/run/ajv.js +32 -0
  151. package/dist/run/cache-handle.d.ts +58 -0
  152. package/dist/run/cache-handle.d.ts.map +1 -0
  153. package/dist/run/cache-handle.js +54 -0
  154. package/dist/run/cache-stamp.d.ts +65 -0
  155. package/dist/run/cache-stamp.d.ts.map +1 -0
  156. package/dist/run/cache-stamp.js +0 -0
  157. package/dist/run/capture-write.d.ts +33 -0
  158. package/dist/run/capture-write.d.ts.map +1 -0
  159. package/dist/run/capture-write.js +55 -0
  160. package/dist/run/cost.d.ts.map +1 -1
  161. package/dist/run/cost.js +1 -1
  162. package/dist/run/dispatch.d.ts +99 -0
  163. package/dist/run/dispatch.d.ts.map +1 -0
  164. package/dist/run/dispatch.js +191 -0
  165. package/dist/run/raw.d.ts +88 -0
  166. package/dist/run/raw.d.ts.map +1 -0
  167. package/dist/run/raw.js +286 -0
  168. package/dist/run/record-attempt.d.ts +40 -0
  169. package/dist/run/record-attempt.d.ts.map +1 -0
  170. package/dist/run/record-attempt.js +99 -0
  171. package/dist/run/resolve.d.ts +75 -2
  172. package/dist/run/resolve.d.ts.map +1 -1
  173. package/dist/run/resolve.js +126 -4
  174. package/dist/run/run.d.ts +14 -0
  175. package/dist/run/run.d.ts.map +1 -1
  176. package/dist/run/run.js +0 -0
  177. package/dist/run/stream.d.ts +49 -0
  178. package/dist/run/stream.d.ts.map +1 -0
  179. package/dist/run/stream.js +87 -0
  180. package/dist/run/validate.d.ts.map +1 -1
  181. package/dist/run/validate.js +6 -7
  182. package/dist/savings/cache-ledger.d.ts +108 -0
  183. package/dist/savings/cache-ledger.d.ts.map +1 -0
  184. package/dist/savings/cache-ledger.js +174 -0
  185. package/dist/savings/cache-reconcile.d.ts +64 -0
  186. package/dist/savings/cache-reconcile.d.ts.map +1 -0
  187. package/dist/savings/cache-reconcile.js +59 -0
  188. package/dist/savings/cache-stats.d.ts +63 -0
  189. package/dist/savings/cache-stats.d.ts.map +1 -0
  190. package/dist/savings/cache-stats.js +108 -0
  191. package/dist/savings/emit.d.ts +13 -0
  192. package/dist/savings/emit.d.ts.map +1 -1
  193. package/dist/savings/emit.js +25 -0
  194. package/dist/savings/swap-execute.d.ts +14 -0
  195. package/dist/savings/swap-execute.d.ts.map +1 -1
  196. package/dist/savings/swap-execute.js +44 -1
  197. package/dist/savings/swaps-client.d.ts +14 -0
  198. package/dist/savings/swaps-client.d.ts.map +1 -1
  199. package/dist/savings/swaps-client.js +16 -2
  200. package/dist/settings/api-fetcher.d.ts +39 -0
  201. package/dist/settings/api-fetcher.d.ts.map +1 -0
  202. package/dist/settings/api-fetcher.js +92 -0
  203. package/dist/settings/index.d.ts +10 -0
  204. package/dist/settings/index.d.ts.map +1 -0
  205. package/dist/settings/index.js +15 -0
  206. package/dist/settings/task-settings.d.ts +91 -0
  207. package/dist/settings/task-settings.d.ts.map +1 -0
  208. package/dist/settings/task-settings.js +116 -0
  209. package/dist/status.d.ts +77 -0
  210. package/dist/status.d.ts.map +1 -0
  211. package/dist/status.js +113 -0
  212. package/dist/telemetry/artifact-store.d.ts +48 -0
  213. package/dist/telemetry/artifact-store.d.ts.map +1 -0
  214. package/dist/telemetry/artifact-store.js +189 -0
  215. package/dist/telemetry/cache-miss-streak.d.ts +79 -0
  216. package/dist/telemetry/cache-miss-streak.d.ts.map +1 -0
  217. package/dist/telemetry/cache-miss-streak.js +99 -0
  218. package/dist/telemetry/capture.d.ts +3 -0
  219. package/dist/telemetry/capture.d.ts.map +1 -1
  220. package/dist/telemetry/capture.js +15 -8
  221. package/dist/telemetry/exporter-setup.d.ts +28 -0
  222. package/dist/telemetry/exporter-setup.d.ts.map +1 -0
  223. package/dist/telemetry/exporter-setup.js +34 -0
  224. package/dist/telemetry/exporter.d.ts +75 -0
  225. package/dist/telemetry/exporter.d.ts.map +1 -1
  226. package/dist/telemetry/exporter.js +324 -47
  227. package/dist/telemetry/health.d.ts +76 -0
  228. package/dist/telemetry/health.d.ts.map +1 -0
  229. package/dist/telemetry/health.js +92 -0
  230. package/dist/telemetry/ingest-protocol.d.ts +152 -3
  231. package/dist/telemetry/ingest-protocol.d.ts.map +1 -1
  232. package/dist/telemetry/ingest-protocol.js +204 -4
  233. package/dist/telemetry/load-error-report.d.ts +24 -0
  234. package/dist/telemetry/load-error-report.d.ts.map +1 -0
  235. package/dist/telemetry/load-error-report.js +50 -0
  236. package/dist/telemetry/otel-map.d.ts +121 -0
  237. package/dist/telemetry/otel-map.d.ts.map +1 -0
  238. package/dist/telemetry/otel-map.js +224 -0
  239. package/dist/telemetry/otel-normalize.d.ts +104 -0
  240. package/dist/telemetry/otel-normalize.d.ts.map +1 -0
  241. package/dist/telemetry/otel-normalize.js +530 -0
  242. package/dist/telemetry/otlp-emitter.d.ts +52 -0
  243. package/dist/telemetry/otlp-emitter.d.ts.map +1 -0
  244. package/dist/telemetry/otlp-emitter.js +144 -0
  245. package/dist/telemetry/otlp-proto.d.ts +29 -0
  246. package/dist/telemetry/otlp-proto.d.ts.map +1 -0
  247. package/dist/telemetry/otlp-proto.js +266 -0
  248. package/dist/telemetry/sinks.d.ts +37 -1
  249. package/dist/telemetry/sinks.d.ts.map +1 -1
  250. package/dist/telemetry/sinks.js +121 -30
  251. package/dist/telemetry/store.d.ts +28 -1
  252. package/dist/telemetry/store.d.ts.map +1 -1
  253. package/dist/telemetry/store.js +218 -3
  254. package/dist/tenancy/api-key-format.d.ts +15 -5
  255. package/dist/tenancy/api-key-format.d.ts.map +1 -1
  256. package/dist/tenancy/api-key-format.js +24 -5
  257. package/dist/types/config-teaching.d.ts +62 -0
  258. package/dist/types/config-teaching.d.ts.map +1 -0
  259. package/dist/types/config-teaching.js +183 -0
  260. package/dist/types/provider.d.ts +122 -1
  261. package/dist/types/provider.d.ts.map +1 -1
  262. package/dist/types/provider.js +21 -1
  263. package/dist/types/route.d.ts +79 -1
  264. package/dist/types/route.d.ts.map +1 -1
  265. package/dist/types/telemetry.d.ts +117 -0
  266. package/dist/types/telemetry.d.ts.map +1 -1
  267. package/dist/validate-cli.d.ts +12 -0
  268. package/dist/validate-cli.d.ts.map +1 -0
  269. package/dist/validate-cli.js +57 -0
  270. package/dist/verify/capture.d.ts +66 -0
  271. package/dist/verify/capture.d.ts.map +1 -0
  272. package/dist/verify/capture.js +180 -0
  273. package/dist/verify/cli-run.d.ts +23 -0
  274. package/dist/verify/cli-run.d.ts.map +1 -0
  275. package/dist/verify/cli-run.js +57 -0
  276. package/dist/verify/diff.d.ts +48 -0
  277. package/dist/verify/diff.d.ts.map +1 -0
  278. package/dist/verify/diff.js +157 -0
  279. package/dist/verify/index.d.ts +17 -0
  280. package/dist/verify/index.d.ts.map +1 -0
  281. package/dist/verify/index.js +24 -0
  282. package/dist/verify/report.d.ts +14 -0
  283. package/dist/verify/report.d.ts.map +1 -0
  284. package/dist/verify/report.js +88 -0
  285. package/dist/verify/types.d.ts +101 -0
  286. package/dist/verify/types.d.ts.map +1 -0
  287. package/dist/verify/types.js +17 -0
  288. package/dist/verify/verify.d.ts +29 -0
  289. package/dist/verify/verify.d.ts.map +1 -0
  290. package/dist/verify/verify.js +148 -0
  291. package/dist/watch/evaluate.d.ts +162 -3
  292. package/dist/watch/evaluate.d.ts.map +1 -1
  293. package/dist/watch/evaluate.js +61 -0
  294. package/dist/watch/monitor.d.ts +116 -0
  295. package/dist/watch/monitor.d.ts.map +1 -0
  296. package/dist/watch/monitor.js +199 -0
  297. package/dist/watch/proposals.d.ts +20 -4
  298. package/dist/watch/proposals.d.ts.map +1 -1
  299. package/dist/watch/proposals.js +31 -3
  300. package/dist/watch/run.d.ts +33 -0
  301. package/dist/watch/run.d.ts.map +1 -1
  302. package/dist/watch/run.js +39 -0
  303. package/package.json +7 -1
  304. package/registry/LICENSE +20 -0
  305. package/registry/leaderboard.json +3639 -0
  306. package/registry/registry.json +7263 -0
  307. package/dist/telemetry/supabase-exporter.d.ts +0 -64
  308. package/dist/telemetry/supabase-exporter.d.ts.map +0 -1
  309. package/dist/telemetry/supabase-exporter.js +0 -211
package/CHANGELOG.md ADDED
@@ -0,0 +1,94 @@
1
+ # Changelog
2
+
3
+ All notable changes to the `modelrig` npm package are recorded here. The public
4
+ surface is one thing with two halves — this package and the docs/registry site
5
+ at [modelrig.dev](https://modelrig.dev). They ship together under one release
6
+ ceremony (see `docs/ModelRig/oss-publish-policy.md`, §6). The generated docs
7
+ carry an "as of modelrig vX.Y.Z" stamp so a reader can see when the docs and the
8
+ published package diverge.
9
+
10
+ This project adheres to [Semantic Versioning](https://semver.org/). Dates are
11
+ UTC.
12
+
13
+ ## [0.2.0] — unreleased (staged for the R-A ceremony)
14
+
15
+ - Ships the probed capability registry and leaderboard (`registry/registry.json`, `registry/leaderboard.json`) so a clean install routes on the probed profile instead of the static fallback (R-1 F2 ruling). The `modelrig-oracle` MCP server remains unreleased and is flagged as such in the docs.
16
+
17
+ `0.1.0` was frozen on 2026-08-07 and shipped **dist-only** (`files: [dist,
18
+ README, LICENSE]`). The SDK grew a large public surface across the following six
19
+ weeks while the published artifact stood still, and one runtime dependency —
20
+ `data/` — was never in the tarball at all. This release makes the published
21
+ package match the workspace and self-tests that it does.
22
+
23
+ ### Fixed — packaging (the reason for this release)
24
+
25
+ - **`data/` now ships.** `getPricing()` reads `data/pricing-map.json` (and the
26
+ optional `data/pricing-overlay.json`) from the package root at runtime, with
27
+ no `existsSync` guard — so on `0.1.0` the very first cost lookup threw
28
+ `ENOENT` on a clean `npm i modelrig`, breaking the flagship "effective cost"
29
+ story out of the box. `data` is now in the `files` allowlist. It is public
30
+ pricing data (CC BY 4.0; see `data/PROVENANCE.md`), safe to distribute.
31
+ - **Regression pinned forever.** A new hermetic test (`npm pack` → install the
32
+ tarball into a temp dir → load the *installed* package) asserts
33
+ `getPricing()` returns a real rate and the `modelrig` bin runs. Packaging
34
+ breaks are now caught before publish, not by a customer.
35
+ - **`modelrig --help` / `-h` / `help` exit 0** with usage on stdout (was: fell
36
+ through to the unknown-command path and exited 1).
37
+
38
+ ### Added — public API surface accumulated since 0.1.0
39
+
40
+ None of the below existed in the published `0.1.0`; instructions written for the
41
+ current docs failed against it with missing exports. They are all in this tag:
42
+
43
+ - **Inspectable artifact store** — the `artifacts` namespace (runs → steps →
44
+ artifacts, lineaged and integrity-hashed), `resolveArtifactsConfig`,
45
+ per-artifact and per-run evaluation (`artifact.evaluate` / `run.evaluate`).
46
+ - **Run verdicts** — the automatic deterministic `run-outcome@v1` on every run,
47
+ the explicit bounded model judge `run-judge@v1` (`modelrig judge <runId>`),
48
+ and the feedback protocol (`rig.feedback`, `POST /v1/feedback`,
49
+ `computeCoverage`).
50
+ - **Cache accounting & routing** — cache-aware `estimateCostUsd` (cache-read
51
+ and cache-write buckets), `effectiveInputRate` / `classifyCacheVerdict`, the
52
+ `cache: auto` route directive with the miss-streak alert, and the customer
53
+ cache-handle pass-through `rig.run(task, { input, cache: { key, provider } })`
54
+ / `rig.runRaw({ …, cache: { key } })` (CE-1) — the customer owns the TTL
55
+ heartbeat; ModelRig never creates, refreshes, or deletes the resource.
56
+ - **Observe / init (T0–T2)** — `modelrig observe` (scaffold the record-step seam
57
+ behind `MODELRIG_ARTIFACTS=1`, no route migration), `modelrig init --scope`
58
+ (draft a route bundle per call site), `modelrig validate` (keyless structural
59
+ check of `rig.yaml` + every bundle), and `modelrig verify-swap`
60
+ (shadow-equivalence report for a same-model swap).
61
+ - **Route sampling params (CE-6)** — `policy.sampling: { temperature?, top_p?,
62
+ max_output_tokens? }` on a route, validated at load and sent to the provider
63
+ as declared; a sub-1.0 temperature on a Gemini-3 candidate loads with a
64
+ load-time advisory. **This is in the tag.**
65
+ - **OTLP ingest** — bring your own traces (`normalizeOtlpTraces`,
66
+ `startOtlpEmitterIfConfigured`, the OTel semantic-convention map).
67
+ - **Raw lane** (`runRaw` / `runRawStream`), streaming (`runStream`), the
68
+ grounding-inject rung, the `openai-compat` adapter host, and the Anthropic /
69
+ Grok adapters.
70
+ - **Bake-offs & the optimization loop** — `runBakeoff`, `replayVariant`,
71
+ `computeProposal`, the Wilson-interval stats, the swap ledger + verified-
72
+ savings odometer, and the scheduled Rig Analyst Insights surface.
73
+
74
+ ### Fixed — behaviour
75
+
76
+ - **H1 close-drain.** `rig.close()` now resolves only after the exporter's final
77
+ flush drains and after the artifacts streams drain (stores close last), so a
78
+ one-shot CLI or a serverless per-invocation `close()` can no longer lose the
79
+ last rows. One-shot callers **must** `await rig.close()`.
80
+
81
+ ### Notes
82
+
83
+ - Requires **Node ≥ 20**. Installs a native module (`better-sqlite3`), so the
84
+ machine needs a build toolchain. Assumes a long-lived process with a writable
85
+ disk; serverless and edge callers: see the Runtime requirements section of the
86
+ [quickstart](https://modelrig.dev/quickstart.html).
87
+ - Route output schemas validate under **JSON Schema 2020-12** (primary), with
88
+ **draft-07** also accepted. See the quickstart / route-bundles reference.
89
+
90
+ ## [0.1.0] — 2026-08-07
91
+
92
+ Initial public release: capability-aware gateway, routes-as-code, provider
93
+ adapters (Gemini / OpenAI / DeepSeek), typed failures, budget envelopes, and
94
+ local-first SQLite telemetry.
package/README.md CHANGED
@@ -32,25 +32,28 @@ This runs with **only a provider key** — no account, no signup.
32
32
  export GEMINI_API_KEY=... # or OPENAI_API_KEY, ANTHROPIC_API_KEY, …
33
33
  ```
34
34
 
35
- **2. Define a route** at `modelrig/routes/research.growth_scenarios.yaml`:
35
+ **2. Define a route** at `modelrig/routes/example.support_summarize.yaml` (the
36
+ example the package ships, in `modelrig/routes/`):
36
37
 
37
38
  ```yaml
38
- route: research.growth_scenarios
39
+ route: example.support_summarize
39
40
  version: 1
40
- schema: ./schemas/growth_scenarios.schema.json # JSON Schema for the output
41
+ schema: ./schemas/support_summarize.schema.json # JSON Schema (2020-12 recommended; draft-07 still accepted)
41
42
  candidates: # THE candidate set — nothing else can serve
42
- - provider: gemini
43
- model: gemini-3.1-pro-preview
44
43
  - provider: openai
45
44
  model: gpt-5.4-mini
45
+ - provider: gemini
46
+ model: gemini-3.1-flash-lite
47
+ - provider: deepseek
48
+ model: deepseek-chat
46
49
  require: [schema_conformant]
47
50
  prefer: [cost]
48
51
  prompt:
49
- system: ./prompts/growth_scenarios.system.md # {{var}} + {{#if capability.X}} blocks
50
- variables: [ticker, financials, priorSteps]
52
+ system: ./prompts/support_summarize.system.md # {{var}} + {{#if capability.X}} blocks
53
+ variables: [ticket, product, priorContext]
51
54
  policy:
52
55
  retries: { content_invalid: 2, network: 4, capacity_shed: 3 }
53
- timeout_ms: 300000
56
+ timeout_ms: 60000
54
57
  tier: flex
55
58
  json: native
56
59
  ```
@@ -61,9 +64,9 @@ policy:
61
64
  import { createRig, loadConfigFromEnv } from "modelrig";
62
65
 
63
66
  const rig = createRig(loadConfigFromEnv()); // keys from GEMINI_API_KEY etc.
64
- const result = await rig.run("research.growth_scenarios", {
65
- input: { ticker, financials, priorSteps }, // template variables
66
- tags: { run_id, step: "growth_scenarios", ticker },
67
+ const result = await rig.run("example.support_summarize", {
68
+ input: { ticket, product, priorContext }, // template variables
69
+ tags: { run_id, step: "summarize" },
67
70
  budget: { envelope: run_id }, // hard-stop cost envelope
68
71
  });
69
72
  // result.output — schema-validated JSON (ajv), regardless of serving model
@@ -72,6 +75,33 @@ const result = await rig.run("research.growth_scenarios", {
72
75
  rig.close();
73
76
  ```
74
77
 
78
+ **Data-governance routing (opt-in).** Add `zero_retention` to a route's
79
+ `require`, or pass `zeroRetention: true` on a single `rig.run(...)` call, to
80
+ route only to zero-retention–designated endpoints. It is a hard, opt-in filter
81
+ that fails closed: if no candidate is designated zero-retention, the run raises
82
+ the no-eligible-candidate error rather than dispatching to a retaining endpoint.
83
+ (Capability gating is on by default here — unlike OpenRouter's opt-in
84
+ `require_parameters`.)
85
+
86
+ **Request-time routing controls (opt-in).** A single `rig.run(...)` call can
87
+ narrow the candidate set: `maxPriceUsdPerMTok` drops any model over a price
88
+ ceiling (unknown price + a ceiling → dropped, fail-closed), and
89
+ `providers: { only, ignore }` restricts or excludes providers. `maxPrice` is a
90
+ candidate *filter* (which models are eligible) — distinct from `budget.envelope`,
91
+ which is a *spend cap* on the run's total cost; both compose, both fail closed on
92
+ unpriced models.
93
+
94
+ **Customer cache handle (opt-in).** If your code already engineered provider
95
+ caching, carry it through: `rig.run(task, { input, cache: { key, provider } })`
96
+ passes a customer-owned cache identifier (a Gemini `cachedContents/<id>`, or a
97
+ `prompt_cache_key` value) verbatim to the matching-provider candidate. It wins
98
+ over the route's `cache: auto` stamp, and a non-matching fallback dispatches
99
+ without it. ModelRig carries the handle and prices the hits — it never creates,
100
+ refreshes, or deletes the resource, so a long job needs your own TTL heartbeat
101
+ (see the [caching lifecycle](https://modelrig.dev/caching-lifecycle.html) doc).
102
+ The Lane-B `rig.runRaw({ provider, model, …, cache: { key } })` seam takes the
103
+ same field.
104
+
75
105
  Every attempt is recorded in a local SQLite file (`.modelrig/telemetry.db`)
76
106
  tagged with your `tags`. Failures are typed —
77
107
  `RigFailureError.failure.class` is one of `content_invalid`, `capacity_shed`,
@@ -0,0 +1,19 @@
1
+ # data/pricing-map.json — provenance
2
+
3
+ Copied manually from `vendor/litellm-upstream/model_prices_and_context_window.json`
4
+ at the pinned SHA recorded in `upstream/litellm.pin.json` (`de706a35a6`, pinned
5
+ 2026-07-30). 2,986 model entries at time of copy.
6
+
7
+ Source: LiteLLM (https://github.com/BerriAI/litellm),
8
+ Copyright (c) 2023 Berri AI, MIT License.
9
+
10
+ NOTE (Phase 0 gap): the automated extraction script (`scripts/sync-upstream.ts`
11
+ with provenance header + diff output) was not built before Phase 1 started, so
12
+ this snapshot was copied by hand per implementation-plan §9. Replace this manual
13
+ copy with the sync script's output when Phase 0 tooling lands; until then, any
14
+ pin bump must re-copy this file and update this note.
15
+
16
+ Key naming (verified against the snapshot):
17
+ - Gemini API models: `gemini/<model>` (bare ids resolve to vertex_ai pricing — do not use)
18
+ - OpenAI models: bare `<model>`
19
+ - DeepSeek models: `deepseek/<model>` (bare ids also present)
@@ -0,0 +1,22 @@
1
+ {
2
+ "_provenance": {
3
+ "role": "Website-sourced per-token prices for hosts that do not expose pricing via an API our key can read (today: Fireworks — its /models listing rejects an inference-scoped key). Hand-read from the vendor's public model page, each entry carrying its source URL + read date. Merged into pricing-overlay.json by scripts/pricing-sweep.ts alongside the API-swept prices; both are gap-fillers beneath the pinned LiteLLM snapshot (snapshot wins on shared keys). Replace an entry here with an API/scraper adapter when one exists.",
4
+ "note": "Flat prices (input_cost_per_token / output / cache_read) are the BASE serverless standard rate. Serving-tier multipliers (Fireworks: +25% priority, +50% fast, +10% US-only) are now carried in the additive `pricing_v2` block (pricing-first-class spec) as MULTIPLIERS on base (1.25 / 1.5 / 1.1). Context-length/batch/modality bands are still uncaptured for this model and are absent (not guessed). The flat fields stay for backward compatibility."
5
+ },
6
+ "prices": {
7
+ "fireworks_ai/accounts/fireworks/models/kimi-k3": {
8
+ "input_cost_per_token": 3.0e-6,
9
+ "output_cost_per_token": 1.5e-5,
10
+ "cache_read_input_token_cost": 3.0e-7,
11
+ "source": "fireworks-website:https://fireworks.ai/models/fireworks/kimi-k3 (base serverless standard; +25% priority / +50% fast / +10% US-only)",
12
+ "as_of": "2026-08-09",
13
+ "pricing_v2": {
14
+ "base": { "input": 3.0e-6, "output": 1.5e-5, "cache_read": 3.0e-7 },
15
+ "tiers": { "priority": 1.25, "fast": 1.5, "region_us": 1.1 },
16
+ "source": "fireworks-website:https://fireworks.ai/models/fireworks/kimi-k3",
17
+ "as_of": "2026-08-09",
18
+ "basis": "base serverless · standard tier · text"
19
+ }
20
+ }
21
+ }
22
+ }