Spend guard
Sits in front of LLM APIs and caps tokens and budget per request. In a test against a live model API, a capped request returned 64 output tokens instead of 2,618, which is 97.6% fewer.
A control plane for LLM, SMS and payment APIs, mapped to OWASP LLM10 (Unbounded Consumption). Apps call it before they spend money, and it answers ALLOW, LIMIT, CHALLENGE or DENY.
Built end to end as a full stack and DevOps project. Stack: Node.js, Python, Postgres, Redis, Kubernetes. All numbers below were measured by me on one shared 8 vCPU Linux machine, where the load generator, load balancer and services all share the same hardware. Raw results are in the repository.
Once an agent can call tools and paid APIs, one prompt injection or one runaway loop can leak data or burn a budget.
BleedStop puts a decision in front of the spend. An application calls POST /decide before it pays for a call. Rules are deterministic and set per tenant, and budgets are enforced atomically across several instances through Redis.
Sits in front of LLM APIs and caps tokens and budget per request. In a test against a live model API, a capped request returned 64 output tokens instead of 2,618, which is 97.6% fewer.
A DeBERTa classifier quantized to 8 bit so it also runs in the browser. On a held out test set it caught 77.5% of injections at a 5% false positive rate.
Redis enforces budgets across instances. In a correctness test of 2,000 concurrent calls against a $5 ceiling on 3 instances, overspend was $0.000.
Every decision is written to a Postgres audit table where a trigger blocks UPDATE and DELETE, so decisions can be reviewed later but not edited.
Docker Compose stack with 3 API replicas, Redis, Postgres and nginx, plus a Helm chart for Kubernetes with readiness and liveness probes, a PodDisruptionBudget, an HPA and graceful drain.
Prometheus metrics, Grafana dashboards, alert rules and GitHub Actions CI. Node SDK with Express middleware, Python SDK, multi tenant YAML policy, and OpenTelemetry support.
| Test | Result |
|---|---|
| Docker Compose stack (3 API replicas, Redis, Postgres, nginx), one 8 vCPU machine | 5,433 decisions per second, p99 36.2 ms, 0 failed requests out of 60,000 |
| 3 instances behind a load balancer with Redis atomic budgets | 6,291 decisions per second, p99 31.9 ms, $0.000 overspend against a $5 ceiling |
| Kubernetes rolling restart of 6 pods under load | 0 failed requests out of 287,403 |
| Postgres stopped for about 7 seconds under load | 86,071 requests, 0 failed, 0 ledger rows dropped |
| Golden set of 12,140 labeled requests | Precision 100%, benign false positive rate 0.0%, recall 48.0% |
| Prompt injection classifier, held out set | 77.5% caught at a 5% false positive rate |
| Capped request against a live model API | 64 output tokens instead of 2,618 (97.6% fewer) |
Absolute numbers are a lower bound for a real cluster because the load generator and services share one machine.
Running the system under stress found problems that unit tests did not. All of them are fixed. Examples:
In total I found and fixed eight such bugs by running the stack, then kept the evidence in the repository.
I am open to full time remote roles and contracts. If you are putting AI agents into production, or need a full stack engineer who cares about security, cost and reliability, send me a note.