# Credits & Billing

> How credits work, how usage is calculated, and how to manage your balance. Free monthly grants, pay-as-you-go top-ups, and transaction history.


# Credits & Billing

AnyRouter uses a **credit-based billing system**. Your account holds a USD balance (credits), and each API request deducts the exact cost from that balance. There are no fixed monthly fees — you only pay for the tokens you actually use.

## Free monthly grant

Every account receives a **$5.00 free grant** at the start of each month. This is automatically credited to your balance when you make your first request in a new billing period.

The free grant is enough for thousands of requests with most models. For example:

- ~250K output tokens from `anthropic/claude-haiku-4.5`
- ~50M output tokens from `meta-llama/llama-3.3-70b`
- ~25K output tokens from `openai/gpt-4-turbo`

Free grants do not roll over — unused credits expire at the end of the month.

## How costs are calculated

Each API request is billed based on the model's per-token pricing:

| Token type | Billed at | Notes |
|---|---|---|
| Input tokens | Model's input price per 1K tokens | The prompt you send |
| Output tokens | Model's output price per 1K tokens | The completion you receive |
| Cached tokens | Provider's cache-read rate (typically 10% of input) | Tokens served from cache |
| Cache write tokens | Provider's cache-write rate (typically 125% of input) | First-time cache population |

You can see per-model pricing on the [models page](/models). Every model detail page shows both standard and cache pricing.

### Cost calculation example

```
Model: anthropic/claude-sonnet-4.6
Input:  1,000 tokens @ $0.003/1K  = $0.003
Output: 500 tokens   @ $0.015/1K  = $0.0075
Total: $0.0105
```

Cached tokens reduce costs significantly. If 800 of the 1,000 input tokens were cached:

```
Cached: 800 tokens  @ $0.0003/1K (10% of input) = $0.00024
Input:  200 tokens  @ $0.003/1K                = $0.0006
Output: 500 tokens  @ $0.015/1K                = $0.0075
Total: $0.00834  (20% savings)
```

## Topping up

When your free grant runs out, top up your balance from [the Credits dashboard](/dashboard/credits). Purchases are processed via Stripe. The minimum top-up is $1.00.

Purchased credits **never expire** — they remain on your balance until used.

## Checking your balance

### Dashboard

The [Credits page](/dashboard/credits) shows your current balance, a breakdown of free vs. purchased credits, and a full transaction history.

### API

Check your balance programmatically:

```bash
curl https://anyrouter.dev/api/v1/credits \
  -H "Authorization: Bearer ar-your-key"
```

Response:

```json
{
  "total_credits": 25.00,
  "used_credits": 12.47,
  "remaining_credits": 12.53,
  "currency": "usd",
  "free_grant_this_month": 5.00,
  "free_grant_used": 4.23
}
```

### Transaction history

List all credit transactions (purchases, usage, grants, refunds):

```bash
curl "https://anyrouter.dev/api/v1/credits/transactions?limit=20" \
  -H "Authorization: Bearer ar-your-key"
```

Each transaction includes:

| Field | Description |
|---|---|
| `type` | `purchase`, `usage`, `monthly_grant`, `refund`, `admin_grant`, `bonus` |
| `amount` | Positive for credits added, negative for usage deducted |
| `model_id` | The model used (for `usage` transactions) |
| `balance_after` | Your balance after this transaction |

## Insufficient balance

If a request would cause your balance to drop below zero, the API returns:

```json
{
  "error": {
    "type": "insufficient_balance",
    "code": "insufficient_balance",
    "message": "Insufficient balance. Please top up your credits."
  }
}
```

The request is **not** processed — no tokens are consumed and no charge is applied. Top up your balance and retry.

## Rate limits by plan

| Plan | Rate limit | Free grant | BYOK |
|---|---|---|---|
| Free | 60 req/min | $5/month | No |
| Pay-as-you-go | 600 req/min | $5/month | No |
| Enterprise | Custom | Custom | Yes |

## Usage in the response

Every chat completion response includes a `usage` object so you can track costs client-side:

```json
{
  "usage": {
    "prompt_tokens": 5840,
    "completion_tokens": 120,
    "total_tokens": 5960,
    "cached_tokens": 5800
  }
}
```

Use these values with the model's published pricing to compute the request cost in your own code.
