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

# Credit History

> Track your credit usage over time

## Credit History

Track your credit usage and transactions over time using the `get_credits_history()` method.

### Example

```python theme={null}
from mira_network import MiraClient

async def view_credit_history():
    async with MiraClient(api_key="your-api-key") as client:
        history = await client.get_credits_history()

        # Transactions are under "items"
        for transaction in history["items"]:
            print(f"{transaction['amount']}: {transaction['description']}")
```

### Response Structure

`get_credits_history()` returns a paginated object; transactions are in `items`. Usage is recorded as a **negative** `amount` (a debit), credit top-ups as positive:

```python theme={null}
{
    "items": [
        {
            "id": "0568480b-8fca-4bea-a8c3-325c75736710",
            "user_id": "kS5ltHsyLQIy5TVEua4NN6Nv3sQEQrXK",
            "amount": -0.0000024,   # USD (negative = usage)
            "description": "AI usage: gpt-4o-mini (12+1 tokens)",
            "created_at": "2026-01-01T00:00:00.000Z"
        }
        # ... more transactions
    ],
    "total": 1,
    "page": 1,
    "page_size": 10,
    "total_pages": 1
}
```

### Visual Analytics

For detailed credit usage analytics and visualizations:

1. Visit [Mira Console Credit History](https://console.mira.network/credit-history)
2. View usage patterns, trends, and detailed breakdowns
