BurnGuard calculates the cost of every Anthropic API call by multiplying the token counts returned in the response’sDocumentation 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.
usage field against built-in pricing tables. No sampling or estimation is involved — every request is accounted for at its actual token cost. Pricing tables are compiled into the BurnGuard binary and updated with each release.
Model Pricing Table
The table below lists the per-1M-token rates encoded inanalyzer.go. BurnGuard matches the model string returned by the API and selects the corresponding rate; any unrecognised model falls through to the default rate.
| Model | Input ($/1M tokens) | Output ($/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 (default) | $0.80 | $4.00 |
Cache-Aware Pricing
Anthropic’s prompt caching feature introduces two additional token categories beyond standard input tokens. BurnGuard reads all four usage fields from the API response and applies a separate multiplier to each category. Token categories and multipliers:- Standard input tokens (
input_tokens): billed at the full input rate (multiplier: ×1.00) - Cache creation tokens (
cache_creation_input_tokens): billed at 1.25× the standard input rate — a 25% premium charged when content is first written into the cache - Cache read tokens (
cache_read_input_tokens): billed at 0.10× the standard input rate — a 90% discount applied when previously cached content is reused
total_input_cost + (output_tokens × output_rate).
How BurnGuard Parses Usage
BurnGuard extracts token counts through two code paths depending on whether the request uses standard HTTP responses or server-sent events (SSE) streaming. Non-streaming responsesExtractUsage() in parser.go JSON-unmarshals the full response body into a ClaudeResponse struct. The usage field maps to the following struct:
ParseSSE() in sse.go accumulates SSE data lines as the response streams through the proxy. It looks for two specific event types:
message_start— carries the model name, initialinput_tokens, and cache token counts. Cache creation tokens are sourced from the nestedcache_creationobject by summingephemeral_5m_input_tokensandephemeral_1h_input_tokens. Cache read tokens come fromcache_read_input_tokens.message_delta— carries the finaloutput_tokenscount in itsusagefield once generation is complete.
Pricing rates are compiled directly into the BurnGuard binary. If Anthropic updates their published prices, upgrade to the latest BurnGuard release to ensure your cost calculations reflect the new rates.
