Explain and drive ezswap, a local command-line tool that tells you whether an app or agent can move to a cheaper or newer LLM model, from its own traffic. Use when the user asks whether a model swap is safe, wants to compare models on their own calls, or asks how to record, map, rerun, judge or read an ezswap result.
Installs into .claude/skills of the current project.
Sponsors
SSkills DirectorySkills Directory
Know which skills are safe — weekly.
SSkills DirectorySkills Directory
Is that skill safe to install?
Are you the author of Ezswap?
Add the live security badge to your README. It updates with every re-scan.
[](https://www.skillsdirectory.com/skills/metergraph-ezswap)
---
name: ezswap
description: Explain and drive ezswap, a local command-line tool that tells you whether an app or agent can move to a cheaper or newer LLM model, from its own traffic. Use when the user asks whether a model swap is safe, wants to compare models on their own calls, or asks how to record, map, rerun, judge or read an ezswap result.
---
# ezswap
ezswap answers one question: if this app or agent moved to another model,
what would change? It uses the app's own calls, and reads every difference
against the current model run a second time, so a difference counts only
when it is more than that model differs from itself.
It runs on the user's machine with the user's own keys. Check that it is
installed with `ezswap --version`. If it is not, the README lists the ways
to install it. `ezswap --help` is the full reference for the installed
version: read it before quoting an option you have not seen there.
## Rules before you run anything
- **Ask before any step that spends money.** `map`, `run`, `rerun` and
`judge` call a provider. They ask before starting, and `--yes` skips that
question: do not pass `--yes` unless the user told you to. `demo`,
`record`, `estimate` and `report` spend nothing.
- **A rerun runs the agent's tools for real**, once per model. Before
starting one, confirm with the user that the agent points at a test
environment or that its tools are safe to call again.
- **A rerun reads its command from `ezswap.yaml` when one is there.** A
settings file can come with a cloned repository. Show the user the
`command` and `upstream` it holds before running.
- **Never print an API key**, and never put one in a settings file. ezswap
reads keys from the environment.
- **Trace files, result files and pages hold the app's prompts and
replies.** Do not commit them, paste them into an issue, or send them
anywhere unless the user asks.
## Which path
| The user has | Use | Tells them |
| --- | --- | --- |
| Nothing yet | `ezswap demo --map` | What a result looks like. No keys, no network. |
| An app that calls a model | `record`, then `map` | Which call sites, and which steps of an agent, change on another model. Nothing but model calls is run. |
| An agent they can run from a command, with tools that are safe to call again | `record`, then `rerun` | Where each model ends up on every task, and the turns, tokens, cost and time it took. |
On a terminal, `ezswap` with no command walks through the same steps with
menus. When you run commands for the user, use the commands below: the
menus need a person at the keyboard.
## Record
```sh
ezswap record --upstream https://api.openai.com
```
This starts a proxy on `127.0.0.1:8787` that forwards each model call to
the provider and appends a copy to `ezswap-out/traces.jsonl`. The only
change in the app is its base URL: `http://127.0.0.1:8787/v1` for OpenAI
SDKs, `http://127.0.0.1:8787` for Anthropic SDKs. The app keeps sending
its own key.
Two optional request headers make results easier to read:
- `X-Ezswap-Part` names the place in the app a call comes from.
- `X-Ezswap-Trace` carries one id per task or session. An agent rerun
matches tasks by it. Without it, tasks are matched by their first user
message, so two tasks that open with the same message become one.
`--fresh` starts a new trace file and sets the old one aside under a
timestamped name. Use the app, then press `q`.
## Map: from the recording alone
```sh
ezswap estimate ezswap-out/traces.jsonl --map --models openai/gpt-5-mini
ezswap map ezswap-out/traces.jsonl --models openai/gpt-5-mini --html map.html
```
`estimate` lists the parts found and prices the run without calling a
provider. Show the user that price. `map` then replays a sample of each
part on each model and twice on the recorded model, and prints which parts
change beyond what the recorded model's own rerun does. For an agent, each
recorded turn is replayed on its own: no tool is run.
## Rerun: the agent itself, on each model
```sh
ezswap rerun --models openai/gpt-5-mini,anthropic/claude-haiku-5.5 \
--effects issue_refund,escalate -- python agent.py
```
The command after `--` must run the agent over the same tasks as the
recording, with its base URL on the recorder. ezswap runs it once
unchanged, then once per model, rewriting the model name in each request
on the way through. `--effects` names the tools that change something: a
task ends in the same state when the same calls were made to them. Leave
it out and every tool counts.
`--judge` also compares each final answer with the recording's, using a
judge model (needs `AI_GATEWAY_API_KEY`, about a cent per 200 pairs).
It writes `ezswap-out/rerun.json` and `rerun.html`.
## Reading a result
```sh
ezswap report ezswap-out/rerun.json --no-interactive
```
Use `--no-interactive` when you read a result for the user. Without it, on
a terminal, `report` opens a view that needs a keyboard.
For a rerun, each model gets one sentence:
| Sentence | Meaning |
| --- | --- |
| No more different than a second run | It ends no more tasks differently than the recorded model does when run again. With few tasks this is weak evidence, not a recommendation. |
| Close, not like-for-like | It ends more tasks differently than that, but at most `close-percent` of its tasks (default 25). |
| Not a like-for-like swap | It ends more tasks differently than that, and more than `close-percent` of them. |
Things to tell the user when you explain one:
- **Read every model against the "again" row.** That row is the recorded
model run a second time: the noise.
- **"Differently" is not "worse".** A model that never escalated may have
been right. ezswap says what changed; whether it matters is the user's
call. Open the tasks that ended differently before recommending a swap.
- **Leaving the path is not a fault.** It means the model called other
tools at a turn. The end state says whether that mattered.
- **The final answer does not count towards the end state.** The judge
compares answers separately, and the recorded model's own answers differ
from run to run too.
- **"Close" is a threshold the user set**, not a finding.
The page (`rerun.html`, or `report --html FILE`) has four sections: Path,
Performance, End state and Task replayer.
## The settings file
`ezswap.yaml` in the folder holds options so commands need no arguments.
Flags on the command line win.
```yaml
models: [anthropic/claude-haiku-5.5, openai/gpt-5-mini]
upstream: https://api.openai.com
command: python agent.py
effects: [issue_refund, escalate]
judge: true
judge-question: outcome
close-percent: 25
min-saving-percent: 50
```
`judge-question` is `strict`, `outcome`, or a sentence of your own.
`close-percent` and `min-saving-percent` are read when a result is opened,
so changing one and running `report` again changes the result without
another rerun. `min-saving-percent` only moves the target box on the
Performance chart: at least that share of cost saved, and at least 100
minus `close-percent` of tasks ended the same.
## Limits to say out loud
- A rerun is one pass per model. Small samples move from run to run.
- Gemini names the model in the request path, so the recorder cannot swap
it for a rerun.
- A map replays single calls. It cannot show where a different decision at
one turn leads: that is what a rerun is for.
## Where the detail is
- `docs/record.md`: the recorder, headers, what is and is not written.
- `docs/sensitivity-map.md`: every rule of the map.
- `docs/rerun.md`: the rerun, its page and its settings.
- `docs/cli.md`: every command and option.