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

# Credits and pricing

> Estimate, reserve, charge, refund: how a generation is paid for.

Generations spend the same credits as the Argil app, from the same balance, and need an active Argil [plan](https://docs.argil.ai/v2/account/plans.md).

## Price list

Each mode in the catalog has a `pricing` object: the unit the model is billed in, its price in words, the same the Argil app shows, and how the charge settles.

```json theme={null}
"pricing": {
  "currency": "credit",
  "unit": "seconds",
  "description": "~11.18 credits per second at 720p (Seedance 2.5; rate varies by resolution; output + input-video seconds both billed)",
  "settlement": "settled_on_actual_usage"
}
```

See every price in the [model catalog](https://docs.argil.ai/v2/models/overview.md). For the exact price of a request, use the estimate.

## Estimate

`POST /v2/generations/estimate` takes the `model`, `mode` and `input` of a create request and returns its price and whether your balance covers it. It runs the same checks as creation, references included, and creates no generation. A URL reference is imported into your library, as a create imports it: the create that follows with the same URL reuses that asset.

```json theme={null}
{
  "object": "generation_estimate",
  "model": "seedance-2.5",
  "mode": "reference-to-video",
  "credits": { "estimated": 89.47, "reserved": 90 },
  "settlement": "settled_on_actual_usage",
  "balance": { "available": 1240.5, "sufficient": true }
}
```

Use the estimate, not the price list, to show prices to your users: some models price on inputs (the length of reference videos) only the estimate measures, and a generation that runs on your own provider key costs 0 credits.

## Your own provider keys

When your workspace has its own key for a provider a model runs on (workspace settings › Provider keys in the Argil app), API generations use it first, exactly as the playground does: they cost 0 credits, and the estimate says so. Argil's keys take over only if your workspace allows the fallback. See [Provider keys](https://docs.argil.ai/v2/account/provider-keys.md).

## Reserve, charge, refund

Every generation carries its money in `cost`:

| Field | Meaning |
| - | - |
| `estimated` | The price of the request. |
| `reserved` | Whole credits taken from your balance when the generation was created: `estimated` rounded up. |
| `charged` | The final price, set when the generation is final. |
| `refunded` | `reserved − charged` when it is positive, returned to your balance. |

1. **Creation** reserves the credits, or answers `402 insufficient_credits` and creates no generation. URL inputs may already be in your library: they are imported before the credit check.
2. **Settlement**, when the generation is final:
   * `fixed`: `charged = reserved`.
   * `settled_on_actual_usage`: `charged` follows what the model actually produced, in whole credits rounded up. Less than `reserved`, the difference is refunded; more, the difference is charged as far as your balance covers it.
3. **Refunds**: a generation that fails before the model produced its output is refunded. One whose output could not be stored afterwards (`output_processing_failed`) is charged, since the model ran.

A `402` says what is missing, and where a person adds credits to this workspace (`url`, which opens it in Argil):

```json theme={null}
{
  "type": "https://docs.argil.ai/v2/platform/errors#insufficient_credits",
  "title": "Insufficient credits",
  "status": 402,
  "detail": "This generation reserves 90 credits; 40 are available. Add credits: https://argil.ai/workspace-settings?tab=credits&workspace=4a6c8e0b-2d4f-4a6c-8e0b-2d4f6a8c0e71",
  "code": "insufficient_credits",
  "request_id": "req_8c1e4b7d2a9f4e6c8b0d3f5a7c9e1b24",
  "retryable": false,
  "billing": { "required": 90, "available": 40 },
  "url": "https://argil.ai/workspace-settings?tab=credits&workspace=4a6c8e0b-2d4f-4a6c-8e0b-2d4f6a8c0e71"
}
```

## Balance

```bash theme={null}
curl https://api.argil.ai/v2/balance -H "Authorization: Bearer $ARGIL_API_KEY"
```

```json theme={null}
{
  "object": "balance",
  "available": 1240.5,
  "reserved": 90,
  "pools": { "plan": 840.5, "pay_as_you_go": 400 }
}
```

`available` is what you can spend now: what generations in flight hold (`reserved`) is already out of it. Plan credits are spent before pay-as-you-go credits. A workspace without an active plan spends nothing through the API, so its `available` and pools are 0.


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