Integrations
Two paths to capture
AtlasBurn captures AI usage through two complementary surfaces. Pick whichever fits your stack — both write to the same Forensic Ledger.
- SDK auto-detect (
@atlasburn/sdk) — JavaScript/TypeScript only. PatchesglobalThis.fetchand captures any call to a recognized provider host. Soft (in-process) enforcement: the gate is checked before each call, and blocks fail open so the host request is never broken. - Cloudflare Edge Proxy (
proxy.atlasburn.com) — language-agnostic, any HTTP client. Point your client at a provider prefix (e.g./openai/,/anthropic/,/mistral/). This is the hard-enforcement path — guardrail kill flags are read from Cloudflare KV before traffic ever reaches the provider, out-of-process and unbypassable by the caller.
SDK vs. proxy — different guarantees
Provider Matrix
| Provider | SDK auto-detect | Cloudflare proxy | Priced | Notes |
|---|---|---|---|---|
| OpenAI | Yes | /openai/ | Yes | Standard usage object. Streaming usage injected via stream_options.include_usage. |
| Anthropic | Yes | /anthropic/ | Yes | Standard usage object. |
| Google Gemini | Yes | /gemini/ | Yes | usageMetadata field. Watch for schema drift between API versions. |
| OpenRouter | Yes | /openrouter/ | Yes | Auto-detected (openrouter.ai). Tokenizer drift from upstream routing — Layer 4 RPS is the safety net. |
| Mistral | Yes | /mistral/ | Yes | Both paths. OpenAI-compatible usage object. |
| Cohere | Yes | /cohere/ | Yes | Both paths. Tokens nested under usage.billed_units. |
| Groq | Yes | /groq/ | Yes | Both paths. Priced by the underlying model (Llama, Mixtral, …). |
| Together AI | Yes | /together/ | Yes | Both paths. Priced by the underlying model. |
| DeepSeek | Yes | /deepseek/ | Yes | Both paths. |
| xAI (Grok) | Yes | /xai/ | Yes | Both paths. |
| Google Vertex AI | Yes | SDK only | Yes | SDK auto-detects (vertexai.googleapis.com). NOT edge-proxyable — OAuth bearer + region host + project/location path can't be transparently re-hosted. Use the SDK or /api/ingest. |
| Azure OpenAI | Yes | SDK only | Yes | SDK auto-detects (*.openai.azure.com). NOT edge-proxyable — deployment-scoped host + api-key header. Use the SDK or /api/ingest. |
| AWS Bedrock | Best-effort | SDK only | Yes | SDK auto-detects (bedrock-runtime); token counts read from response headers (best-effort). NOT edge-proxyable — SigV4 request signing is host-bound, so re-hosting breaks the signature. Use the SDK or /api/ingest. |
| Meta / Llama (self-host) | No | Front via proxy | Yes | No fixed public host to auto-detect. Capture by fronting your gateway with the proxy, or POST events to /api/ingest. Priced by model. |
Both paths, one ledger
How SDK auto-detect works
Auto-detect monkey-patches globalThis.fetch and inspects the request URL. When it matches a recognized provider host — OpenAI, Anthropic, Gemini, Vertex, Azure OpenAI, OpenRouter, Cohere, Mistral, Groq, Together, DeepSeek, xAI, and AWS Bedrock — it extracts usage metadata from the JSON or SSE response. No wrappers, no middleware. Only token counts and metadata are ever sent to AtlasBurn; prompt and completion content never leaves your process.
Schema drift — Google
usageMetadata. If Gemini or Vertex token counts disappear after a provider update, upgrade @atlasburn/sdk.How the proxy works
The proxy is a Cloudflare Worker. It forwards to the upstream provider with the original auth header you passed, reads kill flags from Cloudflare KV synchronously, and emits one normalized telemetry event per request. Because enforcement happens at the edge, a tripped guardrail blocks traffic before the provider charges you.
Supported routes today: /openai/, /anthropic/, /gemini/, /openrouter/, /mistral/, /cohere/, /groq/, /together/, /deepseek/, /xai/. See Proxy Quickstart.
SDK-detectable but not edge-proxyable
Google Vertex AI, Azure OpenAI, and AWS Bedrock are captured by the SDK but cannot be routed through the transparent proxy — each uses per-request auth or hostnames that a generic prefix-rewrite would break:
- AWS Bedrock — SigV4 request signing is bound to the target host; re-hosting through the proxy invalidates the signature. Edge hard-enforcement would require a Bedrock-specific re-signing proxy.
- Azure OpenAI — deployment-scoped hostname (
<resource>.openai.azure.com) plus anapi-keyheader, so there is no fixed host to prefix-map. - Google Vertex AI — OAuth bearer + region host + project/location in the path.
For these three, use the SDK (soft, in-process enforcement) or POST normalized events to /api/ingest. Bedrock token counts arrive via response headers and are best-effort.
Posting events manually
For a self-hosted model gateway (e.g. your own Llama endpoint) or any provider you don't route through the SDK or proxy, POST normalized events directly to /api/ingest. See the API Reference.
Next Steps
- SDK Integration — initialization and options
- Proxy Quickstart — universal capture in two lines
- Cost Engine — how pricing is resolved per provider