Free & open source

Stop runaway Claude API spend
in 60 seconds

Tourniquet is a free, local-first proxy that hard-caps your Anthropic API at a daily limit you set. When the cap hits, it kills the stream mid-response — your agent stops, your bill doesn't grow.

You've seen this story before

You set up an agent. It loops. You wake up to a $400 bill. It's not hypothetical — documented incidents include a single LangChain agent accumulating over $40,000 in a single run, and Cursor users hitting unexpected charges after leaving overnight tasks unattended. The common thread: no hard stop.

Token spend can compound faster than intuition suggests. An agentic loop with tool calls, retries, and long context windows can burn through a daily budget in under ten minutes if something goes sideways. The Anthropic Console offers monthly soft limits; they don't stop an in-flight request.

Existing options all have the same gap. Anthropic's own spend limits are monthly and advisory. LiteLLM is team-grade infrastructure with a meaningful ops surface. Helicone and similar SaaS proxies route your traffic through someone else's cloud — and none of them inject a clean stop mid-stream. They drop the TCP connection, which your agent sees as a generic network error, not a recoverable budget signal.

Three steps, then forget about it

Install one command

Tourniquet is a Python package with no system dependencies beyond Python 3.9+.

pip install tourniquet-dev

Run it

A single command starts the proxy and opens your browser at the local dashboard. No config files to edit, no environment to learn.

tourniquet

Paste your key, set a cap

Enter your sk-ant- key in the dashboard, choose a daily dollar limit, and point your agent at http://localhost:8989. Done. Your key never leaves your machine.

Get started now

Terminal
pip install tourniquet-dev && tourniquet
Homebrew

Coming soon: brew install tourniquet

From source
git clone https://github.com/LowryDaniel/tourniquet
cd tourniquet
pip install -e ".[dev]"
tourniquet
Upgrade
pip install --upgrade tourniquet

Your data stays on your laptop

  • Your Anthropic API key is stored encrypted at rest using Fernet (AES-256-CBC + HMAC-SHA256).
  • Dashboard access tokens use the tq_ prefix and are bcrypt-hashed — the plaintext is shown once, then discarded.
  • No telemetry, no analytics, no phone-home. The process makes exactly one category of outbound request: your API calls to Anthropic.
  • Anthropic still receives the same proxied requests it would see from any Claude SDK client — Tourniquet is transparent to the API.
  • The database is a local SQLite file at ~/.tourniquet/tourniquet.db. You own it.
Read the full security policy →

The cleanest stop in the category

When your daily cap is reached mid-stream, Tourniquet doesn't drop the TCP connection. It injects a synthetic SSE message_stop event at the end of the current partial chunk, then cleanly closes the response:

event: message_stop data: {"type":"message_stop","stop_reason":"tourniquet_cap_hit"}

This matters because the stop_reason field is surfaced to your agent code. A well-written agent can catch tourniquet_cap_hit, log the event, and exit gracefully — rather than crashing with an unhandled network exception.

SaaS proxy approach

Drop the TCP connection at the cap. The SDK raises a connection error. Your agent sees an unhandled exception — or retries and burns more tokens.

Tourniquet approach

Inject a clean message_stop SSE event with a machine-readable stop_reason. The SDK calls your normal completion callback. You can handle it.