Setup β point your coding agent at it
Docs β quickstart, troubleshooting, every pagePoint your coding agent at it β it reads the docs, finds any LLM calls you already have, and picks a lane for each. That path comes first on every step below: copy the prompt, paste it into Claude Code, Codex, or Cursor from inside your project, and your agent does the step. Prefer your own hands? The exact snippet sits right under it, complete as shown.
9 steps, each checked off by real data this console reads β not by clicking a box. Prerequisites carry a β β YAMLiA human-friendly config format β indentation defines structure. more βΈ, JSON SchemaiA contract describing what valid output looks like. more βΈ, environment variablesiA named value your shell passes to programs β how keys and settings reach ModelRig without living in code. more βΈ, and the CLIiThe command line β you type a command in a terminal and the program runs. more βΈ each get one plain sentence and a link out.
modelrig 0.19.0 is on npm (Apache-2.0, Node >= 20) β the commands below install and run. It builds a native module (better-sqlite3), so give it a toolchain. Pricing is the standard terms: BYOK calls are free for the first 1M requests a month, then a flat 2%; managed calls are list price + 2% from your prepaid balance. The probe suite, registry and leaderboard stay public and reproducible.
Before you start β your ModelRig key
One rig_sk_ key is the only ModelRig credential your app ever holds β it names your org, so your telemetry lands in yours and nowhere else. Create one below, copy the MODELRIG_API_KEY=β¦ line it shows once, and set it beside your provider keys (checklist step 1 ticks when it exists). Your coding agent only checks that MODELRIG_API_KEY is set; it never reads the value.
Sign in to create a key. Keys are issued to an organization, so this page needs to know which one you belong to.
Everything you see in this console needs the key: Runs, Calls, grades, the gateway, modelrig doctor's org check, and every checklist step below. Without one, the SDK still serves your calls and records telemetry to ./.modelrig/telemetry.db on your machine (npx modelrig status reads it), but nothing reaches this console.
Instrument your project
The fastest migration is the one your agent performs β that path comes first. Prefer your own hands? The steps, spelled out.
Paste this into Claude Code, Codex, or Cursor from inside your project. Your agent reads the docs, finds your LLM call sites, and picks a lane for each one:
Migrate this project's LLM calls to ModelRig (https://modelrig.dev).
Work the details from the docs yourself; STOP and present to your human at each βΈ checkpoint.
OPERATING RULES (read first; they override anything you remember):
R1. Ground in live surfaces, never memory: which models are probed, which knobs a
provider honors, what a claim means β ask https://modelrig.dev/llms.txt, the
raw-lane support matrix (modelrig.dev/route-bundles.html), rawKnobSupport(),
or the MCP oracle. What the routing engine does and does not do at run time
(fall-through triggers, the repair rung, what is stored, what is NOT built) is
https://modelrig.dev/routing-reliability.html β read its "Not yet implemented"
section before proposing any behaviour that depends on a route-declared judge or
raw-lane structure. Declared capability and probed behaviour differ β that gap
is ModelRig's entire thesis.
R2. Key custody: never create accounts, sign in, or read/transmit/store provider
key VALUES. Existence checks by NAME only; humans place keys.
R3. Behaviour-identical, or a NAMED change presented at a checkpoint. Never a
silent change β not sampling, not caching, not grounding, not enforcement.
R4. A ModelRig knob that is absent is byte-identical to before; a declared knob a
provider cannot honor FAILS CLOSED with a classified error. If you hit one,
that is the product working β consult the matrix, don't work around it.
R5. If the human's answers conflict with each other or with the code you read,
STOP and surface the conflict. If they ask for something ModelRig does not
support, say so directly and propose the closest supported alternative β
never improvise.
R6. The rig has a lifecycle: create it ONCE (module singleton for a server;
per-invocation for a one-shot job) and await rig.close() before exit, or
telemetry is lost and timers hang the process.
R7. Run the project's own tests before proposing any merge; show the diff.
R8. Every pipeline execution is a run. Wrap each execution in run.start /
run.scope, name each model call's step with stepKey, and artifact.save the work
products; tag subject and feature (inside a run context the SDK stamps run_id
AND step for you β run_id is reserved: never set it yourself; put the
pipeline's own attempt id in a tag of your own, such as pipeline_attempt_id).
Always pass stepKey on every rig.runRaw call: it is also the step's handle
for step config, so the human can re-pin that step's model,
tier or Flex window from the console (Routes & steps) or MCP set_call_config
with no redeploy; with no pin the call runs exactly the model your code passes.
Pass environment on the run so the Env column on Runs (/runs) is filled. subject
is your end-customer's opaque id β it powers the per-customer tenant statements
on Tenants (/tenants); a tag named client/tenant is only a cost dimension.
Acceptance: the run appears on /runs with its steps and artifacts β a migration
is not done until one real execution shows a run with steps there. The
canonical wrap, raw lane first (no routes needed):
import { createRig, loadConfigFromEnv } from "modelrig";
// No route files: the raw lane. Each rig.runRaw inside the scope records a step.
const rig = createRig({ ...loadConfigFromEnv(), routesDir: null });
await rig.artifacts.run.scope(
{ pipeline: "support", episodeKey: ticketId, environment: process.env.NODE_ENV ?? "development" },
async () => {
const result = await rig.runRaw({
provider: "openai",
model: "gpt-5.4-mini",
apiKey: process.env.OPENAI_API_KEY ?? "", // your provider key, from your own environment
systemPrompt: "Summarize this support ticket in two sentences.",
userPrompt: ticket,
tags: { subject: customer, feature: "summarize" },
stepKey: "summarize", // names this step on /runs
});
rig.artifacts.artifact.save(result.output, { name: "summary", type: "step_output", stepKey: "summarize" });
},
);
await rig.close(); // flushes the exporter β call once at shutdown
With a route (T2, step 5), the same wrap calls rig.run instead:
import { createRig, loadConfigFromEnv } from "modelrig";
const rig = createRig(loadConfigFromEnv());
// Every pipeline execution is a run. Inside the scope the SDK records each
// rig.run / rig.runRaw call as a step and stamps run_id and step on every row.
// run_id is reserved: don't set it yourself (put your own attempt id in a tag of
// your own, such as pipeline_attempt_id).
await rig.artifacts.run.scope(
{ pipeline: "support", episodeKey: ticketId, environment: process.env.NODE_ENV ?? "development" },
async () => {
const result = await rig.run("example.support_summarize", {
input: { ticket, product, priorContext },
tags: { subject: customer, feature: "summarize" },
stepKey: "summarize", // names this step on /runs
});
rig.artifacts.artifact.save(result.output, { name: "summary", type: "step_output", stepKey: "summarize" });
},
);
await rig.close(); // flushes the exporter β call once at shutdown
A provider call your code makes directly (a client ModelRig has no lane for, a stream you read yourself, an embedding, a fallback) is invisible until you report it. Call `rig.recordCall` right after it returns, inside the run, with the tokens the provider reported: the call shows on /inferences as "Reported by your code", joins its run and step, and counts toward cost. It is synchronous and never throws; invalid input warns once and records nothing (`inferenceId: null`). Spread optional fields only when the provider reported them, so the call type-checks under `exactOptionalPropertyTypes`.
const started = Date.now();
const resp = await genai.models.generateContent({ model: "gemini-3.1-pro-preview", contents });
const u = resp.usageMetadata;
const finishReason = resp.candidates?.[0]?.finishReason;
const rec = rig.recordCall({
provider: "gemini",
model: "gemini-3.1-pro-preview",
usage: {
tokensIn: u?.promptTokenCount ?? 0, // total input, cached included
tokensOut: (u?.candidatesTokenCount ?? 0) + (u?.thoughtsTokenCount ?? 0),
tokensCached: u?.cachedContentTokenCount ?? 0,
// optional fields: spread only when the provider reported them
...(u?.thoughtsTokenCount !== undefined ? { reasoningTokens: u.thoughtsTokenCount } : {}),
},
servedTier: "standard", // the tier that SERVED the call: pass what the provider reports (flex, priority); it is priced at that tier
latencyMs: Date.now() - started,
stepKey: "summarize", // the step on /runs (inside run.scope / run.start)
...(finishReason !== undefined ? { finishReason } : {}),
});
if (rec.inferenceId !== null) rig.grade({ kind: "inference", id: rec.inferenceId }, { score: 1, kind: "deterministic" });
ModelRig records the calls your code makes through the SDK (`rig.run`, `rig.runBundle`, `rig.runRaw`, `rig.runRawStream`) or the gateway, plus any call your code makes itself and reports with `rig.recordCall`. Nothing else is seen. Five things stay invisible or unattached unless you record them: (1) direct provider SDK calls, with or without a JSON schema; (2) streams you read from a provider client yourself; (3) a fallback your code makes after the raw lane refuses a `responseSchema` it cannot enforce (deepseek, deepinfra, fireworks and zai fail closed with `invariant_violation`); (4) calls made outside `run.scope` / `run.start`, which land on /inferences but on no run; (5) embeddings. A recorded call shows as "Reported by your code": ModelRig neither dispatched nor validated it, and its tokens are the numbers you reported. Details and the console tells: https://modelrig.dev/not-captured.html.
R9. Confirm the org before you trust an empty console. Run `modelrig doctor` from the same environment your app runs in, once your app has started with the key. It asks GET /v1/whoami which organization the key belongs to and prints the org's name and, in parentheses, its slug; the name 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).
npx modelrig doctor
# [modelrig] key rig_sk_β¦AbCd β org Β«Your OrgΒ» (your-org) β (ingest https://api.modelrig.ai, β¦)
# No CLI in that environment? Ask the API directly (same host the SDK uses):
curl -H "Authorization: Bearer $MODELRIG_API_KEY" "${MODELRIG_INGEST_URL:-https://api.modelrig.ai}/v1/whoami"
Do this after the key is set and again after every deploy; on a hosted worker,
run it from a NEW shell opened after the deploy finished.
0. PERSISTENT GROUNDING (do this before anything else):
a. Add to this repo's agent instructions (CLAUDE.md, AGENTS.md, .cursorrules β
whichever exists; create CLAUDE.md if none):
"Before writing ModelRig code, fetch https://modelrig.dev/llms.txt β
probed facts change; do not rely on memorized models or parameters."
b. If your tool supports MCP servers, register the ModelRig oracle and ASK it
rather than recalling (query_registry, get_leaderboard, explain_pricing,
get_call_notes):
{ "mcpServers": { "modelrig": { "command": "npx", "args": ["modelrig-oracle"] } } }
c. Keys: check only that MODELRIG_API_KEY is set (by NAME; never read or print
its value). Everything the human sees in the console (Runs, Calls, grades,
the org check, the gateway) needs it. If it is not set and the human wants
the console, STOP and ask them to create an org and a rig_sk_ key at
https://app.modelrig.ai (about two minutes, human-only). Without it, proceed
in local-only mode; that is fully supported: the SDK still serves calls and
records telemetry to ./.modelrig/telemetry.db on this machine (`modelrig
status` reads it), but nothing reaches the console. What to tell your
human: 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.
# Wherever your app reads configuration: .env.local, your platform's env vars, a secret manager. Never in code.
MODELRIG_API_KEY=rig_sk_β¦
1. DISCOVERY-LITE (ask, don't infer, these three; the code answers the rest):
- What is this project, and is ModelRig replacing existing LLM calls or
starting fresh?
- Which providers does it (or should it) use, and which provider keys exist?
- Hosted telemetry (app.modelrig.ai) or local-only?
Then read https://modelrig.dev/routing-reliability.html (how a call actually
behaves and what is not built), https://modelrig.dev/migration-playbook.html
(this prompt follows its T0-T2 autonomy ladder and checkpoints) and
https://modelrig.dev/quickstart.html.
2. START AT THE BOTTOM OF THE LADDER, not at routes: start at T1. Run
`modelrig observe` to see runs without migrating anything; it writes a raw-only
seam (no routes needed) that wraps the pipeline in a run, passes environment, and
reports each call with rig.recordCall so every step carries a cost β or wrap the
call sites in rig.runRaw inside run.scope as R8 shows. That is what fills /runs
(the step-8 checkpoint). T2 (routes, the steps below) is a per-call-site
graduation you earn AFTER T1 proves the plumbing β not the opening move.
Only if the human asks for it: Optional, and not where setup starts: an OpenAI-compatible client can point its base URL at https://api.modelrig.ai/v1 with your `rig_sk_` key (MODELRIG_API_KEY) as its API key, naming the model as `<provider>/<model>` (such as `openai/gpt-5.4-mini`) for a BYOK passthrough on your own provider key. A human must first store that provider key on the Vault page (https://app.modelrig.ai/vault), and a coding agent never handles the value; without a stored key the call returns 402, and it never falls back to a ModelRig key. Serving a route over the gateway needs managed serving (ask us). Gateway calls show on Calls (/inferences) but carry no run context, so they never fill Runs (/runs): runs come from the SDK path, `rig.runRaw` or `rig.recordCall` inside `run.scope`.
# Optional: point an OpenAI-compatible client at ModelRig (needs a provider key stored in Vault).
base_url = https://api.modelrig.ai/v1
api_key = $MODELRIG_API_KEY # your rig_sk_ key, sent as the bearer
model = "openai/gpt-5.4-mini" # <provider>/<model>: BYOK passthrough on the key stored in Vault (402 without one)
3. βΈ CHECKPOINT β fit and lane. Inventory the LLM call sites (generation calls
incl. JSON-extractor followups). Embeddings and web-search tool calls cannot
move onto a lane: list them anyway, and record each with rig.recordCall (R8)
so their spend is not invisible. If the codebase already has a router layer, runtime-assembled
prompts, or env-resolved model choice, do NOT externalize it into routes β
migrate ONE naive call site as a reference route and integrate the router at
the rig.runRaw seam instead. Present this as a MIGRATION RECOMMENDATION and
get explicit approval before writing any code:
Use case: <one sentence> Lane: <T1 observe / runRaw seam / T2 routes>
Call sites: <count, by provider> Keys present: <names only>
Knobs to carry (each with why): <sampling / cache / grounding / tier / reasoning β¦>
Named behaviour changes (if any): <e.g. provider-strict JSON -> own extractor>
Open questions / assumptions: <what you inferred that the human should confirm>
Ready to proceed?
4. βΈ CHECKPOINT β caching, grounding AND SAMPLING inventory, BEFORE writing any
route or seam call: search for provider caching (cachedContent, cache_control,
prompt_cache_key, cached-token usage fields), provider-native search/grounding,
and explicit sampling params (temperature, top_p, max_tokens/max_output_tokens).
Caching must be carried through (the cache handle on rig.run / rig.runRaw β
modelrig.dev/caching-lifecycle.html); grounding gaps must be REPORTED as named
behaviour changes; sampling must be PRESERVED by declaring policy.sampling
{ temperature, top_p, max_output_tokens } on the route (or the same fields on
runRaw) β a classifier at temperature 0.1 is a deliberate choice, so carry it
over exactly (absent, adapters use their own defaults; Gemini runs at 1.0).
Never migrate past any of the three silently.
5. Write routes (T2; install with the project's own package manager β pnpm/npm/
yarn; Node >= 20): modelrig/routes/<task>.yaml with the prompt in a FILE
(prompt.system: ./prompts/<task>.md, never inline), schema, candidates,
policy. Replace call sites with rig.run("<route>", { input, tags }) β tags is
REQUIRED; declare the tag keys you rely on as dimensions in rig.yaml (an
undeclared key still records; a missing required dimension only warns).
result.output arrives parsed AND schema-validated β delete your manual
JSON.parse / fence-stripping. Routes resolve from ./modelrig/routes relative
to the process CWD: in a monorepo put modelrig/ at the app root and run from
there, or set MODELRIG_ROUTES_DIR. Every file a route names (schema, prompt)
must exist or the route fails to load. A runRaw-only seam needs no routes at
all. Observing a pipeline, or recording calls your code makes itself, needs no route files. Construct the rig with `routesDir: null`: `rig.runRaw`, `rig.runRawStream` and `rig.recordCall` work at once, and `rig.run` / `rig.runBundle` refuse with a teaching error until you add routes. Without it, createRig loads ./modelrig/routes: a directory you configured that is missing throws, and a missing default directory falls back to raw-only with a one-line warning.
import { createRig, loadConfigFromEnv } from "modelrig";
// Raw-only on purpose: no route files needed. rig.runRaw, rig.runRawStream and
// rig.recordCall work; rig.run needs routes (add them later, drop routesDir: null).
const rig = createRig({ ...loadConfigFromEnv(), routesDir: null });
Keep prompt and schema semantics unchanged; if
the original was JSON-mode + app-side validation, adding schema enforcement is
an UPGRADE, not identity β present that choice at the prove-it checkpoint, or
set policy.json: json_mode for closest identity. To load-check the bundle
WITHOUT any provider key, run `modelrig validate` β it structurally loads
rig.yaml + every route and reports per-route OK / config error.
6. βΈ CHECKPOINT β candidates. Any model an adapter can reach may be a candidate β
probes gate CLAIMS, not serving. Pin what production resolves to today as
candidate #1, always. Probed models (llms.txt or the public registry) carry
evidence; an UNPROBED candidate is flagged as such and costs exactly this: no
json: native claim (the emulation ladder serves structure), no leaderboard/
bake-off priors, and possibly conservative envelope pricing until the next
sweep. Never silently substitute a probed sibling for the model production
runs; offer a probe request or a probed sibling as candidate #2. Present the
list for the human to ratify. A raw-lane step needs no route to change model:
keep the code's model as its default and the human can re-pin the step later
(step config, see R8), so do not extract a route only to switch models.
7. βΈ CHECKPOINT β prove it: run the project's tests, show the diff and every
changed file, and after first traffic compare the route's cache-hit rate and
cost against the pre-migration baseline in the console (this metric needs a
REAL run β a single probe cannot produce it; say so if it must wait). A zero
hit rate on a route that cached before is a regression; say so.
8. βΈ CHECKPOINT β see the run (R8). Open https://app.modelrig.ai/runs: your
execution is listed, expands to its steps in order, and each step carries its
inference and saved artifacts; Group by (/projects) groups the same run by its
tags. An
empty /runs after a real execution means it was not wrapped in run.start /
run.scope, or that the key exports to another org (R9) β work
https://modelrig.dev/troubleshooting.html before calling the migration done.
`modelrig status` prints "runs recorded: N (last: β¦)" as the local mirror
of the same fact.
9. ATTACH A GRADE, THEN PROVE A CHEAPER MODEL. Capture is not the whole
loop β a grade is what makes Route readiness (/coverage) and the Action queue
(/insights) meaningful. If the pipeline already has a quality
signal (a validator, a downstream accept/reject, a human QA gate), emit it as
a grade β score 1 on a clean pass, 0 on a rejection. A grade is your judgment: a 0β1 score with an optional comment, from a validator, a downstream accept/reject, a human or a model. Grade one call by its inference id (`result.meta.inferenceId`, or the `inferenceId` rig.recordCall returns). Grade a whole run by its run id, `run.runId` on the handle `run.start` returns: that grade shows on the run page and on /projects. A run grade whose id is the run's `episodeKey` also shows, on the run page only. `run_id` is a reserved tag the SDK stamps, not a variable your code has. A grade whose id matches no call or run attaches to nothing. The write is synchronous and local and never throws into your pipeline.
const run = rig.artifacts.run.start({ pipeline: "support", episodeKey: ticketId, environment: "production" });
const result = await rig.runRaw({
provider: "openai",
model: "gpt-5.4-mini",
apiKey: process.env.OPENAI_API_KEY ?? "",
systemPrompt: "Summarize this support ticket in two sentences.",
userPrompt: ticket,
tags: { subject: customer },
stepKey: "summarize",
});
run.end("succeeded");
// one call: the inference id rides on every result (rig.runRaw and rig.run alike)
rig.grade({ kind: "inference", id: result.meta.inferenceId }, { score: 1, kind: "deterministic", grader: "schema-check" });
// the whole run: its id is run.runId from run.start (shows on the run page and on /projects)
rig.grade({ kind: "run", id: run.runId }, { score: 0, kind: "human", comment: "missed the refund request" });
Ten grades on a routed call's route reach Rung 1 on Route readiness (/coverage); a
route with no schema to conform to (a prose output) gains proposal confidence
only this way. Code grades cover what your code can already check. To have an AI grader judge outputs against your rubric, create one on Graders (https://app.modelrig.ai/graders), which gives you a copy-paste prompt for your coding agent; the same prompt is at https://modelrig.dev/set-up-a-grader.html.
Then prove a cheaper model on YOUR own traffic. A bake-off replays your own inputs through the variants a route declares and reports the effective cost of conformance for each. `--variants` names entries in the route's `variants:` block (`default` is the route as declared), never model ids, and a variant can only narrow the route's candidates. Set `capture: true` first: replay works on traffic captured after that, not before. With no captured traffic (a run-based pipeline), promote a real /runs output to a golden (the console's make golden, or `promoteToEval`) and use `--from-eval-cases <task>`; its variants come from the route bundle named after the task. A bake-off measures and never switches anything.
# 1. in modelrig/routes/example.support_summarize.yaml: capture traffic, and declare
# a cheaper variant (narrowing only: its candidates must be in the route's list)
capture: true
variants:
- name: cheap
candidates:
- provider: gemini
model: gemini-3.1-flash-lite
# 2. after traffic accumulates, compare the route as declared (default) with cheap
npx modelrig bakeoff --route example.support_summarize --variants default,cheap --replay-last 50
# no captured route traffic? promote a real /runs output to a golden, then
npx modelrig bakeoff --from-eval-cases example.support_summarize --variants default,cheap
Never a silent swap β promote it in ModelRig (console or MCP; versioned, reversible) or merge it as a PR if you keep routes in git.
10. WHAT IS KEPT. Your organization's content custody posture is managed by
default: the artifacts your code saves (prompts, model outputs, evidence) land in
your managed store with the PII/PHI you classify scrubbed, row-scoped to your
organization, yours to see and export in the console (there is no self-service
delete yet). A route with `capture: true` (Optimization on, the recommended
default) also keeps that route's telemetry rows and the bounded review samples
your bake-offs replay; a route with capture off (Pure router) keeps no replay
samples, while its telemetry rows and saved artifacts still follow your org's
posture. To opt out, set posture `off` (capture nothing) or `metadata` (hashes
only) in Settings (/account) in the console or with the `set_org_settings` MCP
tool, or require `zero_retention` on a route to keep nothing there; each stops
future capture rather than removing what is stored.The console shows the truth. Automated changes (opt-in) are proven before they apply; a change you promote in ModelRig (console or MCP) is versioned and reversible.
It won't create accounts, sign in, or touch your API keys β those stay in environment variables you set yourself (Before you start). It picks a lane per call site (observe, runRaw, recordCall, a route, or the optional gateway) without changing prompt or schema semantics, runs your tests, and reports every file it changed for you to review.
How ModelRig fits your stack
You keep writing normal code. ModelRig sits between your app and the model providers: it records every call your code sends through it (the gateway, rig.runRaw, rig.recordCall or a route), serves a routed call from the route's candidates, and shows you the truth here. Never a silent swap: automated changes (opt-in) are proven before they apply, and a change you promote in ModelRig (console or MCP) is versioned and reversible.
What we keep β your choice, per route
- Optimization on (capture: true, recommended)
- Capture on is the recommended default, the normal path here, not a favor you do us. It keeps that route's telemetry rows and the bounded review samples your bake-offs replay, in your organization, row-scoped by the database, not by our application code. See and export every telemetry row of it in this console; what you get back is community priors on your first bake-off and evidence on your own routes, at the same flat 2% either way.
- Pure router (capture off)
- Keeps no replay samples and contributes nothing to the community; telemetry rows and saved artifacts follow your org's content custody. The honest answer for a ZDR-strict or data-residency-bound workload. Real and supported, not a downgrade of the routing, and also at 2%.
- Content custody (managed by default)
- Content custody is on by default β ModelRig keeps the artifacts your code saves (prompts, model outputs, parsed results, evidence) in your managed store (our bucket under your organization's prefix), row-scoped by the database; see and export every byte of it right here in this console. What the console cannot do yet is delete it, which is exactly why the exits matter more here than they will later. Opting out is one account setting, reached from Settings (/account) in this console or the set_org_settings MCP tool: set posture off to capture nothing at all, or metadata to keep metadata and hashes only; and a zero_retention route keeps nothing at all β each of those stops future capture rather than removing what is already stored. The PII and PHI you classify are redacted before anything is stored. What you get back by leaving it on: every saved or captured prompt and output (call capture is a code option, artifacts.captureCalls, off by default), every score in one drill-in, and analysis across the whole graph. Settings (/account) βΈ
Optimization on is the recommended default: your traffic is what makes your routing smarter and your bill smaller, so giving us the data is the normal, encouraged path β and every telemetry row it keeps, you can see and export right here. Pure router means your traffic never becomes community knowledge: your rows are never folded into the shared model-performance cells, whatever any individual rig's contribution flag says. It does not mean we stop recording your own telemetry β that is what your usage is billed from, and it stays in your organization, visible and exportable here. Optimization on adds your conformance stats to the shared cells. Both lanes cost the same flat 2% β contributing is how the corpus gets better for you, not a discount you trade privacy for. Where it lives, and how long it stays βΈ
How calls are keyed & billed
- Your keys (BYOK)
- Your provider keys stay in your own environment β the exporter has no code path to them. (The gateway's raw passthrough is the exception: it spends the key a human stores in Vault.) The first 1,000,000 requests each month are free, then a flat 2% of list price.
- Managed keys
- ModelRig fronts the provider's inference cost, so managed calls are provider cost + 2% from the first request β no key for you to hold.
The same flat 2% either way β contributing is how the corpus gets better for you, not a discount you trade privacy for. Managed calls draw from your prepaid balance. See your costs β
run.start() / run.scope() (one step per model-call family) so it appears here β this is the last step of setup.open /runs βΈChecklist β 0/9 detected from ModelRig's own traffic β this is the public demo
- β1. Create your ModelRig key
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
Create your key βΈ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. It is the only ModelRig credential your app ever holds; rotate any time, and the old one stops working the moment the new one exists.let an agent do this step (a short prompt for this step only) βΈ
Do ONE step of a ModelRig setup in this repo (https://modelrig.dev). Ground in https://modelrig.dev/llms.txt, not memory. Never create accounts, sign in, or read, print or store any key value: check environment variable NAMES only; I place keys. The step: make sure the app can read my ModelRig key. 1. Find where this app reads configuration (.env.local, the platform's env vars, a secret manager) for every service, worker and cron that will create a rig. 2. Report whether MODELRIG_API_KEY is set in each, by name only. 3. Where it is missing, tell me exactly where to set it. I create the rig_sk_ key myself on the API keys page (https://app.modelrig.ai/keys). Stop there and show me the list.set it βΈ# Wherever your app reads configuration: .env.local, your platform's env vars, a secret manager. Never in code. MODELRIG_API_KEY=rig_sk_β¦The console shows the truth. Automated changes (opt-in) are proven before they apply; a change you promote in ModelRig (console or MCP) is versioned and reversible.
How youβll know it worked: the new key appears at the top of the API keys list, and this step ticks green here.
- β2. Install & connect
Needs an API key, so telemetry has somewhere to land first. Do βCreate your ModelRig keyβ βΈ
- β3. Confirm your org
Needs an API key, so telemetry has somewhere to land first. Do βCreate your ModelRig keyβ βΈ
- β4. Run your first call
Needs an API key, so telemetry has somewhere to land first. Do βCreate your ModelRig keyβ βΈ
- β5. Define your first route
Needs the "Create your ModelRig key" step first. Do βCreate your ModelRig keyβ βΈ
- β6. Prove a cheaper model
Needs at least one recorded run to replay first. Do βRun your first callβ βΈ
- β7. Attach a grade
Needs the "Create your ModelRig key" step first. Do βCreate your ModelRig keyβ βΈ
- β8. Cap a run's spend
Needs the "Create your ModelRig key" step first. Do βCreate your ModelRig keyβ βΈ
- β9. Tag your costs
Needs the "Create your ModelRig key" step first. Do βCreate your ModelRig keyβ βΈ
Stuck on a step and out of ideas? Troubleshooting guide βΈ
The loop, in three moves
- See. Every call writes a telemetry row locally first β the run never blocks on the cloud β then an async exporter mirrors it, plus the run β step β artifact graph, into this console. When someone asks βwhy did the pipeline do that?β, you pull up the run and show them.
- Prove. Replay your own recent traffic through route variants β a cheaper model, a different prompt β and get the effective cost of conformance for each, with confidence intervals, on Bake-offs. The registry feeds routing from the side: a probed fact beats a declared claim.
- Improve. A winning variant is a proposal. Never a silent swap β automated changes (opt-in) are proven before they apply; promote it in ModelRig (console or MCP; versioned, reversible) or merge it as a PR if you keep routes in git.
The console shows the truth. Automated changes (opt-in) are proven before they apply; a change you promote in ModelRig (console or MCP) is versioned and reversible. Full architecture: how it fits βΈ
More capabilities
Beyond the checklist, ModelRig also gives you per-customer tenant statements, shareable published receipts, a metadata-only analytics query API, provenance-first assembly & trust, and pairwise, regret-bounded bake-offs. The whole surface, one line each: how it fits βΈ