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.
- package/CHANGELOG.md +94 -0
- package/README.md +41 -11
- package/data/PROVENANCE.md +19 -0
- package/data/pricing-manual.json +22 -0
- package/data/pricing-map.json +46362 -0
- package/data/pricing-overlay.json +419 -0
- package/dist/adapters/anthropic.d.ts +50 -6
- package/dist/adapters/anthropic.d.ts.map +1 -1
- package/dist/adapters/anthropic.js +123 -29
- package/dist/adapters/build-adapters.d.ts +11 -0
- package/dist/adapters/build-adapters.d.ts.map +1 -0
- package/dist/adapters/build-adapters.js +45 -0
- package/dist/adapters/deepseek.d.ts +6 -0
- package/dist/adapters/deepseek.d.ts.map +1 -1
- package/dist/adapters/deepseek.js +54 -1
- package/dist/adapters/gemini.d.ts.map +1 -1
- package/dist/adapters/gemini.js +46 -6
- package/dist/adapters/grok.d.ts +9 -0
- package/dist/adapters/grok.d.ts.map +1 -1
- package/dist/adapters/grok.js +67 -3
- package/dist/adapters/openai-compat.d.ts +6 -0
- package/dist/adapters/openai-compat.d.ts.map +1 -1
- package/dist/adapters/openai-compat.js +58 -1
- package/dist/adapters/openai-stream.d.ts +58 -0
- package/dist/adapters/openai-stream.d.ts.map +1 -0
- package/dist/adapters/openai-stream.js +120 -0
- package/dist/adapters/openai.d.ts +6 -0
- package/dist/adapters/openai.d.ts.map +1 -1
- package/dist/adapters/openai.js +60 -1
- package/dist/adapters/sampling.d.ts +28 -0
- package/dist/adapters/sampling.d.ts.map +1 -0
- package/dist/adapters/sampling.js +34 -0
- package/dist/adapters/tool-mapping.d.ts +92 -0
- package/dist/adapters/tool-mapping.d.ts.map +1 -0
- package/dist/adapters/tool-mapping.js +143 -0
- package/dist/artifacts/artifact.d.ts +137 -0
- package/dist/artifacts/artifact.d.ts.map +1 -0
- package/dist/artifacts/artifact.js +377 -0
- package/dist/artifacts/content-uploader.d.ts +87 -0
- package/dist/artifacts/content-uploader.d.ts.map +1 -0
- package/dist/artifacts/content-uploader.js +124 -0
- package/dist/artifacts/index.d.ts +63 -0
- package/dist/artifacts/index.d.ts.map +1 -0
- package/dist/artifacts/index.js +80 -0
- package/dist/artifacts/run-context.d.ts +129 -0
- package/dist/artifacts/run-context.d.ts.map +1 -0
- package/dist/artifacts/run-context.js +208 -0
- package/dist/artifacts/scrub.d.ts +60 -0
- package/dist/artifacts/scrub.d.ts.map +1 -0
- package/dist/artifacts/scrub.js +139 -0
- package/dist/artifacts/step.d.ts +26 -0
- package/dist/artifacts/step.d.ts.map +1 -0
- package/dist/artifacts/step.js +37 -0
- package/dist/artifacts/taint.d.ts +63 -0
- package/dist/artifacts/taint.d.ts.map +1 -0
- package/dist/artifacts/taint.js +76 -0
- package/dist/bakeoff/cache-sim.d.ts +99 -0
- package/dist/bakeoff/cache-sim.d.ts.map +1 -0
- package/dist/bakeoff/cache-sim.js +126 -0
- package/dist/bakeoff/eval-cases.d.ts +96 -0
- package/dist/bakeoff/eval-cases.d.ts.map +1 -0
- package/dist/bakeoff/eval-cases.js +105 -0
- package/dist/bakeoff/report.d.ts +41 -0
- package/dist/bakeoff/report.d.ts.map +1 -0
- package/dist/bakeoff/report.js +142 -0
- package/dist/bakeoff/samples.d.ts +15 -0
- package/dist/bakeoff/samples.d.ts.map +1 -1
- package/dist/bakeoff/samples.js +20 -0
- package/dist/cli.d.ts +1 -3
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +134 -116
- package/dist/config.d.ts +100 -0
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +104 -0
- package/dist/deprecations.d.ts +32 -0
- package/dist/deprecations.d.ts.map +1 -0
- package/dist/deprecations.js +59 -0
- package/dist/gateway/http-protocol.d.ts +175 -0
- package/dist/gateway/http-protocol.d.ts.map +1 -0
- package/dist/gateway/http-protocol.js +105 -0
- package/dist/index.d.ts +105 -18
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +266 -138
- package/dist/init/finder.d.ts +15 -0
- package/dist/init/finder.d.ts.map +1 -1
- package/dist/init/finder.js +46 -0
- package/dist/init/init-cli.d.ts +10 -0
- package/dist/init/init-cli.d.ts.map +1 -0
- package/dist/init/init-cli.js +86 -0
- package/dist/init/observe-cli.d.ts +19 -0
- package/dist/init/observe-cli.d.ts.map +1 -0
- package/dist/init/observe-cli.js +73 -0
- package/dist/init/observe.d.ts +81 -0
- package/dist/init/observe.d.ts.map +1 -0
- package/dist/init/observe.js +245 -0
- package/dist/registry/build.d.ts +94 -1
- package/dist/registry/build.d.ts.map +1 -1
- package/dist/registry/build.js +125 -4
- package/dist/registry/cache-policy.d.ts +94 -0
- package/dist/registry/cache-policy.d.ts.map +1 -0
- package/dist/registry/cache-policy.js +238 -0
- package/dist/registry/call-notes.d.ts.map +1 -1
- package/dist/registry/call-notes.js +40 -2
- package/dist/registry/effective-rate.d.ts +151 -0
- package/dist/registry/effective-rate.d.ts.map +1 -0
- package/dist/registry/effective-rate.js +156 -0
- package/dist/registry/facts.d.ts.map +1 -1
- package/dist/registry/facts.js +16 -0
- package/dist/registry/parity.d.ts +26 -0
- package/dist/registry/parity.d.ts.map +1 -1
- package/dist/registry/parity.js +43 -2
- package/dist/registry/pricing-shape.d.ts +113 -0
- package/dist/registry/pricing-shape.d.ts.map +1 -0
- package/dist/registry/pricing-shape.js +123 -0
- package/dist/registry/pricing.d.ts +25 -1
- package/dist/registry/pricing.d.ts.map +1 -1
- package/dist/registry/pricing.js +64 -6
- package/dist/rigindex/bootstrap.d.ts +36 -0
- package/dist/rigindex/bootstrap.d.ts.map +1 -0
- package/dist/rigindex/bootstrap.js +97 -0
- package/dist/rigindex/fit.d.ts +24 -0
- package/dist/rigindex/fit.d.ts.map +1 -0
- package/dist/rigindex/fit.js +76 -0
- package/dist/rigindex/gates.d.ts +52 -0
- package/dist/rigindex/gates.d.ts.map +1 -0
- package/dist/rigindex/gates.js +109 -0
- package/dist/rigindex/graph.d.ts +31 -0
- package/dist/rigindex/graph.d.ts.map +1 -0
- package/dist/rigindex/graph.js +120 -0
- package/dist/rigindex/index.d.ts +23 -0
- package/dist/rigindex/index.d.ts.map +1 -0
- package/dist/rigindex/index.js +112 -0
- package/dist/rigindex/types.d.ts +76 -0
- package/dist/rigindex/types.d.ts.map +1 -0
- package/dist/rigindex/types.js +8 -0
- package/dist/routes/cache-lint.d.ts +41 -0
- package/dist/routes/cache-lint.d.ts.map +1 -0
- package/dist/routes/cache-lint.js +81 -0
- package/dist/routes/loader.d.ts +37 -0
- package/dist/routes/loader.d.ts.map +1 -1
- package/dist/routes/loader.js +138 -0
- package/dist/routes/resolved-bundle.d.ts +79 -0
- package/dist/routes/resolved-bundle.d.ts.map +1 -0
- package/dist/routes/resolved-bundle.js +148 -0
- package/dist/routes/sampling-config.d.ts +32 -0
- package/dist/routes/sampling-config.d.ts.map +1 -0
- package/dist/routes/sampling-config.js +91 -0
- package/dist/run/ajv.d.ts +22 -0
- package/dist/run/ajv.d.ts.map +1 -0
- package/dist/run/ajv.js +32 -0
- package/dist/run/cache-handle.d.ts +58 -0
- package/dist/run/cache-handle.d.ts.map +1 -0
- package/dist/run/cache-handle.js +54 -0
- package/dist/run/cache-stamp.d.ts +65 -0
- package/dist/run/cache-stamp.d.ts.map +1 -0
- package/dist/run/cache-stamp.js +0 -0
- package/dist/run/capture-write.d.ts +33 -0
- package/dist/run/capture-write.d.ts.map +1 -0
- package/dist/run/capture-write.js +55 -0
- package/dist/run/cost.d.ts.map +1 -1
- package/dist/run/cost.js +1 -1
- package/dist/run/dispatch.d.ts +99 -0
- package/dist/run/dispatch.d.ts.map +1 -0
- package/dist/run/dispatch.js +191 -0
- package/dist/run/raw.d.ts +88 -0
- package/dist/run/raw.d.ts.map +1 -0
- package/dist/run/raw.js +286 -0
- package/dist/run/record-attempt.d.ts +40 -0
- package/dist/run/record-attempt.d.ts.map +1 -0
- package/dist/run/record-attempt.js +99 -0
- package/dist/run/resolve.d.ts +75 -2
- package/dist/run/resolve.d.ts.map +1 -1
- package/dist/run/resolve.js +126 -4
- package/dist/run/run.d.ts +14 -0
- package/dist/run/run.d.ts.map +1 -1
- package/dist/run/run.js +0 -0
- package/dist/run/stream.d.ts +49 -0
- package/dist/run/stream.d.ts.map +1 -0
- package/dist/run/stream.js +87 -0
- package/dist/run/validate.d.ts.map +1 -1
- package/dist/run/validate.js +6 -7
- package/dist/savings/cache-ledger.d.ts +108 -0
- package/dist/savings/cache-ledger.d.ts.map +1 -0
- package/dist/savings/cache-ledger.js +174 -0
- package/dist/savings/cache-reconcile.d.ts +64 -0
- package/dist/savings/cache-reconcile.d.ts.map +1 -0
- package/dist/savings/cache-reconcile.js +59 -0
- package/dist/savings/cache-stats.d.ts +63 -0
- package/dist/savings/cache-stats.d.ts.map +1 -0
- package/dist/savings/cache-stats.js +108 -0
- package/dist/savings/emit.d.ts +13 -0
- package/dist/savings/emit.d.ts.map +1 -1
- package/dist/savings/emit.js +25 -0
- package/dist/savings/swap-execute.d.ts +14 -0
- package/dist/savings/swap-execute.d.ts.map +1 -1
- package/dist/savings/swap-execute.js +44 -1
- package/dist/savings/swaps-client.d.ts +14 -0
- package/dist/savings/swaps-client.d.ts.map +1 -1
- package/dist/savings/swaps-client.js +16 -2
- package/dist/settings/api-fetcher.d.ts +39 -0
- package/dist/settings/api-fetcher.d.ts.map +1 -0
- package/dist/settings/api-fetcher.js +92 -0
- package/dist/settings/index.d.ts +10 -0
- package/dist/settings/index.d.ts.map +1 -0
- package/dist/settings/index.js +15 -0
- package/dist/settings/task-settings.d.ts +91 -0
- package/dist/settings/task-settings.d.ts.map +1 -0
- package/dist/settings/task-settings.js +116 -0
- package/dist/status.d.ts +77 -0
- package/dist/status.d.ts.map +1 -0
- package/dist/status.js +113 -0
- package/dist/telemetry/artifact-store.d.ts +48 -0
- package/dist/telemetry/artifact-store.d.ts.map +1 -0
- package/dist/telemetry/artifact-store.js +189 -0
- package/dist/telemetry/cache-miss-streak.d.ts +79 -0
- package/dist/telemetry/cache-miss-streak.d.ts.map +1 -0
- package/dist/telemetry/cache-miss-streak.js +99 -0
- package/dist/telemetry/capture.d.ts +3 -0
- package/dist/telemetry/capture.d.ts.map +1 -1
- package/dist/telemetry/capture.js +15 -8
- package/dist/telemetry/exporter-setup.d.ts +28 -0
- package/dist/telemetry/exporter-setup.d.ts.map +1 -0
- package/dist/telemetry/exporter-setup.js +34 -0
- package/dist/telemetry/exporter.d.ts +75 -0
- package/dist/telemetry/exporter.d.ts.map +1 -1
- package/dist/telemetry/exporter.js +324 -47
- package/dist/telemetry/health.d.ts +76 -0
- package/dist/telemetry/health.d.ts.map +1 -0
- package/dist/telemetry/health.js +92 -0
- package/dist/telemetry/ingest-protocol.d.ts +152 -3
- package/dist/telemetry/ingest-protocol.d.ts.map +1 -1
- package/dist/telemetry/ingest-protocol.js +204 -4
- package/dist/telemetry/load-error-report.d.ts +24 -0
- package/dist/telemetry/load-error-report.d.ts.map +1 -0
- package/dist/telemetry/load-error-report.js +50 -0
- package/dist/telemetry/otel-map.d.ts +121 -0
- package/dist/telemetry/otel-map.d.ts.map +1 -0
- package/dist/telemetry/otel-map.js +224 -0
- package/dist/telemetry/otel-normalize.d.ts +104 -0
- package/dist/telemetry/otel-normalize.d.ts.map +1 -0
- package/dist/telemetry/otel-normalize.js +530 -0
- package/dist/telemetry/otlp-emitter.d.ts +52 -0
- package/dist/telemetry/otlp-emitter.d.ts.map +1 -0
- package/dist/telemetry/otlp-emitter.js +144 -0
- package/dist/telemetry/otlp-proto.d.ts +29 -0
- package/dist/telemetry/otlp-proto.d.ts.map +1 -0
- package/dist/telemetry/otlp-proto.js +266 -0
- package/dist/telemetry/sinks.d.ts +37 -1
- package/dist/telemetry/sinks.d.ts.map +1 -1
- package/dist/telemetry/sinks.js +121 -30
- package/dist/telemetry/store.d.ts +28 -1
- package/dist/telemetry/store.d.ts.map +1 -1
- package/dist/telemetry/store.js +218 -3
- package/dist/tenancy/api-key-format.d.ts +15 -5
- package/dist/tenancy/api-key-format.d.ts.map +1 -1
- package/dist/tenancy/api-key-format.js +24 -5
- package/dist/types/config-teaching.d.ts +62 -0
- package/dist/types/config-teaching.d.ts.map +1 -0
- package/dist/types/config-teaching.js +183 -0
- package/dist/types/provider.d.ts +122 -1
- package/dist/types/provider.d.ts.map +1 -1
- package/dist/types/provider.js +21 -1
- package/dist/types/route.d.ts +79 -1
- package/dist/types/route.d.ts.map +1 -1
- package/dist/types/telemetry.d.ts +117 -0
- package/dist/types/telemetry.d.ts.map +1 -1
- package/dist/validate-cli.d.ts +12 -0
- package/dist/validate-cli.d.ts.map +1 -0
- package/dist/validate-cli.js +57 -0
- package/dist/verify/capture.d.ts +66 -0
- package/dist/verify/capture.d.ts.map +1 -0
- package/dist/verify/capture.js +180 -0
- package/dist/verify/cli-run.d.ts +23 -0
- package/dist/verify/cli-run.d.ts.map +1 -0
- package/dist/verify/cli-run.js +57 -0
- package/dist/verify/diff.d.ts +48 -0
- package/dist/verify/diff.d.ts.map +1 -0
- package/dist/verify/diff.js +157 -0
- package/dist/verify/index.d.ts +17 -0
- package/dist/verify/index.d.ts.map +1 -0
- package/dist/verify/index.js +24 -0
- package/dist/verify/report.d.ts +14 -0
- package/dist/verify/report.d.ts.map +1 -0
- package/dist/verify/report.js +88 -0
- package/dist/verify/types.d.ts +101 -0
- package/dist/verify/types.d.ts.map +1 -0
- package/dist/verify/types.js +17 -0
- package/dist/verify/verify.d.ts +29 -0
- package/dist/verify/verify.d.ts.map +1 -0
- package/dist/verify/verify.js +148 -0
- package/dist/watch/evaluate.d.ts +162 -3
- package/dist/watch/evaluate.d.ts.map +1 -1
- package/dist/watch/evaluate.js +61 -0
- package/dist/watch/monitor.d.ts +116 -0
- package/dist/watch/monitor.d.ts.map +1 -0
- package/dist/watch/monitor.js +199 -0
- package/dist/watch/proposals.d.ts +20 -4
- package/dist/watch/proposals.d.ts.map +1 -1
- package/dist/watch/proposals.js +31 -3
- package/dist/watch/run.d.ts +33 -0
- package/dist/watch/run.d.ts.map +1 -1
- package/dist/watch/run.js +39 -0
- package/package.json +7 -1
- package/registry/LICENSE +20 -0
- package/registry/leaderboard.json +3639 -0
- package/registry/registry.json +7263 -0
- package/dist/telemetry/supabase-exporter.d.ts +0 -64
- package/dist/telemetry/supabase-exporter.d.ts.map +0 -1
- 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/
|
|
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:
|
|
39
|
+
route: example.support_summarize
|
|
39
40
|
version: 1
|
|
40
|
-
schema: ./schemas/
|
|
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/
|
|
50
|
-
variables: [
|
|
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:
|
|
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("
|
|
65
|
-
input: {
|
|
66
|
-
tags: { run_id, step: "
|
|
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
|
+
}
|