Get Started →
DocsSDK & ExamplesAPI Reference
Products / Cost & Governance

Kill Switch

Set autonomous circuit breakers that block LLM gateways when budget caps or security anomalies are detected.

The Kill Switch is response middleware that intercepts outbound model calls. It acts as an autonomous circuit breaker to protect your company from runaway cost spikes and prompt injection attacks.

How It Works

When an API gateway call is initiated, the RaksHex middleware evaluates the request context against your active workspace rules:

import { RaksHex } from '@rakshex/sdk';

const RaksHex = new RaksHex({ apiKey: process.env.RAKSHEX_API_KEY });

// The middleware automatically throws a 402 Payment Required or 403 Forbidden 
// if a budget or security policy rule is violated
app.post('/api/chat', RaksHex.middleware(), async (req, res) => {
  // Chat logic here...
});

Trigger Conditions

  • Daily / Monthly Budget Caps: Shuts down the gateway once a team or workspace budget is exceeded.
  • Security Anomalies: Blocks prompts with injection confidence scores above 0.90.
  • Spike Protection: Shuts down the route when token consumption spikes exceed 3 standard deviations in an hour.