$1 Budget: Codex and Claude Code on One Tiny Repo
01 / Split a $1 planning budget before opening either agent
You do not need a large application to compare Codex and Claude Code. You need one small repository, one identical task, and a spending rule. This walkthrough uses a Python expense calculator because it needs no paid services or third-party packages. It is a repeatable experiment, not a report of measured winners.
Allocate $0.40 to Codex, $0.40 to Claude Code, and leave $0.20 untouched for setup mistakes. Those are planning allowances, not predicted prices. Actual charges depend on the selected model, context, output, and caching. A prompt saying “spend no more than $0.40” does not enforce a billing limit.
CheapRelay offers pay-as-you-go access without a monthly fee or subscription. Sign up for CheapRelay if you want to route both tools through one API account. Before funding it, check current model prices, minimum funding requirements, and whether your account offers an enforceable spending cap.
02 / Build one expense function with two baseline tests
Create a folder named tiny-expenses. Inside it, create expenses.py containing this single line: def total_expenses(amounts): return sum(amounts). Create test_expenses.py with these lines, preserving normal Python indentation:
- ■ import unittest
- ■ from expenses import total_expenses
- ■ class ExpenseTests(unittest.TestCase):
- ■ def test_empty(self): self.assertEqual(total_expenses([]), 0)
- ■ def test_positive(self): self.assertEqual(total_expenses([2, 3]), 5)
Run python -m unittest -v from that folder; use python3 instead if your system requires it. Both tests should pass. Then run git init, git add expenses.py test_expenses.py, and git commit -m "Baseline expense calculator". Git may ask you to configure your name and email first.
From the repository, run git worktree add ../expenses-codex -b trial-codex, followed by git worktree add ../expenses-claude -b trial-claude. These create separate folders starting from the same commit. Neither agent will inherit the other agent's edits.
03 / Connect both tools without accidentally using another account
Install each CLI using its official instructions. Provider configuration changes between releases, so use CheapRelay's current tool-specific setup instructions rather than copying an old configuration from a random tutorial.
The relay's API base is https://api.cheapapirelay.com; OpenAI-compatible routes live under /v1. That information alone is not a complete configuration for both tools. Confirm the provider settings, authentication method, and exact supported model identifier for each CLI. Do not assume identical settings work everywhere.
For a low-cost Claude Code run, check the current price and tool compatibility of Claude Haiku 4.5. For Codex, choose a currently supported coding model from the relay's configuration guide. Tool choice and model choice are separate variables: different models make this a comparison of two configured workflows, not a controlled model benchmark.
Keep API keys outside the repository. Check that neither CLI is silently using an existing subscription or another provider account. Record the relay balance before each run, and avoid unrelated API traffic during the experiment.
04 / Give each agent the same tightly bounded change
Launch each tool from its corresponding worktree and submit this exact request:
“Update total_expenses so negative amounts raise ValueError. Keep empty input returning zero. Preserve normal integer and float addition; do not add currency rounding. Add tests for negative input and positive decimal input. Use only the Python standard library. Do not install packages, browse the web, or change unrelated files. Run python -m unittest -v, then explain the diff and stop.”
Approve only commands you understand. Allow one implementation attempt per tool. If either asks a necessary clarification, answer consistently in both runs. Do not buy repeated retries merely to produce a prettier comparison.
05 / Compare the diff and the bill, not the sales pitch
In each folder, run python -m unittest -v yourself, then inspect git diff. Record test results, unrelated edits, manual corrections, elapsed time, and the charge shown after usage settles. Treat balance differences as rough accounting if the dashboard does not provide per-request detail.
CheapRelay bills real tokens, including cache reads and writes. Small files and short sessions reduce unnecessary context, but they do not guarantee a particular price. If the first run exceeds its allowance, stop before launching the second. A useful beginner result is a working patch, a readable diff, and a recorded cost—not a universal winner.
Sign up Try the prices yourself, sign-up credit included.
More reading
| Date | Aisle | Written in | Title |
|---|---|---|---|
| 2026-10-28 | Coding agents, cheaply | EN | $1 Budget: Catch a Coding Agent Loop Before It Spends Spot repeated tool calls, rising token use and stalled edits early, then stop and restart a coding agent within a tiny budget. |
| 2026-10-28 | Coding agents, cheaply | EN | $0.50 task budget: Claude Code, fewer file reads A beginner workflow for limiting Claude Code's file reads, narrowing searches, and checking token spending on a tiny pay-as-you-go budget. |
| 2026-10-28 | Coding agents, cheaply | EN | Save Tokens: 6 Claude Code Commands for 2026 A practical 2026 guide to /compact, /clear, /context and other Claude Code commands that reduce waste on pay-as-you-go billing. |
| 2026-10-28 | Coding agents, cheaply | EN | $2 Budget: Connect a VS Code Assistant Connect a VS Code assistant to an OpenAI-compatible API, test one small task, and track token costs with a $2 planning budget. |
| 2026-10-28 | Coding agents, cheaply | EN | 36,000 to 12,000 Tokens: Trim Your Agent's Context A tiny-budget walkthrough for cutting coding-agent context: select files, limit logs, compact history, and check actual token charges. |
| 2026-10-28 | Coding agents, cheaply | EN | $1 Test Budget, 2 Variables: Claude Code on a Relay Connect Claude Code to CheapRelay with two environment variables, then run a small test and check token charges before spending more. |