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

# Credits

> How work uses credits.

Work in ImpelLabs uses credits. Each workspace has one wallet. You read the wallet and the use of credits through the API. You buy credits in the app.

## The wallet

```bash theme={null}
curl https://api.impellabs.tech/api/v1/billing/wallet \
  -H "Authorization: Bearer YOUR_API_KEY"
```

| Field | Meaning |
| - | - |
| `balance` | What you can use now: `included` plus `purchased`. |
| `included` | Credits the plan or the trial gave for the period. |
| `purchased` | Credits the business bought. They do not expire (`purchased_credits_expire` is `false`). |
| `granted` | What the period gave: the base for the alerts. |
| `lasts_until` | When the balance ends at the current rate, or `null`. |
| `rate_per_day` | The current use per day, or `null`. |
| `state` | `ok`, `low` or `empty`. |
| `credit_alert` | `low`, `critical`, `exhausted` or an empty string. |

The alert is `low` at 20 percent of `granted`, `critical` at 5 percent and `exhausted` when the balance is zero or less. ImpelLabs tells the workspace once for each level in a period.

You need the capability `billing.view` to read the wallet. A member does not hold it by default.

## Use of credits

`GET /api/v1/billing/ledger` lists each entry: `kind`, `credits`, `source`, the member and agent, and `created_at`. A `kind` is `grant`, `purchase`, `spend`, `gift` or `expire`. Filter with `days` (30 by default, up to 365), `kind`, `member` and `agent`. Entries are paged.

`GET /api/v1/billing/usage/{by}` totals the same window by `source`, `member` or `agent`. Each row has `id`, `name`, `credits` and `share`.

`source` says what used the credits, such as a chat or a workflow.

## When credits run out

When the balance is zero, the wallet `state` is `empty` and `credit_alert` is `exhausted`.

## Credits and your own providers

A provider that a business connects with its own account is paid by that account. ImpelLabs credits pay for the work the platform does.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.