Cost Caps and Kill-Switch

Hard daily caps per session, per API key, or per day. When the cap hits, RelayPlane returns a 429, fires alerts, and kicks in auto-downgrade. No SaaS in the middle. The kill happens at the proxy.

Quick Start

Set a daily cap in one command:

1relayplane cap set --day 50

The proxy reads the cap on the next request. No restart required.

How It Works

Every request that passes through the proxy checks the running daily total against your cap. When the cap is exceeded, the proxy returns 429 cost_cap_exceeded. The check runs locally on every call. There is no external dependency.

YAML Configuration

Full options in relayplane.config.yml:

1cost_caps:
2 daily_usd: 50 # hard kill at $50/day
3 session_usd: 10 # per-session kill
4 soft_limit: 0.80 # auto-downgrade at 80% of cap
5
6downgrade_ladder:
7 - from: claude-opus-4-5
8 to: claude-sonnet-4-6
9 - from: claude-sonnet-4-6
10 to: claude-haiku-4-5
11
12alerts:
13 telegram: true # fires on cap hit
14 email: true

Runaway-Loop Detection

If the same session retries N times within W seconds, RelayPlane marks it as a runaway loop, kills the session, and fires an alert. Default: 3 retries within 90 seconds.

1runaway_detection:
2 retry_count: 3
3 window_seconds: 90

Viewing Kill History

1relayplane kills --last 7d

Shows what was killed, why, and how much it saved. 7-day retention on Pro, 30-day on Max.

Cost Caps, runaway detection, and the auto-downgrade ladder are Pro tier features. See the Pro page for full details and pricing.