Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/Verifieddanny/BurnGuard/llms.txt

Use this file to discover all available pages before exploring further.

This guide walks you through pointing your existing Anthropic SDK or HTTP client at BurnGuard’s local proxy so every Claude request is metered, costed, and checked against your budget in real time — with zero changes to your business logic.

Prerequisites

  • BurnGuard installed and the proxy running (burnguard start)
  • A burnguard.yaml in your project directory (run burnguard init to generate one)
  • An Anthropic API key already working in your application

Configure Anthropic in burnguard.yaml

The providers.anthropic.base_url field tells BurnGuard where to forward requests after stripping the /anthropic path prefix. The default value is correct for the public Anthropic API — you only need to change it if you are using a custom endpoint or a private gateway.
providers:
  anthropic:
    base_url: https://api.anthropic.com

Update Your App

Change the base URL your SDK or HTTP client uses to point at BurnGuard instead of the Anthropic API directly. That is the only change required.
# Before
from anthropic import Anthropic

client = Anthropic()

# After — one line changed
from anthropic import Anthropic

client = Anthropic(base_url="http://localhost:8080/anthropic")
Your ANTHROPIC_API_KEY environment variable is forwarded to Anthropic unchanged. BurnGuard never stores or logs API keys.
BurnGuard strips the /anthropic prefix before forwarding the request. When you set base_url="http://localhost:8080/anthropic", the SDK appends /v1/messages and the full path becomes /anthropic/v1/messages. BurnGuard removes /anthropic, forwarding /v1/messages to api.anthropic.com — the path Anthropic expects. You do not need to set base_url="http://localhost:8080/anthropic/v1".

Supported Claude Models

BurnGuard uses the pricing table below to calculate the cost of every request. Costs are in USD per one million tokens.
ModelInput / 1M tokensOutput / 1M tokens
claude-fable-5$10.00$50.00
claude-opus-4-5, claude-opus-4-5-20251101, claude-opus-4-6, claude-opus-4-7, claude-opus-4-8$5.00$25.00
claude-sonnet-4-5, claude-sonnet-4-5-20250929, claude-sonnet-4-6$3.00$15.00
claude-haiku-4-5$1.00$5.00
All other models$0.80$4.00
Pricing is compiled into the binary and updated with each BurnGuard release. If a model identifier is not recognized, BurnGuard falls back to the “other models” rate rather than silently dropping the cost.
Use claude-haiku-4-5 during development and testing. At $1.00 per million input tokens it is the cheapest named model in the table, so you can iterate quickly without burning through your budget before reaching production.

Cache-Aware Pricing

Anthropic’s prompt caching feature stores parts of your prompt context server-side and bills cached tokens at a different rate. BurnGuard reads the cache_creation_input_tokens and cache_read_input_tokens fields from every response and applies the correct multiplier automatically.
Token typeField in responseRate applied
Standard inputinput_tokens1.0× (full rate)
Cache creationcache_creation_input_tokens1.25× (25% premium)
Cache readcache_read_input_tokens0.10× (90% discount)
For example, on claude-sonnet-4-5 (input rate $3.00 / 1M):
  • 1,000 standard input tokens → $0.003
  • 1,000 cache creation tokens → $0.00375 (1.25×)
  • 1,000 cache read tokens → $0.0003 (0.10×)
The total cost shown in your dashboard reflects the blended rate across all three token types.

SSE Streaming Support

BurnGuard fully supports Anthropic’s streaming API ("stream": true). When a response arrives with Content-Type: text/event-stream, BurnGuard wraps the response body in a streaming reader that taps each SSE event as it passes through, extracts token counts from the message_delta and message_stop events, and calculates cost — without buffering the stream or adding measurable latency to your application. The Anthropic SDK’s stream() and stream_raw() methods both work transparently through the proxy. No additional configuration is needed.

Build docs developers (and LLMs) love