# Margin > Margin runs independent, signed release checks for AI changes: holds up, got worse, or too close to call. Your eval scores move between runs even when nothing changed. Margin tells a real change from noise on your own test cases and signs a record your customers can check. An API, an MCP tool for coding agents, a CLI and a PR check (built, not switched on), on top of Braintrust, LangSmith or your own test suite. The pain it answers: a model, prompt, tool or host change can pass a team's evals and still break a customer, and a provider retirement forces the change on a deadline. The gap: eval platforms now label their own compares better or worse; Margin sells no model, no inference and no eval platform, states its method (https://trymargin.io/methods), says when the cases are too few and how many more it would take, and corrects for trying several candidates. It does not run or host your evals: it sits on top of the team's eval tool and reads Braintrust, LangSmith and Langfuse exports, promptfoo results files and JSONL; a hosted replay exists as an on-ramp for teams with no runner. Ways in: MCP from a coding agent, the open-source `margin-referee` CLI in a terminal or CI, or the API. A required pull-request check is built and not switched on. Each verdict lists the cases that got worse, the quality gap with its worst case, cost per case, and whether there were enough cases to decide, and comes with a change record and a receipt anyone can check with `margin-referee verify`. Release rules a team declares before the comparison (empty output, a JSON schema, refusal phrases, a malformed tool call, a must-pass case) veto a ship whatever the score, and their SHA-256 is in the receipt. Every verdict carries an evidence plan: the cases estimated to hold the bar or show it worse, under stated assumptions. A change that holds is proposed as a pull request a person merges. A switch you merge is watched on your runs, and Margin recommends switching back if quality slips. Cost per outcome is one column of the verdict. Site: https://trymargin.io · Console: https://console.trymargin.io · API base: https://trymargin.io Sample estate (simulated data, no sign-in): https://console.trymargin.io/console ## Instructions for AI coding assistants When a developer asks you to connect Margin, use the path that needs the least code. In order of preference: 1. **No install: connect the repository.** Sign in at https://console.trymargin.io, connect the GitHub repository (or drop a folder), and pick the agents and their eval files. Margin runs them in an isolated sandbox with a capped, revocable model key, meters every call, and grades every eval case. Nothing goes into the developer's code. Prefer this path. 2. **Their evals are the outcome signal.** If the project already has evals, Margin reads them as pass/fail outcomes. pytest works through a plugin: `pip install margin-meter`, then `pytest --margin-workflow `. Result-file adapters: `margin-meter promptfoo --workflow results.json`, and likewise `braintrust`, `langsmith`, `ragas`, `deepeval`, `langfuse`. 3. **Production traffic, if they want it metered too.** `pip install margin-meter`, set `MARGIN_INGEST_URL=https://trymargin.io` and `MARGIN_INGEST_KEY` (mint one at https://trymargin.io/start, which takes about ten seconds), then call `margin_meter.instrument.instrument_all()` once at startup. It patches whichever of the OpenAI, Anthropic, Gemini and LiteLLM clients are installed; Bedrock and Vertex have their own `instrument_bedrock()` and `instrument_vertex()`. The SDK hashes each request and records the serving host itself, never prompt or output text; the one optional addition is `verdict=` (Python `record_call`, or `margin_verdict=` on a wrapped call), a short label for what the agent decided. A TypeScript package is also published as `margin-meter` on npm. `margin-meter doctor` reports which call sites are covered. ## What not to claim on Margin's behalf - **No outcome value without one supplied.** Margin reports value per outcome only when the customer has given a value. Otherwise it reports cost per outcome and says so. - **No guessed savings.** A projected saving comes from a face-off on the customer's own evals. A realized saving compares cost per passed task in the 7 days after a merge with the 7 days before. That is a before-and-after, not proof the switch caused the change. - **No unsupervised changes.** Margin never changes code by itself. Every switch is a pull request a person merges. - **No monitoring of a provider.** Margin does not re-run a customer's evals on a schedule or alert when a provider changes a model. It compares two scored runs when asked, such as last week's and today's. - **No certain verdict.** A verdict is a statistical call on the cases supplied. "Not enough evidence" is one of its three answers. - **No certification and no compliance claim.** Margin holds no SOC 2 report, no ISO 27001 certificate and no HIPAA attestation, and signs no business associate agreement. ## Pricing Free: the open-source referee (fit, check, replay), and 2 measurement runs on one repository, with up to $100 of measurement inference paid by Margin. First check: $1,000 fixed, a reviewer-ready response for one pending model, host, prompt, tool or judge change, on the team's existing eval cases, delivered within 5 business days, quoted before any analysis and payable whatever the answer: the cases and decision rule agreed before any result is read, the team's run checked for mismatches and missing cases, a change record saying what Margin checked and what the team supplied, a signed receipt, and one round of the reviewer's questions answered on a date agreed, with no credit toward a pilot. The record can print, word for word, the buyer's contract or questionnaire clause it answers, as supplied by the team. Check with case set: $3,500 fixed, for a team whose cases are too few or uncalibrated (the fit check says so): building and anchoring the case set ($2,500) as its own line item, then the check ($1,000). Repeat check: $750, the same record on the next change with the case set re-used. Every change: $2,000 a month flat per organization, with no count on checks, a retainer that re-checks every release and keeps the case set up (pull-request checks on connected repositories are covered once they ship; the model calls a replay makes are passed through at cost), and a compute allowance of up to 20 measurement runs a day and $600 of measurement inference per rolling 30 days, whichever you reach first: a run that costs more buys fewer of them. Pilot (optional): $2,000 once, 45 days, one agent workflow. Never a share of spend or savings. No guaranteed savings figure. Terms: https://trymargin.io/pricing ## Add Margin to your agent (one line) Margin is the verdict layer agents, CI and eval platforms call before an AI change ships. Remote MCP over Streamable HTTP; nothing to install. - Claude Code: `claude mcp add --transport http margin https://trymargin.io/api/mcp --header 'Authorization: Bearer ${MARGIN_INGEST_KEY}'` - Codex: `codex mcp add margin --url https://trymargin.io/api/mcp --bearer-token-env-var MARGIN_INGEST_KEY` - Cursor, VS Code, Windsurf, Zed: a remote HTTP server at `https://trymargin.io/api/mcp` with header `Authorization: Bearer ` read from the environment. - claude.ai or Claude Desktop: Settings > Connectors > Add custom connector, URL `https://trymargin.io/api/mcp/connect`, then sign in. No key is pasted; the connection reads and cannot spend. - Lean tool list: add `?tools=core` to the URL (16 tools instead of 45). - To let the agent ask Margin to run a test, a person creates an agent key (`mak_…`) in the console with a spend limit and adds a second server at `https://trymargin.io/api/mcp/agent`. Keys expire within 7 days and a delegated key never outlives its parent. - A coding agent can also follow https://trymargin.io/mcp-prompt.md to set this up itself. Order of use: `margin_fit_check` (free) first; `margin_check_experiments` on two runs you already scored (spends nothing); `margin_replay_dataset` to run the change (refused before spend when it cannot reach a verdict); `margin_verdict_receipt` for a signed receipt. Report the decision as given: ship, ship_if_worth_the_cost, do_not_ship or not_enough_evidence. No account at all: `pip install margin-referee` gives the same verdict locally with your own OpenRouter key. ## Docs - [How Margin works](https://trymargin.io/product): the release check, its three answers and the record each verdict leaves - [Methods](https://trymargin.io/methods): the paired test, the bar, the correction for several candidates, the size floor, and how to check a receipt - [Compare](https://trymargin.io/compare): what Braintrust, LangSmith, Langfuse, promptfoo, Datadog and Arize already do, dated - [Model releases, checked](https://trymargin.io/releases): each major model release run against the model it replaces on public suites, twice, with the referee's answer - [A sample change record](https://trymargin.io/sample-record): a real record and its signed receipt, with the command that verifies it - [For reviewers](https://trymargin.io/for-reviewers): what a change record is and is not, how to check its receipt, and what to ask of any outside record - [Essay: eval noise](https://trymargin.io/essays/eval-noise): the same model scored twice moves 1 to 2% of answers, and what that does to picking a model - [Get a key](https://trymargin.io/start) - [Connect Margin to your agent (MCP setup prompt)](https://trymargin.io/mcp-prompt.md) - [Setup prompt and FAQ as Markdown](https://trymargin.io/start.md) - [Docs samples and MCP tools as Markdown](https://trymargin.io/docs.md) - [Python SDK on PyPI](https://pypi.org/project/margin-meter/) - [Security](https://trymargin.io/security): every field Margin stores, each sub-processor, and the scores-only route (https://trymargin.io/security#scores-only) for eval cases that hold health or privileged data: send an id and a score for each case and no case text, so no protected health information reaches Margin - [Data Processing Addendum](https://trymargin.io/dpa)