> ## Documentation Index
> Fetch the complete documentation index at: https://docs.abv.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Model Usage & Cost Tracking

ABV provides comprehensive tracking of LLM usage and costs, helping you understand and optimize your AI application expenses. This guide will help you get started with cost tracking and point you to the right resources.

## What You Can Track

ABV monitors two key metrics for every LLM generation:

<CardGroup cols={2}>
  <Card title="Usage Details" icon="chart-bar">
    Number of units consumed per usage type (tokens, characters, etc.)
  </Card>

  <Card title="Cost Details" icon="dollar-sign">
    USD cost per usage type, calculated or ingested
  </Card>
</CardGroup>

**Supported usage types:**

* `input` / `output` - Basic token counts
* `cached_tokens` - Cached input tokens (Anthropic prompt caching)
* `audio_tokens` - Audio input tokens
* `image_tokens` - Image input tokens
* `reasoning_tokens` - Reasoning tokens (OpenAI o1 models)
* Custom usage types for your specific needs

## How It Works

ABV supports two approaches to tracking usage and costs:

### 1. Ingest from LLM Responses (Recommended)

Extract usage and cost data directly from your LLM provider's API responses and send them to ABV.

**Best for:**

* Production applications
* Accurate billing and cost allocation
* All model types, including reasoning models

### 2. Infer from Model Definitions

Let ABV automatically calculate usage and costs using predefined tokenizers and pricing.

**Best for:**

* Development and prototyping
* Supported models (OpenAI, Anthropic, Google)
* Quick setup without code changes

<Info>
  **Priority:** When both ingested and inferred data are available, ABV always uses ingested values for accuracy.
</Info>

## Documentation Structure

This cost tracking documentation is organized into three focused guides:

<CardGroup cols={3}>
  <Card title="Overview" icon="compass" href="/developer/basic-features/cost-tracking-overview">
    **Concepts & Decision Making**

    Understand ingest vs infer approaches, usage types, and when to use each method.
  </Card>

  <Card title="Implementation" icon="code" href="/developer/basic-features/cost-tracking-implementation">
    **Step-by-Step Guides**

    Complete code examples for Python and JavaScript/TypeScript SDKs with all integration methods.
  </Card>

  <Card title="Reference" icon="book" href="/developer/basic-features/cost-tracking-reference">
    **API & Advanced Config**

    Custom model definitions, tokenizers, pricing configuration, and the Models API.
  </Card>
</CardGroup>

## Key Features

<AccordionGroup>
  <Accordion title="Automatic Provider Integrations" icon="plug">
    Many ABV integrations automatically capture usage and cost from LLM responses. Works with:

    * OpenAI
    * Anthropic
    * Google
    * And more...
  </Accordion>

  <Accordion title="Flexible Usage Types" icon="sliders">
    Track any usage metric that matters to you:

    * Standard tokens (input/output)
    * Cached tokens
    * Audio and image tokens
    * Reasoning tokens
    * Custom metrics for your models
  </Accordion>

  <Accordion title="Custom Model Support" icon="gears">
    Define your own models with:

    * Custom pricing per usage type
    * Regex-based model matching
    * Tokenization configuration
    * Priority over default models
  </Accordion>

  <Accordion title="Analytics & Export" icon="chart-line">
    Access your usage data through:

    * Real-time dashboards in the UI
    * Daily Metrics API for export
    * Filtering by user, tag, or application
    * Integration with your billing systems
  </Accordion>
</AccordionGroup>

## Supported Models

ABV comes with predefined support for popular models:

* **OpenAI:** GPT-4, GPT-3.5, GPT-4o, o1 (reasoning models)
* **Anthropic:** Claude 4 family (Opus, Sonnet, Haiku)
* **Google:** Gemini models

View the complete list of supported models in the ABV UI under **Settings → Model Definitions**.

<Tip>
  Don't see your model? You can [define custom models](/developer/basic-features/cost-tracking-reference#custom-model-definitions) or [request official support](https://smart-forms.saasjet.com/external?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjbGllbnRLZXkiOiJlZmZmN2JhYy0xMzZlLTNkOTUtOGIxYi1hMWQ3NWNkZWM3NGYiLCJpYXQiOjE3NTY4NDc1MDc0MDl9.Q33DbNtKAfZvsY0qs4hOfTBAzLic-VPhTrIusjkOMtI).
</Tip>
