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.

run agent-1 · max 5 calls running
  1. 01200ok
  2. 02200ok
  3. 03200ok
  4. 04200ok
  5. 05200ok
  6. 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

  1. 01

    Authenticate with a virtual key

    The agent sends Authorization: Bearer sk-rh-… (or legacy sk-fuse-…). That is not your OpenAI key. Runhalt looks it up in memory and loads the budget attached to it.

  2. 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.

  3. 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.

  4. 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.

  5. 05

    Halt a runaway run

    Send the same X-Run-Id on 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.