runhalt
Stop agent spend mid-run.
Hard budget before tokens are generated. Kill a runaway run in flight — not after the invoice.
The problem
Agents don’t spend like chat.
Tools, retries, sub-agents, growing context. Cost is non-linear. Most tools show you a chart after the fact. Almost nothing stops the spend while it’s happening.
What Runhalt is
A hard stop, not a dashboard.
Drop-in OpenAI-compatible endpoint. You give your agent a Runhalt URL and a virtual key. Runhalt holds your real provider key, enforces a hard ceiling, and can kill a single agent run when it loops or overruns.
agent-1 · max 5 calls
running
- 01200ok
- 02200ok
- 03200ok
- 04200ok
- 05200ok
- 06409run_killed
How it works
Your agent talks to Runhalt. Runhalt talks to the model.
Nothing changes in how you call chat completions — only the base URL and API key. Runhalt sits in the middle and decides whether the request is allowed to reach the provider.
your agent runhalt OpenAI / Anthropic
-
01
Authenticate with a virtual key
The agent sends
Authorization: Bearer sk-rh-…(or legacysk-fuse-…). That is not your OpenAI key. Runhalt looks it up in memory and loads the budget attached to it. -
02
Reserve worst-case cost
Before any tokens are generated, Runhalt estimates the maximum cost of the request and holds that amount. If the remaining budget is too small → HTTP 402. The call never hits the provider. Spend is zero.
-
03
Forward the stream
If the reservation succeeds, Runhalt injects your real provider key and streams the response through. No full buffering — time-to-first-token stays tight.
-
04
Settle actual usage
When the response finishes, Runhalt records real token usage, charges the true cost, and releases unused reservation back to the budget.
-
05
Halt a runaway run
Send the same
X-Run-Idon every call from one agent task. Runhalt tracks call count, cost, depth, and loops. Breach a ceiling → HTTP 409 run_killed. The agent should abort — not retry.
How to use it
Point your agent at Runhalt. Keep calling OpenAI as usual.
After onboarding you get an endpoint and a virtual key. Set them as your OpenAI base URL and API key. Put the real provider key only into Runhalt — never into the agent.
# 1) In Runhalt: paste your OpenAI key, create a virtual key
# 2) In the agent / SDK:
export OPENAI_BASE_URL="https://runhalt.com/v1"
export OPENAI_API_KEY="sk-rh-…"
# Optional — protect one agent task:
# X-Run-Id: my-agent-task-42
# X-Fuse-Run-Max-Calls: 20
Works with the OpenAI Python SDK, LangChain, curl, or anything OpenAI-compatible. Budget exhausted → 402. Run over limit → 409.
Get started
Hosted in minutes, or one binary.
Create an account, paste a provider key, get an endpoint and virtual key. Then point the agent at Runhalt and set a low call ceiling to prove a runaway gets halted.