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

# Usage Tracking

> Track token usage and costs.

Every provider supports tracking token usage and costs.

## Basic Usage

The `ChatResult` object includes a `usage` property that contains the token
usage and costs.

```dart theme={null}
final agent = Agent('openai');
final result = await agent.send('Explain AI briefly');

// Access usage
print('Input tokens: ${result.usage.promptTokens}');
print('Output tokens: ${result.usage.responseTokens}');
print('Total tokens: ${result.usage.totalTokens}');
```

## Embeddings Usage

The `EmbeddingsModel` class includes a `usage` property that contains the token
usage and costs as well.

```dart theme={null}
final agent = Agent('openai');
final result = await agent.embedDocuments([
  'Text 1',
  'Text 2',
  'Text 3',
]);

print('Tokens used: ${result.usage.totalTokens}');
```

## Examples

* [Usage Tracking](https://github.com/csells/dartantic_ai/blob/main/packages/dartantic_ai/example/bin/usage_tracking.dart)

## Next Steps

* [Providers](/providers) - Compare provider costs
