modelrig 0.8.1 → 0.10.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 +324 -0
- package/README.md +55 -29
- package/data/PROVENANCE.md +14 -0
- package/data/pricing-map.json +26 -0
- package/dist/adapters/attempt-meta-map.d.ts +8 -1
- package/dist/adapters/attempt-meta-map.d.ts.map +1 -1
- package/dist/adapters/attempt-meta-map.js +4 -0
- package/dist/adapters/build-adapters.js +2 -2
- package/dist/adapters/gemini.d.ts +28 -1
- package/dist/adapters/gemini.d.ts.map +1 -1
- package/dist/adapters/gemini.js +38 -9
- package/dist/adapters/grok.d.ts.map +1 -1
- package/dist/adapters/grok.js +53 -4
- package/dist/adapters/openai-compat.d.ts +8 -2
- package/dist/adapters/openai-compat.d.ts.map +1 -1
- package/dist/adapters/openai-compat.js +8 -1
- package/dist/adapters/openai-stream.d.ts +10 -2
- package/dist/adapters/openai-stream.d.ts.map +1 -1
- package/dist/adapters/openai-stream.js +5 -1
- package/dist/adapters/openai.d.ts +10 -1
- package/dist/adapters/openai.d.ts.map +1 -1
- package/dist/adapters/openai.js +57 -7
- package/dist/adapters/responses-api.d.ts +61 -0
- package/dist/adapters/responses-api.d.ts.map +1 -0
- package/dist/adapters/responses-api.js +124 -0
- package/dist/artifacts/artifact.d.ts +31 -12
- package/dist/artifacts/artifact.d.ts.map +1 -1
- package/dist/artifacts/artifact.js +218 -188
- package/dist/artifacts/index.d.ts +15 -5
- package/dist/artifacts/index.d.ts.map +1 -1
- package/dist/artifacts/index.js +19 -5
- package/dist/artifacts/run-context.d.ts +3 -24
- package/dist/artifacts/run-context.d.ts.map +1 -1
- package/dist/artifacts/run-context.js +3 -39
- package/dist/bakeoff/engine.d.ts +29 -0
- package/dist/bakeoff/engine.d.ts.map +1 -1
- package/dist/bakeoff/engine.js +47 -0
- package/dist/bakeoff/eval-cases-rig.d.ts +36 -0
- package/dist/bakeoff/eval-cases-rig.d.ts.map +1 -0
- package/dist/bakeoff/eval-cases-rig.js +27 -0
- package/dist/bakeoff/eval-cases.d.ts +19 -0
- package/dist/bakeoff/eval-cases.d.ts.map +1 -1
- package/dist/bakeoff/eval-cases.js +18 -1
- package/dist/bakeoff/golden-judge.d.ts +47 -0
- package/dist/bakeoff/golden-judge.d.ts.map +1 -0
- package/dist/bakeoff/golden-judge.js +49 -0
- package/dist/bakeoff/groundedness.d.ts +58 -0
- package/dist/bakeoff/groundedness.d.ts.map +1 -0
- package/dist/bakeoff/groundedness.js +165 -0
- package/dist/bakeoff/quality.d.ts +43 -0
- package/dist/bakeoff/quality.d.ts.map +1 -1
- package/dist/bakeoff/quality.js +31 -0
- package/dist/bakeoff/replay.d.ts +11 -0
- package/dist/bakeoff/replay.d.ts.map +1 -1
- package/dist/bakeoff/replay.js +12 -0
- package/dist/bakeoff/report.d.ts +7 -0
- package/dist/bakeoff/report.d.ts.map +1 -1
- package/dist/bakeoff/report.js +26 -0
- package/dist/cli-judge.d.ts +12 -0
- package/dist/cli-judge.d.ts.map +1 -0
- package/dist/cli-judge.js +48 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +22 -42
- package/dist/config.d.ts +85 -29
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +109 -47
- package/dist/detect/detector.d.ts +4 -2
- package/dist/detect/detector.d.ts.map +1 -1
- package/dist/detect/safe-harbor.d.ts +57 -0
- package/dist/detect/safe-harbor.d.ts.map +1 -0
- package/dist/detect/safe-harbor.js +278 -0
- package/dist/doctor-cli.d.ts +7 -0
- package/dist/doctor-cli.d.ts.map +1 -0
- package/dist/doctor-cli.js +67 -0
- package/dist/doctor-preflight.d.ts +52 -0
- package/dist/doctor-preflight.d.ts.map +1 -0
- package/dist/doctor-preflight.js +112 -0
- package/dist/feedback/coverage.d.ts +11 -8
- package/dist/feedback/coverage.d.ts.map +1 -1
- package/dist/feedback/coverage.js +29 -16
- package/dist/feedback/grade.d.ts +58 -0
- package/dist/feedback/grade.d.ts.map +1 -0
- package/dist/feedback/grade.js +67 -0
- package/dist/gateway/http-protocol.d.ts +20 -1
- package/dist/gateway/http-protocol.d.ts.map +1 -1
- package/dist/gateway/http-protocol.js +1 -1
- package/dist/gateway/serve-client.d.ts +99 -0
- package/dist/gateway/serve-client.d.ts.map +1 -0
- package/dist/gateway/serve-client.js +360 -0
- package/dist/index.d.ts +68 -29
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +167 -46
- package/dist/init/observe-cli.js +1 -1
- package/dist/init/observe.d.ts +2 -2
- package/dist/init/observe.d.ts.map +1 -1
- package/dist/init/observe.js +11 -7
- package/dist/mask/arm.d.ts +112 -0
- package/dist/mask/arm.d.ts.map +1 -0
- package/dist/mask/arm.js +179 -0
- package/dist/mask/index.d.ts +2 -0
- package/dist/mask/index.d.ts.map +1 -1
- package/dist/mask/index.js +7 -1
- package/dist/mask/mask-policy-cli.d.ts +12 -4
- package/dist/mask/mask-policy-cli.d.ts.map +1 -1
- package/dist/mask/mask-policy-cli.js +34 -9
- package/dist/prompts/manifest.d.ts +128 -0
- package/dist/prompts/manifest.d.ts.map +1 -0
- package/dist/prompts/manifest.js +214 -0
- package/dist/prompts/prompt-fetch.d.ts +84 -0
- package/dist/prompts/prompt-fetch.d.ts.map +1 -0
- package/dist/prompts/prompt-fetch.js +120 -0
- package/dist/prompts/prompt-resolve.d.ts +76 -0
- package/dist/prompts/prompt-resolve.d.ts.map +1 -0
- package/dist/prompts/prompt-resolve.js +93 -0
- package/dist/prompts/slot-resolver.d.ts +91 -0
- package/dist/prompts/slot-resolver.d.ts.map +1 -0
- package/dist/prompts/slot-resolver.js +135 -0
- package/dist/prompts/tools-register.d.ts +60 -0
- package/dist/prompts/tools-register.d.ts.map +1 -0
- package/dist/prompts/tools-register.js +48 -0
- package/dist/prompts/version-hash.d.ts +29 -0
- package/dist/prompts/version-hash.d.ts.map +1 -0
- package/dist/prompts/version-hash.js +54 -0
- package/dist/prompts-export-cli.d.ts +21 -0
- package/dist/prompts-export-cli.d.ts.map +1 -0
- package/dist/prompts-export-cli.js +130 -0
- package/dist/query/grammar.d.ts +2 -2
- package/dist/query/grammar.d.ts.map +1 -1
- package/dist/query/grammar.js +3 -1
- package/dist/query/saved.d.ts +13 -0
- package/dist/query/saved.d.ts.map +1 -1
- package/dist/query/saved.js +67 -1
- package/dist/receipts/types.d.ts +1 -1
- package/dist/receipts/types.d.ts.map +1 -1
- package/dist/receipts/types.js +1 -0
- package/dist/registry/build.d.ts +43 -1
- package/dist/registry/build.d.ts.map +1 -1
- package/dist/registry/build.js +52 -0
- package/dist/registry/cache-policy.d.ts.map +1 -1
- package/dist/registry/cache-policy.js +22 -0
- package/dist/registry/pricing-shape.d.ts +67 -8
- package/dist/registry/pricing-shape.d.ts.map +1 -1
- package/dist/registry/pricing-shape.js +50 -13
- package/dist/registry/pricing.d.ts +6 -5
- package/dist/registry/pricing.d.ts.map +1 -1
- package/dist/registry/pricing.js +9 -5
- package/dist/registry/rows.d.ts.map +1 -1
- package/dist/registry/rows.js +1 -0
- package/dist/registry/select.d.ts +6 -1
- package/dist/registry/select.d.ts.map +1 -1
- package/dist/registry/select.js +11 -0
- package/dist/routes/call-config.d.ts +199 -0
- package/dist/routes/call-config.d.ts.map +1 -0
- package/dist/routes/call-config.js +343 -0
- package/dist/routes/destination-loader.d.ts +16 -0
- package/dist/routes/destination-loader.d.ts.map +1 -0
- package/dist/routes/destination-loader.js +29 -0
- package/dist/routes/draft.d.ts +7 -0
- package/dist/routes/draft.d.ts.map +1 -1
- package/dist/routes/draft.js +12 -0
- package/dist/routes/loader.d.ts.map +1 -1
- package/dist/routes/loader.js +31 -56
- package/dist/routes/objective-loader.d.ts +12 -0
- package/dist/routes/objective-loader.d.ts.map +1 -1
- package/dist/routes/objective-loader.js +82 -0
- package/dist/routes/output-loader.d.ts +42 -0
- package/dist/routes/output-loader.d.ts.map +1 -0
- package/dist/routes/output-loader.js +112 -0
- package/dist/routes/prompt-loader.d.ts +49 -0
- package/dist/routes/prompt-loader.d.ts.map +1 -0
- package/dist/routes/prompt-loader.js +113 -0
- package/dist/routes/resolved-bundle.d.ts +69 -0
- package/dist/routes/resolved-bundle.d.ts.map +1 -1
- package/dist/routes/resolved-bundle.js +76 -0
- package/dist/routes/screen-loader.d.ts +29 -1
- package/dist/routes/screen-loader.d.ts.map +1 -1
- package/dist/routes/screen-loader.js +59 -1
- package/dist/run/accept.d.ts +5 -0
- package/dist/run/accept.d.ts.map +1 -1
- package/dist/run/accept.js +2 -0
- package/dist/run/cost.d.ts +31 -2
- package/dist/run/cost.d.ts.map +1 -1
- package/dist/run/cost.js +57 -2
- package/dist/run/destination.d.ts +39 -0
- package/dist/run/destination.d.ts.map +1 -0
- package/dist/run/destination.js +45 -0
- package/dist/run/dispatch.d.ts +67 -16
- package/dist/run/dispatch.d.ts.map +1 -1
- package/dist/run/dispatch.js +133 -29
- package/dist/run/grounding.d.ts +28 -2
- package/dist/run/grounding.d.ts.map +1 -1
- package/dist/run/grounding.js +54 -10
- package/dist/run/raw-defaults.d.ts.map +1 -1
- package/dist/run/raw-defaults.js +6 -1
- package/dist/run/raw-finalize.d.ts +50 -0
- package/dist/run/raw-finalize.d.ts.map +1 -0
- package/dist/run/raw-finalize.js +266 -0
- package/dist/run/raw-knobs.d.ts +36 -0
- package/dist/run/raw-knobs.d.ts.map +1 -0
- package/dist/run/raw-knobs.js +99 -0
- package/dist/run/raw-request.d.ts +24 -0
- package/dist/run/raw-request.d.ts.map +1 -0
- package/dist/run/raw-request.js +69 -0
- package/dist/run/raw-schema.d.ts +76 -0
- package/dist/run/raw-schema.d.ts.map +1 -0
- package/dist/run/raw-schema.js +166 -0
- package/dist/run/raw-search-cost.d.ts +48 -0
- package/dist/run/raw-search-cost.d.ts.map +1 -0
- package/dist/run/raw-search-cost.js +78 -0
- package/dist/run/raw-support.d.ts +64 -6
- package/dist/run/raw-support.d.ts.map +1 -1
- package/dist/run/raw-support.js +84 -11
- package/dist/run/raw.d.ts +25 -26
- package/dist/run/raw.d.ts.map +1 -1
- package/dist/run/raw.js +30 -351
- package/dist/run/record-attempt.d.ts +12 -0
- package/dist/run/record-attempt.d.ts.map +1 -1
- package/dist/run/record-attempt.js +30 -12
- package/dist/run/repair-attempt.d.ts +68 -0
- package/dist/run/repair-attempt.d.ts.map +1 -0
- package/dist/run/repair-attempt.js +180 -0
- package/dist/run/resolve-destination.d.ts +49 -0
- package/dist/run/resolve-destination.d.ts.map +1 -0
- package/dist/run/resolve-destination.js +76 -0
- package/dist/run/routing-docs.d.ts.map +1 -1
- package/dist/run/routing-docs.js +10 -5
- package/dist/run/run.d.ts +30 -1
- package/dist/run/run.d.ts.map +1 -1
- package/dist/run/run.js +94 -172
- package/dist/run/telemetry-row.d.ts +92 -0
- package/dist/run/telemetry-row.d.ts.map +1 -0
- package/dist/run/telemetry-row.js +81 -0
- package/dist/run/validate.d.ts +12 -1
- package/dist/run/validate.d.ts.map +1 -1
- package/dist/run/validate.js +31 -0
- package/dist/run/web-search-pricing.d.ts +43 -0
- package/dist/run/web-search-pricing.d.ts.map +1 -0
- package/dist/run/web-search-pricing.js +56 -0
- package/dist/savings/odometer.d.ts +4 -0
- package/dist/savings/odometer.d.ts.map +1 -1
- package/dist/savings/odometer.js +20 -1
- package/dist/savings/swap-execute.d.ts +7 -0
- package/dist/savings/swap-execute.d.ts.map +1 -1
- package/dist/savings/swap-execute.js +30 -0
- package/dist/savings/swaps-client.d.ts +10 -0
- package/dist/savings/swaps-client.d.ts.map +1 -1
- package/dist/screen/fixtures/probe-corpora.d.ts +23 -0
- package/dist/screen/fixtures/probe-corpora.d.ts.map +1 -0
- package/dist/screen/fixtures/probe-corpora.js +69 -0
- package/dist/screen/index.d.ts +21 -0
- package/dist/screen/index.d.ts.map +1 -0
- package/dist/screen/index.js +64 -0
- package/dist/screen/model-screen.d.ts +111 -0
- package/dist/screen/model-screen.d.ts.map +1 -0
- package/dist/screen/model-screen.js +178 -0
- package/dist/screen/patterns.d.ts +51 -0
- package/dist/screen/patterns.d.ts.map +1 -0
- package/dist/screen/patterns.js +151 -0
- package/dist/screen/phi-gate.d.ts +52 -0
- package/dist/screen/phi-gate.d.ts.map +1 -0
- package/dist/screen/phi-gate.js +86 -0
- package/dist/screen/policy.d.ts +71 -0
- package/dist/screen/policy.d.ts.map +1 -0
- package/dist/screen/policy.js +334 -0
- package/dist/screen/probe.d.ts +118 -0
- package/dist/screen/probe.d.ts.map +1 -0
- package/dist/screen/probe.js +132 -0
- package/dist/screen/screen-cli.d.ts +16 -0
- package/dist/screen/screen-cli.d.ts.map +1 -0
- package/dist/screen/screen-cli.js +178 -0
- package/dist/screen/screen.d.ts +99 -0
- package/dist/screen/screen.d.ts.map +1 -0
- package/dist/screen/screen.js +0 -0
- package/dist/screen/sidecar.d.ts +69 -0
- package/dist/screen/sidecar.d.ts.map +1 -0
- package/dist/screen/sidecar.js +145 -0
- package/dist/screen/types.d.ts +43 -2
- package/dist/screen/types.d.ts.map +1 -1
- package/dist/settings/api-fetcher.d.ts +14 -3
- package/dist/settings/api-fetcher.d.ts.map +1 -1
- package/dist/settings/api-fetcher.js +61 -10
- package/dist/settings/grading-guide.d.ts +102 -0
- package/dist/settings/grading-guide.d.ts.map +1 -0
- package/dist/settings/grading-guide.js +23 -0
- package/dist/settings/index.d.ts +3 -2
- package/dist/settings/index.d.ts.map +1 -1
- package/dist/settings/index.js +2 -1
- package/dist/settings/task-settings.d.ts +44 -7
- package/dist/settings/task-settings.d.ts.map +1 -1
- package/dist/settings/task-settings.js +53 -12
- package/dist/status.d.ts +32 -20
- package/dist/status.d.ts.map +1 -1
- package/dist/status.js +51 -30
- package/dist/telemetry/artifact-store.d.ts +5 -6
- package/dist/telemetry/artifact-store.d.ts.map +1 -1
- package/dist/telemetry/artifact-store.js +21 -24
- package/dist/telemetry/attempt-meta.d.ts +76 -1
- package/dist/telemetry/attempt-meta.d.ts.map +1 -1
- package/dist/telemetry/attempt-meta.js +33 -1
- package/dist/telemetry/exporter-setup.d.ts +2 -0
- package/dist/telemetry/exporter-setup.d.ts.map +1 -1
- package/dist/telemetry/exporter-setup.js +6 -1
- package/dist/telemetry/exporter.d.ts +2 -2
- package/dist/telemetry/exporter.d.ts.map +1 -1
- package/dist/telemetry/exporter.js +22 -41
- package/dist/telemetry/grade-mappers.d.ts +25 -0
- package/dist/telemetry/grade-mappers.d.ts.map +1 -0
- package/dist/telemetry/grade-mappers.js +64 -0
- package/dist/telemetry/grades-sql.d.ts +56 -0
- package/dist/telemetry/grades-sql.d.ts.map +1 -0
- package/dist/telemetry/grades-sql.js +156 -0
- package/dist/telemetry/ingest-protocol.d.ts +55 -48
- package/dist/telemetry/ingest-protocol.d.ts.map +1 -1
- package/dist/telemetry/ingest-protocol.js +48 -83
- package/dist/telemetry/org-identity.d.ts +44 -0
- package/dist/telemetry/org-identity.d.ts.map +1 -0
- package/dist/telemetry/org-identity.js +98 -0
- package/dist/telemetry/route-registration.d.ts +48 -0
- package/dist/telemetry/route-registration.d.ts.map +1 -0
- package/dist/telemetry/route-registration.js +77 -0
- package/dist/telemetry/sinks.d.ts +10 -1
- package/dist/telemetry/sinks.d.ts.map +1 -1
- package/dist/telemetry/sinks.js +52 -6
- package/dist/telemetry/store-migrations.d.ts.map +1 -1
- package/dist/telemetry/store-migrations.js +64 -0
- package/dist/telemetry/store.d.ts +9 -6
- package/dist/telemetry/store.d.ts.map +1 -1
- package/dist/telemetry/store.js +8 -50
- package/dist/tenancy/api-key-format.d.ts +45 -1
- package/dist/tenancy/api-key-format.d.ts.map +1 -1
- package/dist/tenancy/api-key-format.js +50 -1
- package/dist/types/provider.d.ts +23 -3
- package/dist/types/provider.d.ts.map +1 -1
- package/dist/types/provider.js +26 -0
- package/dist/types/route.d.ts +154 -2
- package/dist/types/route.d.ts.map +1 -1
- package/dist/types/telemetry.d.ts +73 -48
- package/dist/types/telemetry.d.ts.map +1 -1
- package/dist/validate-cli.d.ts.map +1 -1
- package/dist/validate-cli.js +32 -0
- package/dist/verify/verify.d.ts +5 -0
- package/dist/verify/verify.d.ts.map +1 -1
- package/dist/verify/verify.js +2 -0
- package/dist/watch/evaluate.d.ts +84 -1
- package/dist/watch/evaluate.d.ts.map +1 -1
- package/dist/watch/evaluate.js +28 -0
- package/dist/watch/monitor.d.ts +8 -2
- package/dist/watch/monitor.d.ts.map +1 -1
- package/dist/watch/monitor.js +13 -5
- package/dist/watch/regret-monitor-cli.d.ts +16 -0
- package/dist/watch/regret-monitor-cli.d.ts.map +1 -0
- package/dist/watch/regret-monitor-cli.js +137 -0
- package/dist/watch/regret-monitor.d.ts +168 -0
- package/dist/watch/regret-monitor.d.ts.map +1 -0
- package/dist/watch/regret-monitor.js +304 -0
- package/dist/watch/upgrade.d.ts +62 -0
- package/dist/watch/upgrade.d.ts.map +1 -0
- package/dist/watch/upgrade.js +57 -0
- package/docs/agent-skill/SKILL.md +181 -9
- package/docs/how-it-fits.md +3 -2
- package/docs/instrumentation.md +219 -46
- package/docs/llms.txt +158 -35
- package/docs/managed-serving.md +150 -0
- package/docs/mcp-oracle.md +322 -0
- package/docs/migration-playbook.md +5 -4
- package/docs/quickstart.md +263 -89
- package/package.json +18 -4
- package/registry/leaderboard.json +74 -0
- package/registry/registry.json +232 -112
- package/screen.d.ts +16 -0
- package/templates/call-disposition-qa.json +77 -0
- package/templates/catalog-cleansing.json +77 -0
- package/templates/compliance-review.json +76 -0
- package/templates/cs-next-action.json +76 -0
- package/templates/document-extraction.json +78 -0
- package/templates/financial-classification.json +75 -0
- package/templates/lead-qualification.json +76 -0
- package/templates/medical-classification.json +71 -0
- package/templates/ticket-triage.json +76 -0
- package/dist/feedback/feedback.d.ts +0 -35
- package/dist/feedback/feedback.d.ts.map +0 -1
- package/dist/feedback/feedback.js +0 -39
package/docs/quickstart.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# ModelRig quickstart — see, prove, and save on every model call
|
|
2
2
|
|
|
3
|
+
**The question this page answers: how do I get from nothing to my first run on `/runs`, with its steps and artifacts, in about ten minutes?**
|
|
4
|
+
|
|
3
5
|
ModelRig is the operating layer for your AI workstream. Each LLM task becomes a
|
|
4
6
|
**versioned route file** (prompt template + JSON schema + candidate models +
|
|
5
7
|
policy) that you call with one line — `rig.run("task.name", {input, tags})` —
|
|
@@ -8,29 +10,40 @@ and three things happen at once:
|
|
|
8
10
|
- **See** — the run lands in an **inspectable artifact store** (runs → steps →
|
|
9
11
|
artifacts, lineaged and integrity-hashed; see the
|
|
10
12
|
[instrumentation guide](instrumentation.md)), with cost/tokens/tier and a
|
|
11
|
-
|
|
13
|
+
grade recorded against your tags.
|
|
12
14
|
- **Prove** — you get schema-validated output, served only by a model you
|
|
13
15
|
authorized, and you can replay that traffic against cheaper candidates in a
|
|
14
16
|
bake-off before you change anything.
|
|
15
17
|
- **Save** — a winning candidate is a change to your YAML you review; nothing
|
|
16
18
|
swaps a model on its own, and your routes are always YAML in your git.
|
|
17
19
|
|
|
18
|
-
The
|
|
19
|
-
|
|
20
|
+
The path is the same whoever does the work: **mint a key → install → confirm the
|
|
21
|
+
org → define a route → wrap one pipeline execution in a run → see it on `/runs`.**
|
|
22
|
+
Step 0 is yours (two minutes, once); after that, point your coding agent at this
|
|
23
|
+
page or follow the steps by hand. Already have LLM calls you only want to *watch*
|
|
24
|
+
first? [Choosing a lane](https://modelrig.dev/choosing-a-lane.html) shows the observe path, which skips
|
|
25
|
+
the route.
|
|
20
26
|
|
|
21
27
|
## Step 0 — create your org and key (two minutes, human-only)
|
|
22
28
|
|
|
23
29
|
Account setup stays human: your coding agent never creates accounts, signs in,
|
|
24
|
-
or holds credentials. Once, up front
|
|
30
|
+
or holds credentials. Once, up front, sign up and create your organization at
|
|
31
|
+
[app.modelrig.ai](https://app.modelrig.ai) (email and an org name is the whole
|
|
32
|
+
form). Then:
|
|
33
|
+
|
|
34
|
+
<!-- BLOCK:KEY -->
|
|
35
|
+
**Mint a key in the org you want the data in.** Sign in at https://app.modelrig.ai, check the organization name in the header badge, and create a key on the API keys page. The `rig_sk_` secret is shown once. One key = one org: every row the key exports lands in the organization it was minted in, whichever organization you happen to be viewing in the console. Set it on every service, worker and cron that creates a rig; your provider keys stay where they are.
|
|
25
36
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
37
|
+
```bash
|
|
38
|
+
# Wherever your app reads configuration: .env.local, your platform's env vars, a secret manager. Never in code.
|
|
39
|
+
MODELRIG_API_KEY=rig_sk_…
|
|
40
|
+
```
|
|
41
|
+
<!-- /BLOCK:KEY -->
|
|
31
42
|
|
|
32
43
|
That key is the only ModelRig credential your app ever holds — never a database
|
|
33
|
-
URL, never a service-role key. Provider keys never leave your process.
|
|
44
|
+
URL, never a service-role key. Provider keys never leave your process. Which org
|
|
45
|
+
a key belongs to, and how the console chooses the org it shows you, is
|
|
46
|
+
[Orgs and keys](https://modelrig.dev/orgs-and-keys.html).
|
|
34
47
|
|
|
35
48
|
**No account needed for the open lane:** with only your provider keys set,
|
|
36
49
|
routes, probes and telemetry run entirely on your machine — the hosted console
|
|
@@ -51,33 +64,18 @@ Same flat 2% margin either way; your negotiated provider discounts stay yours.
|
|
|
51
64
|
|
|
52
65
|
## Point your coding agent at it
|
|
53
66
|
|
|
54
|
-
The fastest migration is the one your agent performs.
|
|
55
|
-
|
|
67
|
+
The fastest migration is the one your agent performs. Paste the migration prompt
|
|
68
|
+
from [modelrig.ai/get-started](https://modelrig.ai/get-started) (the console's
|
|
69
|
+
`/setup` page carries the same prompt) into Claude Code, Codex, or Cursor from
|
|
70
|
+
inside your project. It is the maintained version: it starts the agent at the
|
|
71
|
+
bottom of the [autonomy ladder](migration-playbook.md), has it confirm the org
|
|
72
|
+
your key exports to, wrap each pipeline execution in a run, and stop for your
|
|
73
|
+
approval at every checkpoint.
|
|
56
74
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
to create an org and issue a rig_sk_ key at https://app.modelrig.ai. Never
|
|
62
|
-
create accounts, sign in, or handle credentials yourself. Without the key,
|
|
63
|
-
proceed in local-only mode — that is fully supported.
|
|
64
|
-
1. Read https://modelrig.dev/quickstart.html and
|
|
65
|
-
https://modelrig.dev/route-bundles.html.
|
|
66
|
-
2. Find every place this codebase calls an LLM API directly.
|
|
67
|
-
3. For each call site, define a route bundle YAML (schema, candidate models,
|
|
68
|
-
policy, prompt template) and replace the direct call with
|
|
69
|
-
rig.run("<route.name>"). Keep prompt and schema semantics unchanged.
|
|
70
|
-
4. Before naming any model capability, check the probed registry — declared
|
|
71
|
-
flags and probed behavior differ; trust the probed layer.
|
|
72
|
-
5. Run the project's existing tests and report every file you changed.
|
|
73
|
-
```
|
|
74
|
-
|
|
75
|
-
Your agent reads the docs, finds your LLM call sites, and turns them into
|
|
76
|
-
routes. It **won't** create accounts, sign in, or touch your API keys (those
|
|
77
|
-
stay in the environment you set in Step 0), and it swaps call sites to
|
|
78
|
-
`rig.run()` without changing prompt or schema semantics — same model, human-
|
|
79
|
-
reviewed. The full autonomy ladder and same-model guarantees are in the
|
|
80
|
-
[migration playbook](migration-playbook.md).
|
|
75
|
+
Your agent reads the docs, finds your LLM call sites, and wires them in. It
|
|
76
|
+
**won't** create accounts, sign in, or touch your API keys (those stay in the
|
|
77
|
+
environment you set in Step 0), and when it replaces a call site with `rig.run()`
|
|
78
|
+
it keeps prompt and schema semantics unchanged — same model, human-reviewed.
|
|
81
79
|
|
|
82
80
|
## Or set it up by hand
|
|
83
81
|
|
|
@@ -87,14 +85,15 @@ reviewed. The full autonomy ladder and same-model guarantees are in the
|
|
|
87
85
|
pnpm add modelrig # or npm i modelrig — Node >= 20
|
|
88
86
|
```
|
|
89
87
|
|
|
90
|
-
It installs a native module (`better-sqlite3`)
|
|
91
|
-
x64/arm64;
|
|
88
|
+
It installs a native module (`better-sqlite3`) from a prebuilt binary on
|
|
89
|
+
macOS and Linux (x64/arm64); any other platform compiles it at install time and
|
|
90
|
+
needs a C++ toolchain.
|
|
92
91
|
|
|
93
|
-
**Deploying:** `modelrig`
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
92
|
+
**Deploying:** `modelrig` needs a **Node** runtime (not Edge/Workers), and if
|
|
93
|
+
your deploy bundles server code you must mark it external — Next.js
|
|
94
|
+
`serverExternalPackages: ['modelrig']`, esbuild `--external:better-sqlite3`,
|
|
95
|
+
webpack `externals`. Set `MODELRIG_API_KEY` on every service, worker, and cron
|
|
96
|
+
that runs a rig; hosted-platform specifics are in [Deploying](https://modelrig.dev/deploying.html).
|
|
98
97
|
|
|
99
98
|
```ts
|
|
100
99
|
import { createRig, loadConfigFromEnv } from "modelrig";
|
|
@@ -117,12 +116,21 @@ MODELRIG_TELEMETRY_DB=./.modelrig/telemetry.db # default
|
|
|
117
116
|
MODELRIG_ENVELOPE_BUDGET_USD=25 # default envelope budget
|
|
118
117
|
```
|
|
119
118
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
119
|
+
### 2. Confirm the org
|
|
120
|
+
|
|
121
|
+
<!-- BLOCK:CONFIRM_ORG -->
|
|
122
|
+
**Confirm the org before you trust an empty console.** Run `modelrig doctor` from the same environment your app runs in. It asks GET /v1/whoami which organization the key belongs to, and the name it prints must match the org badge in the console header. If it names a different organization, your data is landing there: switch the console to that organization, or mint a key in the one you meant (https://modelrig.dev/orgs-and-keys.html).
|
|
124
123
|
|
|
125
|
-
|
|
124
|
+
```bash
|
|
125
|
+
npx modelrig doctor
|
|
126
|
+
# [modelrig] key rig_sk_…AbCd → org «Your Org» ✓ (ingest https://api.modelrig.ai, …)
|
|
127
|
+
|
|
128
|
+
# No CLI in that environment? Ask the API directly:
|
|
129
|
+
curl -H "Authorization: Bearer $MODELRIG_API_KEY" https://api.modelrig.ai/v1/whoami
|
|
130
|
+
```
|
|
131
|
+
<!-- /BLOCK:CONFIRM_ORG -->
|
|
132
|
+
|
|
133
|
+
### 3. Define a route bundle
|
|
126
134
|
|
|
127
135
|
One YAML file per route under `modelrig/routes/`:
|
|
128
136
|
|
|
@@ -175,15 +183,15 @@ types allowed, and `format` is annotation-only — it is not asserted (an
|
|
|
175
183
|
`email`/`date-time` format is documentation, not a constraint). Author 2020-12
|
|
176
184
|
unless you have a draft-07 schema already; both work.
|
|
177
185
|
|
|
178
|
-
###
|
|
186
|
+
### 4. Call it
|
|
179
187
|
|
|
180
188
|
```ts
|
|
181
189
|
const rig = createRig(loadConfigFromEnv());
|
|
182
190
|
|
|
183
191
|
const result = await rig.run("example.support_summarize", {
|
|
184
192
|
input: { ticket: rawTicket, product: "Acme Cloud", priorContext: history },
|
|
185
|
-
tags: {
|
|
186
|
-
budget: { envelope: "
|
|
193
|
+
tags: { subject: "acme", feature: "summarize" },
|
|
194
|
+
budget: { envelope: "ticket-123" }, // hard-stop cost envelope for the run
|
|
187
195
|
});
|
|
188
196
|
|
|
189
197
|
result.output; // JSON, already validated against your schema
|
|
@@ -195,51 +203,193 @@ result.meta.attemptsByClass; // retries consumed, per failure class
|
|
|
195
203
|
rig.close();
|
|
196
204
|
```
|
|
197
205
|
|
|
198
|
-
###
|
|
206
|
+
### 5. Wrap it in a run — the standard path
|
|
199
207
|
|
|
200
208
|
**Every pipeline execution is a run.** A run is the standard way ModelRig records
|
|
201
|
-
what your workstream did — not an appendix.
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
209
|
+
what your workstream did — not an appendix. The console's **Runs** tab then shows
|
|
210
|
+
the run → step → artifact chain you can click through, and `/projects` groups it
|
|
211
|
+
by tag.
|
|
212
|
+
|
|
213
|
+
<!-- BLOCK:RUN_WRAP -->
|
|
214
|
+
**Wrap one pipeline execution in a run.** Every pipeline execution is a run. Wrap each execution in `run.scope` (or `run.start` / `run.end`), name one step per model call with `stepKey`, `artifact.save` the work products, and pass `environment` so the Env column on /runs is filled. Inside the run the SDK stamps `run_id` and `step` on every call. `run_id` is reserved: don't set it yourself.
|
|
205
215
|
|
|
206
216
|
```ts
|
|
217
|
+
import { createRig, loadConfigFromEnv } from "modelrig";
|
|
218
|
+
|
|
207
219
|
const rig = createRig(loadConfigFromEnv());
|
|
208
220
|
|
|
209
|
-
//
|
|
210
|
-
//
|
|
221
|
+
// Every pipeline execution is a run. Inside the scope the SDK records each
|
|
222
|
+
// rig.run / rig.runRaw call as a step and stamps run_id and step on every row.
|
|
223
|
+
// run_id is reserved: don't set it yourself (put your own attempt id in a tag of
|
|
224
|
+
// your own, such as pipeline_attempt_id).
|
|
211
225
|
await rig.artifacts.run.scope(
|
|
212
|
-
{ pipeline: "support", episodeKey: ticketId },
|
|
226
|
+
{ pipeline: "support", episodeKey: ticketId, environment: process.env.NODE_ENV ?? "development" },
|
|
213
227
|
async () => {
|
|
214
228
|
const result = await rig.run("example.support_summarize", {
|
|
215
229
|
input: { ticket, product, priorContext },
|
|
216
|
-
tags: { subject: customer, feature: "summarize" },
|
|
217
|
-
stepKey: "summarize",
|
|
230
|
+
tags: { subject: customer, feature: "summarize" },
|
|
231
|
+
stepKey: "summarize", // names this step on /runs
|
|
218
232
|
});
|
|
219
|
-
|
|
220
|
-
rig.artifacts.artifact.save(result.output, { name: "summary", type: "step_output" });
|
|
233
|
+
rig.artifacts.artifact.save(result.output, { name: "summary", type: "step_output", stepKey: "summarize" });
|
|
221
234
|
},
|
|
222
235
|
);
|
|
223
|
-
|
|
236
|
+
|
|
237
|
+
await rig.close(); // flushes the exporter — call once at shutdown
|
|
224
238
|
```
|
|
239
|
+
<!-- /BLOCK:RUN_WRAP -->
|
|
225
240
|
|
|
226
|
-
- **Tags:** carry `subject` (what the run is *about*) and `feature`. You no longer
|
|
227
|
-
hand-write `run_id` — **inside a run context the SDK stamps `tags.run_id`** (the
|
|
228
|
-
run's `episodeKey`, else its id) on every attempt row of both lanes; a value you
|
|
229
|
-
pass always wins, and outside a run context nothing is stamped. It also stamps
|
|
230
|
-
`tags.step` (the current step key) the same way; a value you pass always wins,
|
|
231
|
-
so name the step yourself with `stepKey` (or `tags.step`) when you want a
|
|
232
|
-
specific label.
|
|
233
241
|
- **Raw lane:** a `rig.runRaw` call inside a run context records a ground-truth
|
|
234
242
|
step too (since 0.5.0), so grounded/cached pipelines fill the same graph.
|
|
235
|
-
- **
|
|
236
|
-
|
|
237
|
-
|
|
243
|
+
- **Reserved tags:** `run_id` and `step` are stamped by the SDK; the full list of
|
|
244
|
+
reserved keys is in the
|
|
245
|
+
[instrumentation guide](instrumentation.md#reserved-tag-keys-the-one-list).
|
|
246
|
+
|
|
247
|
+
The full artifact API — lineage (`link`), grades, the reusable per-step seam, and
|
|
248
|
+
`run.scope` vs `run.start` — is the [instrumentation guide](instrumentation.md).
|
|
249
|
+
|
|
250
|
+
### 6. See it on /runs
|
|
251
|
+
|
|
252
|
+
Open `/runs` in the console, with the org badge showing the org `doctor` named:
|
|
253
|
+
the run, its steps in order, and the artifacts you saved. `modelrig status`
|
|
254
|
+
prints `runs recorded: N (last: …)` as the local mirror, and `modelrig validate`
|
|
255
|
+
warns if a rig records calls but never starts a run. If the page is empty:
|
|
256
|
+
|
|
257
|
+
<!-- BLOCK:EMPTY_CONSOLE -->
|
|
258
|
+
**The console is empty: five checks, in order.** If /runs (or /inferences) is empty for the org in the header badge, work these checks in order. The full tree is https://modelrig.dev/troubleshooting.html.
|
|
259
|
+
|
|
260
|
+
```text
|
|
261
|
+
1. npx modelrig doctor, from the environment your app runs in.
|
|
262
|
+
no export sink configured → this process does not see MODELRIG_API_KEY: set it, redeploy, open a new shell.
|
|
263
|
+
AUTH FAILED (401 / 403) → the key is mistyped, revoked or not accepted: mint a key, set it, redeploy, open a new shell.
|
|
264
|
+
2. The org doctor prints is not the org in the badge → wrong org: switch the console, or mint a key in the org you meant.
|
|
265
|
+
3. /inferences has rows but /runs is empty → the calls are not inside run.scope / run.start.
|
|
266
|
+
4. A run is missing a step or a cost → that call is not on a ModelRig lane (see not-captured).
|
|
267
|
+
5. A doc describes something your install lacks → compare `npm ls modelrig` with the version stamp in modelrig.dev/llms.txt.
|
|
268
|
+
```
|
|
269
|
+
<!-- /BLOCK:EMPTY_CONSOLE -->
|
|
270
|
+
|
|
271
|
+
## Change your route's model live (no redeploy)
|
|
272
|
+
|
|
273
|
+
A route's **call-config** — which model/provider serves it, and its sampling — can be
|
|
274
|
+
changed *while your app runs*, without editing YAML or redeploying. You set it in the
|
|
275
|
+
console (the route's **call-config card**), or your coding agent sets it for you over
|
|
276
|
+
MCP (`set_call_config`, below); the SDK reads the current config **just-before-call** and
|
|
277
|
+
merges it over your bundle. Two modes:
|
|
278
|
+
|
|
279
|
+
- **`pin`** — one model serves the route right now.
|
|
280
|
+
- **`experiment`** — a weighted live A/B across arms, with the chosen arm recorded on
|
|
281
|
+
every row so the console can score it.
|
|
282
|
+
|
|
283
|
+
**See what a route serves — before its first call.** Your YAML stays the deploy-time
|
|
284
|
+
default and the fail-open safety net; ModelRig is where you *see* and *change* it. A rig
|
|
285
|
+
created with a `routesDir` **and** a control-plane key registers each route the moment
|
|
286
|
+
`createRig()` runs — its metadata (route, version, candidates) **and its declared bundle**
|
|
287
|
+
(the prompt *template* with its `{{placeholders}}`, schema, policy, plus a content hash):
|
|
288
|
+
fire-and-forget, fail-open, through the same `/v1/ingest` call telemetry uses (the
|
|
289
|
+
`ingest` scope is enough). The bundle is stored as **route configuration**, not captured
|
|
290
|
+
content — it holds the authored template, never per-call values — so it is stored even when
|
|
291
|
+
your org's capture posture is `off` (telemetry rows are still dropped then). Registering
|
|
292
|
+
the bundle is what lets the control plane **validate and accept a pin** for the route: a
|
|
293
|
+
pin is checked against the route's `require` before it is written, so a route with no
|
|
294
|
+
registered bundle refuses pins with a teaching 422. If you promote a prompt version in
|
|
295
|
+
ModelRig (Prompt System of Record), the promoted template wins over the one in your YAML
|
|
296
|
+
on every later registration; everything else (candidates, schema, policy) follows your
|
|
297
|
+
deploy. So every route shows up in the console and over MCP right away, and one read
|
|
298
|
+
answers *"what will this route serve, and why?"*:
|
|
299
|
+
|
|
300
|
+
```bash
|
|
301
|
+
curl -H "authorization: Bearer $MODELRIG_API_KEY" \
|
|
302
|
+
"${MODELRIG_INGEST_URL:-https://api.modelrig.ai}/v1/routes/example.support_summarize/call-config?include=effective"
|
|
303
|
+
```
|
|
304
|
+
|
|
305
|
+
```jsonc
|
|
306
|
+
{
|
|
307
|
+
"version": 0, "mode": null, "config": null, // no override yet
|
|
308
|
+
"effective": {
|
|
309
|
+
"source": "deployed_default", // pin | experiment | deployed_default | unknown
|
|
310
|
+
"provider": "openai", "model": "gpt-5.4-mini", // your YAML's first candidate
|
|
311
|
+
"version": 1, // the YAML route version
|
|
312
|
+
"since": "2026-10-10T12:00:00Z" // when the deployment last declared it
|
|
313
|
+
},
|
|
314
|
+
"drift": null
|
|
315
|
+
}
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
`source: "pin"` means a call-config pin is serving (its `version` is the call-config
|
|
319
|
+
version); `unknown` means no deployment has registered the route in your org yet. When a
|
|
320
|
+
pin is set but recent calls on the route served a **different** model, `drift` says so —
|
|
321
|
+
`{ servedProvider, servedModel, calls, lastSeen, pinnedCalls, windowStart }` (last 24h,
|
|
322
|
+
starting 5 minutes after the pin, ≤500 calls sampled). Drift means your app is not
|
|
323
|
+
honoring the pin: its resolver is failing open (an older SDK, a wrong `MODELRIG_API_KEY`,
|
|
324
|
+
or a call path that never resolves call-config — see below). The console's call-config
|
|
325
|
+
card shows the same thing as **Serving: \<model\> — \<pin vN | YAML default\>** plus a
|
|
326
|
+
drift warning; `get_call_config` over MCP returns it too. Without `?include=effective`
|
|
327
|
+
the response is unchanged (that is what the SDK's serve-time poll reads).
|
|
328
|
+
|
|
329
|
+
**Read call-config just-before-call.** Build a resolver once (it caches with a short TTL
|
|
330
|
+
and revalidates by ETag — no per-call network cost when fresh), then overlay the current
|
|
331
|
+
config onto a bundle and serve it through `rig.runBundle()`:
|
|
332
|
+
|
|
333
|
+
```ts
|
|
334
|
+
import {
|
|
335
|
+
createRig, loadConfigFromEnv,
|
|
336
|
+
createApiCallConfigFetcher, createCallConfigResolver,
|
|
337
|
+
getCallConfig, // pin-only convenience: route + bundle → runnable bundle
|
|
338
|
+
} from "modelrig";
|
|
339
|
+
|
|
340
|
+
const rig = createRig(loadConfigFromEnv());
|
|
341
|
+
|
|
342
|
+
// Build once, reuse across calls. TTL is the cache-freshness window (~30–60s).
|
|
343
|
+
const resolver = createCallConfigResolver({
|
|
344
|
+
fetcher: createApiCallConfigFetcher({
|
|
345
|
+
ingestUrl: process.env.MODELRIG_INGEST_URL ?? "https://api.modelrig.ai",
|
|
346
|
+
apiKey: process.env.MODELRIG_API_KEY!, // a read needs no special scope
|
|
347
|
+
}),
|
|
348
|
+
ttlMs: 30_000,
|
|
349
|
+
});
|
|
350
|
+
|
|
351
|
+
// `bundle` is the route's deploy-time bundle you already hold (see runBundle below).
|
|
352
|
+
// getCallConfig merges the live PIN over it; with no override it returns the SAME
|
|
353
|
+
// bundle reference — byte-identical to today.
|
|
354
|
+
const runnable = await getCallConfig("example.support_summarize", { resolver, bundle });
|
|
355
|
+
const result = await rig.runBundle(runnable, { input, tags });
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
**Fail-open, always.** The read **never throws**: on any error it serves the last-known-good
|
|
359
|
+
config, and a route with **no override resolves byte-identical** to the deploy-time bundle
|
|
360
|
+
(the same bundle reference, unchanged). Turning this on adds no failure mode to the hot path.
|
|
361
|
+
|
|
362
|
+
**Where it applies.** Call-config is overlaid onto a **bundle** you serve through
|
|
363
|
+
`rig.run()` / `rig.runBundle()` — **not** `rig.runRaw`. The raw lane is BYOK and has no
|
|
364
|
+
route or bundle to overlay, so a routeless raw-lane caller that wants live routing must
|
|
365
|
+
first own a route/bundle (build one with `bundleFromResolved`, or resolve one from disk)
|
|
366
|
+
and serve it through `runBundle`.
|
|
367
|
+
|
|
368
|
+
**A/B — draw an arm locally, record it.** For `mode='experiment'`, resolve the config and
|
|
369
|
+
draw the arm for this one call with `resolveCallConfigForRun`, then thread the arm name onto
|
|
370
|
+
`rig.runBundle(..., { arm })` so it lands on `inferences.meta.arm`:
|
|
371
|
+
|
|
372
|
+
```ts
|
|
373
|
+
const resolved = await resolver.getCallConfig("example.support_summarize");
|
|
374
|
+
const { bundle: runnable, arm } = resolveCallConfigForRun(bundle, resolved, {
|
|
375
|
+
input, // stickyKey (if set) reads its unit from here…
|
|
376
|
+
// unitKey: userId, // …or pass the unit key explicitly (sticky assignment)
|
|
377
|
+
});
|
|
378
|
+
const result = await rig.runBundle(runnable, { input, tags, arm });
|
|
379
|
+
// arm is null for a pin / no-override / non-experiment call ⇒ no meta.arm (byte-identical).
|
|
380
|
+
```
|
|
381
|
+
|
|
382
|
+
Sticky assignment means the **same unit always draws the same arm**, so the A/B is measured
|
|
383
|
+
honestly. The console reads per-arm outcomes at `GET /v1/console/ab-readout?route=<route>`.
|
|
384
|
+
How `meta.arm` is populated and overlaid is in the
|
|
385
|
+
[instrumentation guide](instrumentation.md#live-call-config-and-ab-arms).
|
|
238
386
|
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
387
|
+
**Set it from your coding agent (MCP).** The `modelrig-oracle` MCP server exposes
|
|
388
|
+
`get_call_config`, `set_call_config` (`pin` or `experiment`), and `rollback_call_config`, so
|
|
389
|
+
the agent in your editor can pin a model or start an A/B **on your behalf** — a real,
|
|
390
|
+
versioned, reversible control-plane change (not a draft). Writes need a `rig_sk_` key with
|
|
391
|
+
the **`route-config`** scope; reads need none. The full flow, the eligibility gate, and the
|
|
392
|
+
rollback contract are in [The MCP oracle → Setting a route's live config](mcp-oracle.md#setting-a-routes-live-config).
|
|
243
393
|
|
|
244
394
|
## When it fails, it fails typed
|
|
245
395
|
|
|
@@ -286,21 +436,44 @@ worker, and cron that constructs a rig — a process without it buffers to its o
|
|
|
286
436
|
local SQLite and ships nothing. A multi-service deployment that sets the key on
|
|
287
437
|
only the web tier silently loses every row a worker or cron produced.
|
|
288
438
|
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
[
|
|
293
|
-
|
|
294
|
-
|
|
439
|
+
Turning **Optimization on** for a route (`capture: true`) is the **recommended
|
|
440
|
+
default** — your traffic is what makes the routing smarter and the bill smaller,
|
|
441
|
+
and everything it keeps you can see, export and delete in the console. Keeping the
|
|
442
|
+
prompts, outputs and evidence too is [content custody](content-custody.md), which
|
|
443
|
+
is **on by default** — every new org is created managed, having accepted the
|
|
444
|
+
published terms at signup — and captures into your managed store, scrubbed for the
|
|
445
|
+
PII/PHI you classify. Either way the **opt-out is one account setting** (the
|
|
446
|
+
console or the `set_org_settings` MCP tool): set posture `off` to capture nothing
|
|
447
|
+
or `metadata` to keep hashes only, or use a `zero_retention` route.
|
|
448
|
+
Pure router (capture off) stays real and selectable, at the same flat 2%.
|
|
449
|
+
|
|
450
|
+
Telemetry says what happened; a **grade** says whether it was good. Attach a
|
|
451
|
+
0–1 score (up = 1, down = 0) to a call or a whole run with `rig.grade(...)` —
|
|
452
|
+
from the SDK or over HTTP for a non-SDK surface (see the
|
|
453
|
+
[grade protocol](grade-protocol.md)) — and every run gets an automatic
|
|
454
|
+
`run-outcome@v1` grade, with an explicit, bounded model judge available when
|
|
455
|
+
you want one (see the [grade protocol](grade-protocol.md#native-run-grades)).
|
|
456
|
+
|
|
457
|
+
## Serve without holding the provider key (optional)
|
|
458
|
+
|
|
459
|
+
Everything above runs on **your** provider key — `destination: direct`, the
|
|
460
|
+
default, and nothing here changes it. If you would rather ModelRig serve a
|
|
461
|
+
route's model on its own credentials and bill it from a prepaid balance, declare
|
|
462
|
+
`destination: modelrig-served` on the route, set `managedServing: true` in the
|
|
463
|
+
rig config, mint a key with the `serve` scope, and turn managed serving on in
|
|
464
|
+
Account settings. The walk-through, including what each refusal teaches, is
|
|
465
|
+
[Managed serving](managed-serving.md).
|
|
295
466
|
|
|
296
467
|
## Runtime requirements
|
|
297
468
|
|
|
298
469
|
ModelRig assumes a **long-lived Node process with a writable disk**, and a few
|
|
299
470
|
things follow from that. Check them before you deploy:
|
|
300
471
|
|
|
301
|
-
- **Node ≥ 20
|
|
302
|
-
|
|
303
|
-
|
|
472
|
+
- **Node ≥ 20.** The local telemetry buffer is `better-sqlite3` (a C/C++
|
|
473
|
+
addon): it installs from a prebuilt binary on macOS and Linux (x64/arm64), and
|
|
474
|
+
compiles at install time anywhere else — on such a platform, or a slim
|
|
475
|
+
container without the prebuilt, add the build essentials (`python3`, `make`, a
|
|
476
|
+
C++ compiler).
|
|
304
477
|
- **A writable disk.** Telemetry and captures go to a local SQLite file
|
|
305
478
|
(`MODELRIG_TELEMETRY_DB`, default `./.modelrig/telemetry.db`); the background
|
|
306
479
|
exporter batches from it. A read-only filesystem breaks this.
|
|
@@ -329,8 +502,9 @@ loader's own words, is in [route-bundles.md](./route-bundles.md#when-it-doesnt-w
|
|
|
329
502
|
- **The bundle won't load, naming an undeclared variable.** A `{{name}}` in the
|
|
330
503
|
template isn't in `prompt.variables`. Add it (or fix the typo).
|
|
331
504
|
- **The first call succeeds locally but nothing appears in the console.**
|
|
332
|
-
`MODELRIG_API_KEY` isn't set in that environment
|
|
333
|
-
|
|
505
|
+
Usually `MODELRIG_API_KEY` isn't set in that environment, or it belongs to a
|
|
506
|
+
different org than the one the console is showing. Run `npx modelrig doctor`
|
|
507
|
+
there and work through [Troubleshooting an empty console](https://modelrig.dev/troubleshooting.html).
|
|
334
508
|
- **The call runs but the output isn't what the old code produced.** Usually a
|
|
335
509
|
wrong `json: native` — a claim about the model, valid only for one whose
|
|
336
510
|
registry entry shows probed `structured_native`. Check the probed registry,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "modelrig",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "ModelRig — capability-aware AI gateway: routes-as-code, provider adapters, typed failures, budget envelopes, and local-first telemetry.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -24,10 +24,11 @@
|
|
|
24
24
|
},
|
|
25
25
|
"main": "dist/index.js",
|
|
26
26
|
"types": "dist/index.d.ts",
|
|
27
|
-
"//exports": "ADDITIVE sub-path map (RP-1). `.` preserves the historical bare entry; `./receipts` (Receipt@v1 shape + canonicalize/hash/classification) is exposed ONLY here, never re-exported from index.ts (keeps the public surface — and index.ts's LOC — untouched). `./data/*` + `./registry/*` keep the runtime data/registry files reachable now that an exports map turns resolution into an allowlist. The root `receipts.d.ts` re-export
|
|
27
|
+
"//exports": "ADDITIVE sub-path map (RP-1). `.` preserves the historical bare entry; `./receipts` (Receipt@v1 shape + canonicalize/hash/classification) is exposed ONLY here, never re-exported from index.ts (keeps the public surface — and index.ts's LOC — untouched). `./screen` (IP-2a-1) exposes the SC-0/SC-1 screening surface the same way — the server's grader assembly reuses assemblePrompt + createPatternDetector rather than forking the delimiting logic; still never re-exported from index.ts. `./data/*` + `./registry/*` keep the runtime data/registry files reachable now that an exports map turns resolution into an allowlist. The root `receipts.d.ts` / `screen.d.ts` re-export shims exist ALONGSIDE this so classic-`Node` moduleResolution consumers (e.g. modelrig-server) type-resolve the sub-paths too.",
|
|
28
28
|
"exports": {
|
|
29
29
|
".": { "types": "./dist/index.d.ts", "default": "./dist/index.js" },
|
|
30
30
|
"./receipts": { "types": "./dist/receipts/types.d.ts", "default": "./dist/receipts/types.js" },
|
|
31
|
+
"./screen": { "types": "./dist/screen/index.d.ts", "default": "./dist/screen/index.js" },
|
|
31
32
|
"./package.json": "./package.json",
|
|
32
33
|
"./data/*": "./data/*",
|
|
33
34
|
"./registry/*": "./registry/*"
|
|
@@ -40,6 +41,7 @@
|
|
|
40
41
|
"dist",
|
|
41
42
|
"data",
|
|
42
43
|
"receipts.d.ts",
|
|
44
|
+
"screen.d.ts",
|
|
43
45
|
"registry/registry.json",
|
|
44
46
|
"registry/leaderboard.json",
|
|
45
47
|
"README.md",
|
|
@@ -49,8 +51,19 @@
|
|
|
49
51
|
"docs/instrumentation.md",
|
|
50
52
|
"docs/how-it-fits.md",
|
|
51
53
|
"docs/migration-playbook.md",
|
|
54
|
+
"docs/mcp-oracle.md",
|
|
55
|
+
"docs/managed-serving.md",
|
|
52
56
|
"docs/agent-skill/SKILL.md",
|
|
53
|
-
"docs/llms.txt"
|
|
57
|
+
"docs/llms.txt",
|
|
58
|
+
"templates/ticket-triage.json",
|
|
59
|
+
"templates/document-extraction.json",
|
|
60
|
+
"templates/cs-next-action.json",
|
|
61
|
+
"templates/lead-qualification.json",
|
|
62
|
+
"templates/compliance-review.json",
|
|
63
|
+
"templates/catalog-cleansing.json",
|
|
64
|
+
"templates/call-disposition-qa.json",
|
|
65
|
+
"templates/financial-classification.json",
|
|
66
|
+
"templates/medical-classification.json"
|
|
54
67
|
],
|
|
55
68
|
"scripts": {
|
|
56
69
|
"build": "tsc",
|
|
@@ -63,10 +76,11 @@
|
|
|
63
76
|
"@google/genai": "^2.4.0",
|
|
64
77
|
"ajv": "^8.17.0",
|
|
65
78
|
"better-sqlite3": "^11.10.0",
|
|
66
|
-
"openai": "^
|
|
79
|
+
"openai": "^7.13.0",
|
|
67
80
|
"yaml": "^2.6.0"
|
|
68
81
|
},
|
|
69
82
|
"devDependencies": {
|
|
83
|
+
"@modelrig/glossary": "workspace:*",
|
|
70
84
|
"@types/better-sqlite3": "^7.6.12",
|
|
71
85
|
"tsx": "^4.21.0",
|
|
72
86
|
"typescript": "^5.2.0",
|