# Credits for Laravel

## Features

- **[Holds for AI calls](https://packstub.dev/docs/credits/holds)**: reserve an estimate before the call, settle what it cost after; a dead worker leaks nothing.
- **[Credits that expire, spent in order](https://packstub.dev/docs/credits/spending#grants-and-lots)**: every grant is a lot with its own expiry, taken soonest-expiring first.
- **[Meters with exact fractions](https://packstub.dev/docs/credits/meters#exact-fractions)**: 400 tokens at 1 credit per 1,000 charge nothing yet; the remainder carries to the next call.
- **[Plan allowances without a cron](https://packstub.dev/docs/credits/allowances)**: granted once per period on first use, however many workers race; anchored or calendar.
- **[Idempotency keys](https://packstub.dev/docs/credits/spending#idempotency-keys)**: a retried job or webhook never charges twice; a reused key for a different request is an error.
- **[Refunds and transfers](https://packstub.dev/docs/credits/spending#refunds)**: credits go back to the lots they came from, or move to another wallet, keeping their expiry.
- **[Upgrades, rollover, rates per plan](https://packstub.dev/docs/credits/allowances)**: a bigger plan grants the difference at once; quotes before charging.
- **[Reporting from the ledger](https://packstub.dev/docs/credits/spending#reporting)**: what expires when, the balance at any moment, credits spent and usage per period.
- **[Books that balance](https://packstub.dev/docs/credits/auditing)**: append-only lines, row locks, and `credits:audit` to prove every cached number from the rows under it.

Integer credits throughout (pick your scale: 1 credit = 1/1000 of a cent works), no floats, SQLite, MySQL, MariaDB and Postgres.

## Guides

- [Installation and configuration](https://packstub.dev/docs/credits/installation)
- [Wallets, lots and spending](https://packstub.dev/docs/credits/spending)
- [Holds and AI calls](https://packstub.dev/docs/credits/holds)
- [Meters](https://packstub.dev/docs/credits/meters)
- [Allowances](https://packstub.dev/docs/credits/allowances)
- [Selling credits](https://packstub.dev/docs/credits/selling-credits)
- [Auditing and concurrency](https://packstub.dev/docs/credits/auditing)
