---
name: cheap-agent
description: "Set up and use Cheap Agent (npm: cheap-agent) in Claude Code or Codex: your frontier model plans, a cheap model writes the code in its own worktree, and tests decide what lands. Covers install, the /cheapag commands, cheapag.json settings, the FAQ, and update/remove. Use when installing Cheap Agent, choosing a provider or preset, or explaining how its delegate flow works."
license: MIT
metadata:
author: "Muaaz Khan"
source: "https://github.com/muaaz9329/cheap-ag"
title: "Cheap Agent (README)"
note: "Sections Install, How it works, Commands, Settings, FAQ and Update or remove from the repository README, unchanged except the How it works diagram (an SVG in the repo) is left out. The MCP server itself is the npm package cheap-agent; this skill is the guide to it."
---
# Cheap Agent
> Added by Skillsync: this is the setup and usage guide from the Cheap Agent README. The plugin itself (MCP server, hooks and /cheapag commands) installs with `npx cheap-agent`, below.
## Install
Works in Claude Code and Codex. One login covers both.
### Claude Code
**Easiest:** paste this into Claude Code. It asks what you want, then gives you one command to run.
```text
Set up Cheap Agent (npm: cheap-agent) for me.
1. Ask me: which provider (OpenRouter recommended, DeepSeek, OpenCode Go or Command Code), and which
models (balanced is the default; cheapest, strongest, or my own provider/model).
2. Check that node is 20+ and the claude CLI is installed.
3. If I picked my own model, save {"models":{"implement":"<model>"}} in
~/.config/cheapag/config.json, keeping what else is there.
4. Give me the command to run in my terminal: npx cheap-agent login --preset <my choice,
or custom>, and which number to pick for my provider (1 OpenCode Go, 2 OpenRouter,
3 DeepSeek, 4 Command Code). I run it and type my API key there. Never ask for my key.
5. When I say done, check `claude mcp list` shows cheapag, then tell me to run
/cheapag:allow in a new Claude Code session in my project.
```
**Or do it yourself:**
```bash
npx cheap-agent
```
Pick a provider (**OpenRouter** if unsure), press Enter for the recommended models, paste your API key. It checks the key works, then adds itself to Claude Code for every project.
Then, in each project, once:
```
/cheapag:allow
```
**That's it.** Ask Claude for changes like you always do.
### Codex
Log in (say no when it offers to add itself to Claude Code, if you don't use Claude):
```bash
npx cheap-agent
```
Add the plugin:
```bash
codex plugin marketplace add muaaz9329/cheap-ag
```
```bash
codex plugin add cheapag@cheap-agent
```
Start `codex` in your project and trust the 3 cheapag hooks when it asks. Then, in each project, once:
```
$cheapag:allow
```
**That's it.** Ask Codex for changes like you always do.
**You need:**
- [Claude Code](https://claude.com/claude-code) or [Codex](https://developers.openai.com/codex)
- [Node.js](https://nodejs.org) 20+
- An API key with a few dollars on it from [OpenRouter](https://openrouter.ai/keys), [DeepSeek](https://platform.deepseek.com), [OpenCode Go](https://opencode.ai) or [Command Code](https://commandcode.ai) (Command Code needs a plan with API access; OpenCode Go needs Regions set to Global in its console for the DeepSeek models)
A few dollars lasts hundreds of tasks. It runs on macOS, Linux and Windows.
**Windows:** you also need [Git for Windows](https://git-scm.com/downloads/win) (Git Bash). Known so far:
- The very first job can take about 2 minutes while the cheap model's engine (OpenCode) sets itself up. Later jobs start in seconds.
- If that engine crashes mid-session, Cheap Agent starts a new one, but the crashed copy can stay running (`opencode.exe` in Task Manager) until you end it or restart.
- The cheap model can't read your dependency folders (like `node_modules`) inside its copy of the project. Your tests still run normally.
---
You know the principal engineer. Twenty years in. Sees the whole system at once. Costs a fortune per hour.
You would never pay them to type out a CSV exporter.
But that's exactly what happens every time your frontier model (Claude Opus, GPT-6 Astra or Sol) writes your code: the most expensive model you have, reading files, typing boilerplate, re-running tests, burning through your plan.
**Cheap Agent fixes the org chart.** Your frontier model plans and decides. A model that costs half a cent per task does the typing, in its own copy of your project, and has to prove its work with a test before anything reaches you.
## How it works
- **Every change is proven.** The cheap model must write a test that fails before its fix and passes after. Cheap Agent runs the tests itself; it doesn't take the model's word for it.
- **Your project stays clean.** Work happens in a private copy (a git worktree). Only passing work lands, uncommitted, so you review the diff like any other.
- **Your frontier model stays in charge,** but it's held to it: Cheap Agent's hooks stop it from quietly redoing work that already passed, or (in Claude Code) doing a failed step itself when Sonnet can.
## Commands
| Claude Code | Codex | What it does |
|---|---|---|
| `/cheapag:allow` | `$cheapag:allow` | Your OK to send this project's code to the cheap model. Once per project. |
| `/cheapag:status` | `$cheapag:status` | Recent jobs, and what the cheap model has cost you. |
| `/cheapag:hook on` | `$cheapag:hook on` | No more "I'll just do it myself": your frontier model *must* hand code changes to the cheap model. |
| `/cheapag:clean` | `$cheapag:clean` | Tidy up old job folders. |
While a job runs, Claude Code shows the worker's latest step under the tool call, and Codex shows it each time it checks in (about every 15 seconds). To follow every step in a second terminal, run `npx cheap-agent watch`.
## Settings
Optional. Put a `cheapag.json` in a project:
| Setting | Default | What it does |
|---|---|---|
| `takeover` | `"sonnet"` | Who finishes a step the cheap model couldn't: a Sonnet helper, or `"self"` (your frontier model, capped at 15 tool calls). Claude Code only; Codex finishes it itself. |
| `limits.max_turns` | `25` | The most turns the cheap model gets per step. |
| `models` | from setup | Which cheap models to use. Switch with `npx cheap-agent login --preset strongest`. |
## FAQ
**Is a half-cent model actually any good?**
On its own, no. With a written task from your frontier model, a test it has to pass, and a referee that runs that test, yes, most of the time. When it isn't, it says so and a stronger model takes over.
**Does my frontier model check the work?**
The tests check the work, and Cheap Agent runs them. Opus checking every passing change cost three times the tokens and caught nothing in my runs, so it trusts a pass. You still review the diff before you commit.
**Where does my code go?**
To the provider you picked, only after you run `/cheapag:allow` (`$cheapag:allow` in Codex) in that project, which also shows exactly which models will see it. Your API key stays on your machine, in a hidden prompt and a local credential store, never in chat.
**Will it commit or push anything?**
Never. Changes land uncommitted. Your git, your call.
**Why not just use Sonnet for everything?**
Sonnet still costs real usage on every line it types. The cheap model types for half a cent. Sonnet only gets called when the cheap model is stuck.
**Can I use it at work, or build on it?**
Yes. It's MIT licensed: use it, change it, share it, at any company, for free ([MIT License](./LICENSE)).
**Why "Cheap Agent"?**
Because your plan isn't.
## Update or remove
New versions are announced on the [Releases page](https://github.com/muaaz9329/cheap-ag/releases). Cheap Agent also tells you when a session starts if a new minor or major version is out; set `CHEAPAG_NO_UPDATE_CHECK=1` to turn that off.
**Update:**
```bash
npx cheap-agent@latest
```
In Codex, also:
```bash
codex plugin marketplace upgrade
```
**Remove** (two commands):
```bash
claude plugin uninstall cheapag@cheapag
```
```bash
claude mcp remove -s user cheapag
```
In Codex:
```bash
codex plugin remove cheapag@cheap-agent
```