xbtMelchizedek

Agent Cost Proxy — Development skill for Claude Code

Development community

One command: a local proxy for Claude Code, Codex, Hermes and OpenAI-compatible agents that records each call's real cost and the cheapest listed price for the same tokens, with optional spend caps.

How to install Agent Cost Proxy

This entry records only its repository, not the path inside it, so there is no exact command to give. Open xbtMelchizedek/agent-cost-proxy and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

What Agent Cost Proxy does

One command: a local proxy for Claude Code, Codex, Hermes and OpenAI-compatible agents that records each call's real cost and the cheapest listed price for the same tokens, with optional spend caps. Your key is never stored.

Alternatives in Development

  • Dario — A local OpenAI- and Anthropic-compatible proxy that brings your Claude Pro/Max subscription to Cursor, Cline 485 ★
  • Codex OpenAI Proxy — Proxy server to use ChatGPT Plus tokens with CLINE/Claude Code extensions via OpenAI API compatibility 124 ★
  • Openapis — Free Claude API + free OpenAI API in one unified proxy 42 ★

README

agent-cost-proxy

What did your coding agent's calls really cost, and what would the same tokens have cost at the cheapest venue? Start one local proxy, point Claude Code, Codex, Hermes or any OpenAI-compatible agent at it, and keep working. Every call's real cost goes on an [agent-spendcap](https://github.com/xbtMelchizedek/agent-spendcap) ledger, next to the cheapest price [justweight](https://github.com/xbtMelchizedek/justweight) lists for the same model. Turn on caps and calls over budget never leave your machine.

**Page and report viewer:** https://xbtmelchizedek.github.io/agent-cost-proxy/

Quickstart

npx -y github:xbtMelchizedek/agent-cost-proxy

Then, in the shell where your agent runs:

export OPENAI_BASE_URL=http://127.0.0.1:8788/v1     # Codex, Hermes, OpenAI-compatible agents (upstream: OpenRouter by default)

For Claude Code, start it with `--upstream anthropic` and set `ANTHROPIC_BASE_URL=http://127.0.0.1:8788`.

Each call prints one line:

deepseek/deepseek-v4.1-flash · 100000 in / 100 out · $0.00509028 · cheapest listed: $0.00503 at pearl-labs (deepseek-ai/DeepSeek-V4.1-Flash)

To see the totals:

npx -y github:xbtMelchizedek/agent-cost-proxy report

Node 22 or later. Nothing to configure: no account, no config file, no key to give it.

Your key

  • Whatever your agent already sends (Authorization or x-api-key) is passed straight through to the upstream.
  • If the agent sends no key, the proxy adds the upstream's usual one from its own environment: OPENROUTER_API_KEY, OPENAI_API_KEY or ANTHROPIC_API_KEY (or UPSTREAM_API_KEY for a custom URL).
  • Keys, prompts and responses are never written to disk or printed. The files hold model, token counts, cost, status and timing. Tests check the files and logs for the key.
  • Redirects from the upstream are refused, so a key is never re-sent to another host.

Local only

The proxy listens on `127.0.0.1` and nowhere else. It refuses:

  • requests wit