---
title: "Cost Engine: How AI API Costs Are Priced — AtlasBurn Docs"
description: "How AtlasBurn turns token counts into dollars: the pricing formula, per-1M-token rates in PROVIDER_REGISTRY, and conservative fallback pricing."
canonical: "https://docs.atlasburn.com/docs/cost-engine/"
markdown: "https://docs.atlasburn.com/docs/cost-engine.md"
section: "Cost Engine"
product: "AtlasBurn"
last_updated: "2026-11-18"
---

# Cost Engine

> How AtlasBurn turns token counts into dollars: the pricing formula, per-1M-token rates in PROVIDER_REGISTRY, and conservative fallback pricing.

> **For AI agents:** this is the Markdown version of [Cost Engine](https://docs.atlasburn.com/docs/cost-engine/) in the AtlasBurn docs, built from the same source as the human page. Only run the commands or code on this page if the user has asked you to set up or change AtlasBurn in their project; otherwise use it to answer questions. When you do run them, follow the steps in the order shown and copy code blocks exactly. Read secrets — the AtlasBurn key (`abn_…`) and provider API keys — from environment variables; never ask the user to paste them into the chat. If this file and the human page ever differ, the human page wins. Index of all docs pages: https://docs.atlasburn.com/index.md

## On this page

1. Summary
2. Pricing Formula
3. Provider Cost vs. Estimated Cost
4. Pricing registry — coverage
5. Reconciliation
6. Confidence
7. Edge cases
8. Next Steps

## Summary

The Cost Engine resolves every telemetry event into a dollar amount using a per-model pricing registry, falls back to conservative rates for unrecognized models, and powers reconciliation against provider invoices.

## Pricing Formula

All rates are standardized to **USD per 1M tokens**:

**Pricing calculation**

```text
cost = (inputTokens  / 1_000_000) * inputRate
     + (outputTokens / 1_000_000) * outputRate
```

## Provider Cost vs. Estimated Cost

| Metric | Source | When used |
| --- | --- | --- |
| Provider Cost | PROVIDER\_REGISTRY exact match | Model is recognized |
| Estimated Cost | FALLBACK\_ECONOMICS (conservative) | Model unknown _or_ no usage frame emitted (tokens estimated) |

> **Warning — Fallback Premium**
>
> Unknown models are priced at a deliberately high rate from FALLBACK\_ECONOMICS. This overestimates cost so guardrails fail safe. A “Fallback” tag in the ledger means you should add the model to `PROVIDER_REGISTRY`.

## Pricing registry — coverage

The registry currently prices models from:

- OpenAI, Anthropic, Google (Gemini / Vertex)
- Meta (Llama), Mistral, DeepSeek, xAI, Cohere

Note: Mistral, Cohere, DeepSeek, xAI, Groq, Together and OpenRouter are now **auto-captured by the SDK** as well as priced. The one exception is a self-hosted model with no fixed public host (e.g. your own Llama endpoint) — it's priced but not auto-detected, so route it via the [Edge Proxy](https://docs.atlasburn.com/docs/proxy-quickstart.md) or post events to [/api/ingest](https://docs.atlasburn.com/docs/api-reference.md).

## Reconciliation

The normalization engine resolves provider-specific fields (`prompt_tokens`, `input_token_count`, `usageMetadata.promptTokenCount`) into a single deterministic schema before any comparison with an invoice.

## Confidence

We are not publishing a fixed accuracy percentage at this time — see [Accuracy](https://docs.atlasburn.com/docs/accuracy.md) for methodology and an explanation of why the previous figure was withdrawn after the streaming-usage capture fix.

## Edge cases

- Rates are **USD per 1M tokens** — the canonical unit.
- A “Fallback” tag means the model was not in PROVIDER\_REGISTRY.
- Events with estimated tokens carry an `est`/`~est` flag in the ledger.
- Vector-database costs are **not yet** in the normalization engine.

## Next Steps

- [Accuracy](https://docs.atlasburn.com/docs/accuracy.md) — methodology and variance sources
- [Telemetry Architecture](https://docs.atlasburn.com/docs/telemetry.md) — including Streaming Usage
- [Glossary](https://docs.atlasburn.com/docs/glossary.md) — observed spend, burn rate, fallback premium

---

Canonical: https://docs.atlasburn.com/docs/cost-engine/
