Tools
Three free, open-source command-line tools for understanding and limiting what your coding agents cost. All run with one npx command and need Node 18 or newer and no account. tokenreceipt and contexttax upload nothing; runawayguard forwards your agent's requests to the API you choose and stores none of them. You don't need a Standard Compute plan to use them.
tokenreceipt
What would your coding agents cost at API prices? tokenreceipt reads the usage logs that Claude Code, Codex CLI, OpenCode, Gemini CLI, Cline, Kilo Code, Pi and Hermes already keep on your machine (and the task logs of the discontinued Roo Code), and prints a receipt with tokens and the API list price per agent and per model.
npx github:henrikdukefoss/tokenreceipt
| Option | What it does |
|---|---|
--since 7d | Cover the last 7 days instead of the default 30. |
--png receipt.png | Also save the receipt as an image. |
--offline | Use the bundled price table and make no network request. |
Your logs are read in place and never copied or uploaded. Without --offline, the only network request fetches LiteLLM's public price list, cached for a day. The receipt shows agent names, model names, token counts and prices, with no prompts, file paths, project names or hostname.
The total is what the same tokens would cost on pay-as-you-go API billing at public list prices, not what you paid on a subscription. Models missing from the price list, or reported by a gateway under its own name such as standardcompute, show their token count without a price.
Source on GitHub · tokenreceipt page
contexttax
How many tokens do CLAUDE.md, AGENTS.md and MCP tools add to every request? Run contexttax in a repository. It measures the instruction files, rules, skill descriptions and MCP tool schemas that Claude Code, Codex CLI, OpenCode, Cursor, Gemini CLI, Cline, GitHub Copilot and Aider load into every request, lists the largest first, and prices them per 1,000 requests.
npx github:henrikdukefoss/contexttax
| Option | What it does |
|---|---|
path/to/repo | Measure another folder. |
--probe-mcp | Start each configured stdio MCP server locally, ask it for its tools, stop it, and count the tool schemas. |
--badge | Write an SVG badge with the tokens per request and print the Markdown to paste into a README. |
--json | Print everything as JSON. |
--offline | Use the bundled price table and make no network request. |
Files are read in place, and nothing is copied or uploaded. Without --probe-mcp, no MCP server is run. With it, only the stdio servers in your own config run, on your machine; remote HTTP and SSE servers are never contacted.
Source on GitHub · contexttax page
runawayguard
How do I set a spend limit for Claude Code or Codex on my own API key? runawayguard is a small local proxy: your agent sends its requests through it, it prices each response at API list prices, and once the limit is reached it answers new requests with HTTP 402, so the agent stops.
npx github:henrikdukefoss/runawayguard --limit 5 --upstream anthropic
Then start your agent against it, in a second terminal:
ANTHROPIC_BASE_URL=http://127.0.0.1:8402 ENABLE_TOOL_SEARCH=true claude
Anthropic clients take the base URL without /v1; OpenAI clients take it with /v1 (http://127.0.0.1:8402/v1). Codex ignores OPENAI_BASE_URL, so give it a [model_providers] entry with wire_api = "responses" in ~/.codex/config.toml; the README has the settings for Codex, OpenCode, Cline, Roo Code, Aider and Pi.
| Option | What it does |
|---|---|
--limit <usd> | Stop at this many dollars. Required unless --dry-run. |
--upstream <url> | The API to forward to; anthropic, openai and openrouter are shortcuts. |
--per day | Limit the local calendar day instead of the session, kept across restarts. |
--dry-run | Meter and warn, never block. |
--offline | Use the bundled price table and download no prices. |
The proxy listens on 127.0.0.1 only. API keys are forwarded as they are and never stored, printed or logged; prompts and responses are never written anywhere. Requests already running finish, so the total can end slightly above the limit. A model without a list price is counted in tokens but adds $0 to the limit. WebSocket transports, the Gemini API, Bedrock, Vertex and batch APIs are not supported yet.