# Class LittleGhost::Usage

Documentation version: Edge

Canonical HTML: https://littleghostai.org/docs/LittleGhost/Usage.html

Usage makes token accounting consistent across model providers. It keeps
input, output, cache, and reasoning counts separate so applications can
aggregate them without double-counting.

Providers report uncached input, visible output, cache reads, cache writes,
and reasoning separately. Invalid or negative values normalize to zero.

## Inheritance

`LittleGhost::Usage < Object`

## Class methods

<a id="method-c-new"></a>
### `.new`

```ruby
.new(input_tokens: 0, output_tokens: 0, cache_read_tokens: 0, cache_write_tokens: 0, reasoning_tokens: 0)
```

Normalizes provider token counts; invalid or negative values become zero.

## Instance methods

<a id="method-i-2B"></a>
### `#+`

```ruby
#+(other)
```

Adds two usage values field by field.

<a id="method-i-to_h"></a>
### `#to_h`

```ruby
#to_h()
```

Exposes every field and `total_tokens` as a hash.

<a id="method-i-total_tokens"></a>
### `#total_tokens`

```ruby
#total_tokens()
```

Sums every normalized token field.
