AI API & Agent Spend Firewall · 6 providers · Policy Engine · IP Allowlist · Provider Vault · <35ms

AI API & Agent
Spend Firewall.

Hard dollar caps on every LLM call.

When you hit $50, it stops. Not an alert — it stops. One line of code change.

Per workspace · Per key · Per agent · Per run

# Before
client = Anthropic(api_key="sk-ant-...")

# After — one line change
client = Anthropic(
    api_key="sk-ant-...",
    base_url="https://proxy.llmcap.io/anthropic"
)
# When you hit $50 → 429. Token never consumed.
🔒Your API key is never stored — passes through per-request, discarded immediately
Only token counts & costs are logged

“I set up a $20 budget alarm for AWS Bedrock. On May 1, I received a bill for several hundred dollars. The alarm was never triggered. AWS support was apologetic but would not offer any kind of refund.”

— andersco onHacker News

Works with every major provider

Anthropic
OpenAI
Google Gemini
Mistral
Cohere
AWS Bedrock

Setup in 5 minutes

How LLMCap works

01

Change base_url

Point your API client at proxy.llmcap.io. Works with every SDK. No code changes beyond that one line.

02
$

Set your cap

Define daily, monthly, or per-key dollar limits in the dashboard. Per-model granularity supported.

03
🛡

Sleep peacefully

When a cap is hit, LLMCap returns 429 before the token is consumed. No charge. No surprise bill.

cost intelligence

Know why costs spike.
Before the bill arrives.

Hard caps are just the start. LLMCap tracks cache efficiency, anomalies, and cost per deployment — so you can fix the root cause.

3.7× spike detected
→ Slack

Spend Anomaly Alerts

When daily spend exceeds 2× your 7-day rolling average, an alert fires in minutes. Not after the invoice.

Slack webhook · configurable multiplier
56%
Yesterday91%
Today56% ↓35pp
cache drop alert

Cache Hit Rate Tracking

Anthropic prompt cache hit rate tracked daily. Alert fires when rate drops > 40 percentage points — a silent token cost spike, caught.

Anthropic only · auto-detected from API response
v2.1.0
$14.20
v2.0.3
$4.80
(untagged)
$1.00
x-llmcap-version: v2.1.0

Deploy Cost Attribution

Tag requests with x-llmcap-version. Dashboard shows cost broken down by deployment — catch expensive prompt refactors before they ship.

All 6 providers · free-form version string
$080% → alert95% → urgent$50
95% of daily cap
→ webhook fired

Budget Threshold Alerts

Proactive warnings at 80% and 95% of your daily cap. You get time to act before LLMCap blocks requests at 100%.

Pure threshold check · fires on every request
31% error rate
>25% threshold

Error Rate Spike Detection

Tracks provider error rates per workspace per hour. When error rate exceeds 25% with at least 20 requests, an alert fires — provider outages caught before your users notice.

Hourly Redis counters · min 20 requests to fire
ai agent spend firewall

Per-agent. Per-run.
Pre-dispatch enforcement.

Tag your LLM calls with agent and run IDs. Set your own daily cap per agent and total cap per run in the dashboard. LLMCap reserves estimated spend before forwarding the request — over-budget calls never reach the provider.

🔒
1

Reserve

Workspace, agent daily, and run total budgets checked atomically in Redis. Estimated spend reserved before any provider call.

2

Call

Request forwarded to the LLM provider. Reservation holds spend while the call is in-flight — streaming responses pass through in real time.

3

Settle

Actual token cost settled. Unused reservation released. Retry-safe — duplicate request IDs are detected without double-counting spend.

agent integration — one extra dict
client = Anthropic(
    api_key="sk-ant-...",
    base_url="https://proxy.llmcap.io/anthropic",
    default_headers={
        "X-LLMCap-Agent-Id":   "research-agent",
        "X-LLMCap-Run-Id":     "run_8f21a3",
        "X-LLMCap-Request-Id": generate_uuid(),
    },
)

# research-agent hits $5.00/day → 429. Agent pauses.
# run_8f21a3 hits $1.00 total  → 429. This run stops.
# Request-Id makes retries idempotent — no double-count.
Agent spend controls
Per-agent daily cap$3.42 / $5.00 (example)
Per-run total capblocked at $1.00 (example)

Example amounts · Limits set by you · disabled by default

Customer-defined limits

You set agent and run caps in the dashboard. Off by default — opt in per workspace.

Composes with workspace caps

Agent caps enforce alongside existing workspace and key budgets. The tightest limit wins.

Retry-safe

Pass X-LLMCap-Request-Id to prevent double-counting on retries. Duplicate request IDs are rejected before provider dispatch and are not reserved twice.

Untagged traffic

Requests without agent headers have no agent or run budget applied. Normal workspace, key, and model limits still apply.

enterprise security

Enterprise controls.
Per-key granularity.

Not just spend caps — a complete governance layer. Control which models run, who can call from where, and get notified the moment something looks wrong.

Policy rules — evaluated top-down, deny wins
allowgpt-4o-mini#1
blockclaude-opus-*#2
allow* (any)#3

Policy Engine

Priority-ordered allow/block rules evaluated on every request. Block expensive models workspace-wide, allow specific model versions for certain keys — or lock down everything with a default deny.

Model prefix matching
Provider filtering
Org & project scope
Deny-wins evaluation
Fail-open on policy errors · audit logged
Key: tg_live_prod_abc1 — IP allowlist
10.0.0.0/8internal VPC
203.0.113.42CI runner
8.8.8.8unknown

IP Allowlisting

Restrict each API key to specific IP addresses or CIDR ranges. Requests from outside the allowlist are rejected with 403 before they touch your LLM budget.

CIDR range support
IPv4 & IPv6
Per-key granularity
60s Redis cache
Empty allowlist = unrestricted · fails open on infra error
POST https://hooks.pagerduty.com/...200 OK
{
  "event": "budget_threshold",
  "threshold": "95%",
  "spent_usd": 47.50,
  "limit_usd": 50.00
}

Webhook Notifications

Push anomaly events to any HTTPS endpoint — PagerDuty, Slack, Teams, or your own webhook. Payloads are HMAC-SHA256 signed so you can verify authenticity.

spend_spikebudget_thresholdcache_droperror_rate
HMAC-SHA256 signed · multiple endpoints per workspace
admin_audit_log — last 3 entries
07:14faruk@CREATEproxy_keydev-laptop
07:13faruk@UPDATEbudget$50 → $100
07:11faruk@CREATEpolicyblock claude-opus-*

Admin Audit Log

Every key creation, budget change, policy update, and RBAC assignment is logged with actor, timestamp, and target. Filter by action type, actor, or date range. Prune old entries on schedule.

Actor + timestamp
Action type filter
Date range query
Prune API
Atomic DB transactions · immutable append-only
Provider secrets — AES-256-GCMencrypted at rest
Anthropicsk-ant-•••••••••••••••••
OpenAIsk-proj-•••••••••••••••
GoogleAIza•••••••••••••••••••

Provider Secret Vault

Store your Anthropic, OpenAI, and Bedrock API keys in LLMCap encrypted with AES-256-GCM. Your apps only ever see a LLMCap key — provider credentials never touch your codebase.

AES-256-GCM encryption
Per-workspace isolation
Never logged or returned
All 6 providers
96-bit random nonce · keys never exposed after save
Role-based permissions — workspace members
faruk@adminFull access
dev-1@developerKeys & logs
ops@viewerRead only

Role-Based Access Control

Invite teammates with scoped permissions. Admins manage keys and budgets. Developers access logs and analytics. Viewers can read dashboards but can't create or revoke keys.

AdminDeveloperViewer
Organizations · Projects · per-member role assignment

Organizations & Projects

Group workspaces under Organizations — perfect for agencies managing multiple clients. Tag API calls with Projects to get cost attribution broken down by team, product, or feature.

Multi-tenant orgs
Project tagging
Per-org billing
Cross-project reports

Data Privacy

You own your data.
We only touch what's necessary.

LLMCap needs metadata to enforce your cap. It never needs your conversations. Here's exactly what we log — and what we never touch.

We log (metadata only)
provider
model
input_tokens
output_tokens
cost_usd
status
latency_ms
app_version
We never store
System promptnever read, never stored
User messagespasses through untouched
Assistant responsestoken count only, not text
Provider API keysheader pass-through, discarded instantly
PII in promptswe have no access to message content
Request bodyinspected for token count, never saved
IP addresschecked against allowlist, not stored
LLMCap proxy keystored as bcrypt hash only
🔒

TLS 1.3 end-to-end

Your app → LLMCap and LLMCap → provider are both HTTPS. No plaintext path exists.

🏦

AES-256-GCM at rest

Provider keys stored in Secret Vault are encrypted with a 96-bit random nonce per entry, key stored separately.

📋

Immutable audit log

Every admin action is append-only. UPDATE and DELETE are blocked at the DB trigger level — not just policy.

0
Providers supported
0ms
Avg added latency
18,742
Requests blocked today
0.9%
Uptime

Available everywhere you code

Works in your workflow

Marketplace

VS Code Extension

Live spend in your status bar. Click to see today's usage, burn rate, and blocked count — without leaving the editor.

Install Extension
>_
PyPI

Terminal CLI

Check spend, browse logs, manage keys, and set policies from the command line. Works on macOS, Linux, and Windows.

pip install llmcap
View on PyPI
🪟
Desktop

Windows Tray App

System tray icon shows live spend. Right-click for stats and quick actions. Always visible, never intrusive.

pip install "llmcap[tray]"
Get Tray App
LLMCap · AI Agent Spend Firewall · Hard caps · Policy Engine · IP Allowlist · Provider Vault · RBAC · Webhooks · Organizations · Audit Log · No surprise bills · <35ms latency · 6 providers incl. AWS Bedrock · 3-day trial · LLMCap · AI Agent Spend Firewall · Hard caps · Policy Engine · IP Allowlist · Provider Vault · RBAC · Webhooks · Organizations · Audit Log · No surprise bills · <35ms latency · 6 providers incl. AWS Bedrock · 3-day trial · LLMCap · AI Agent Spend Firewall · Hard caps · Policy Engine · IP Allowlist · Provider Vault · RBAC · Webhooks · Organizations · Audit Log · No surprise bills · <35ms latency · 6 providers incl. AWS Bedrock · 3-day trial · LLMCap · AI Agent Spend Firewall · Hard caps · Policy Engine · IP Allowlist · Provider Vault · RBAC · Webhooks · Organizations · Audit Log · No surprise bills · <35ms latency · 6 providers incl. AWS Bedrock · 3-day trial · LLMCap · AI Agent Spend Firewall · Hard caps · Policy Engine · IP Allowlist · Provider Vault · RBAC · Webhooks · Organizations · Audit Log · No surprise bills · <35ms latency · 6 providers incl. AWS Bedrock · 3-day trial ·

Simple pricing

Pick your plan

3-day trial, no charge until it ends · Cancel anytime

Starter
$19/mo

after 3-day trial

  • 2 API keys
  • All 6 providers incl. Bedrock
  • Daily & monthly caps
  • Per-agent daily & per-run spend caps
  • Budget threshold alerts (80% / 95%)
  • Cache hit rate monitoring
  • Deploy cost attribution
  • 1 Organization · 1 Project
  • 30-day audit log
  • 1 user
  • Email support
Start 3-Day Trial

Credit card required for trial. Cancel before day 3 and you won't be charged.

Questions

No. Your provider API key (e.g. sk-ant-...) is passed through the proxy header on each request and immediately discarded. LLMCap only stores your LLMCap proxy key, hashed with bcrypt. We never log your provider keys.
Yes — streaming is supported from day one. LLMCap passes SSE chunks through in real time. If the budget is exceeded mid-stream, the connection is closed and a final 429 event is sent. The token that triggered the cap is not charged.
The next incoming request is rejected with HTTP 429 before it reaches the provider. The token is never consumed, so you are never billed for it. Your app receives the same 429 response structure providers use for rate limiting, so existing error handling works as-is.
Yes — the Provider Secret Vault lets you store your Anthropic, OpenAI, Google, Mistral, Cohere, and Bedrock credentials in LLMCap, encrypted at rest with AES-256-GCM (96-bit random nonce per entry). Once saved, your code only uses a LLMCap proxy key — the provider key never appears in your codebase or environment variables. Secrets are never returned after initial save and never written to logs.
Yes — the Policy Engine lets you create priority-ordered allow/block rules scoped to models, providers, organizations, or projects. Rules are evaluated top-down with deny-wins semantics. For example: allow gpt-4o-mini, block claude-opus-*, allow everything else. Model prefix matching handles version suffixes automatically (gpt-4o blocks gpt-4o-mini but not gpt-4o).
You configure one or more HTTPS webhook endpoints in the dashboard. When an anomaly is detected (spend spike, budget at 80%/95%, cache drop, or error rate spike), LLMCap POSTs a signed JSON payload to your endpoint within seconds. Each payload includes an HMAC-SHA256 signature in the X-LLMCap-Signature header so you can verify it's genuine. Works with PagerDuty, Slack, Teams, or any custom endpoint.
Yes — AWS Bedrock is fully supported including Claude, Llama, Titan, Mistral, and Cohere models via Bedrock. Pass your AWS credentials in request headers alongside your LLMCap key. LLMCap re-signs requests using SigV4 and forwards them to the Bedrock Runtime. Credentials are never stored. This is exactly what fills the gap that AWS Budgets leaves open: AWS Budgets has 8-12 hour reporting lag and sometimes doesn't trigger at all — LLMCap blocks before the charge happens.
Self-hosting is on the roadmap. The proxy is open source (FastAPI + Redis). For now, the managed service at proxy.llmcap.io is the recommended path — it's already deployed with <35ms latency worldwide.
No. LLMCap logs only the metadata needed to enforce your cap and power your dashboard: provider, model, token counts, cost, status, latency, and app version. We never store prompt text, system instructions, user messages, or assistant responses. Your conversations stay strictly between your application and the LLM provider — we only count the tokens that pass through, we don't read them. You can confirm exactly what we record by opening the Request Log in your dashboard.
Yes. Every connection uses TLS 1.3. Your application connects to proxy.llmcap.io over HTTPS — there is no unencrypted path available. LLMCap's outbound connection to each provider (Anthropic, OpenAI, Google, etc.) is also HTTPS. Provider API keys you send in request headers are never written to disk or any log. Keys stored in the Provider Secret Vault are encrypted at rest with AES-256-GCM with a 96-bit random nonce per entry.
LLM calls will fail with a connection error until the proxy recovers. We target 99.9% uptime via Railway with health monitoring and automatic restarts. For applications requiring higher availability, we recommend wrapping LLMCap calls in a circuit breaker with a configurable direct-to-provider fallback that you can activate if needed. A self-hosted high-availability deployment option is on the roadmap.
No. Requests without X-LLMCap-Agent-Id or X-LLMCap-Run-Id headers have no agent or run budget applied. They are tracked against your workspace and API key budgets as normal. You can run mixed traffic (some tagged, some not) in the same workspace.
They are enforced together — the first exhausted limit blocks the request. If your workspace has a $50/day budget, an agent has a $5/day cap, and a run has a $1.00 total cap, any of the three reaching its limit returns a 429 before the provider is called. Set a high workspace limit for overall protection and tighter agent and run limits for individual workflows — all checked atomically before each request.
When the spending cap is hit during a stream, LLMCap sends a terminal SSE event — data: {"error": "budget_exceeded", "code": 429} — then closes the connection cleanly. Partial tokens received before the cutoff are not billed; the request that triggered the cap pays zero. Your existing SSE error handler receives this event the same way it receives any provider-side error, so no special handling is required.
Multiple layers limit the blast radius. (1) IP Allowlist — even with valid credentials, requests from IPs outside your allowlist are rejected at the gate before any token is consumed. (2) Provider Secret Vault keys are AES-256-GCM encrypted at rest; an attacker with database access cannot extract them without the separate encryption key. (3) Spending caps are enforced at the proxy — no rogue actor can spend beyond your configured cap. (4) The audit log is append-only and tamper-proof at the database trigger level — every action is recorded and cannot be erased. Assign team members the minimum role they need (RBAC), and enable IP allowlisting on production keys to further reduce exposure.