# Creative Units & billing

**Creative Units (CUs)** are Layer’s usage currency. Every generation consumes CUs; the amount depends on the model, output size, and options. Balance is held per workspace.

## Estimate before you execute

Every execute endpoint has a matching **estimate** endpoint. Call it first to learn the cost and whether the workspace can afford it:

```bash
curl -X POST https://api.app.layer.ai/api/v1/workspaces/$WORKSPACE_ID/inferences/estimate \
  -H "Authorization: Bearer $LAYER_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ "model_id": "MODEL_ID", "parameters": { "prompt": "a mossy stone golem", "width": 1024, "height": 1024 } }'
```

An estimate returns:

| Field                                          | Meaning                              |
| ---------------------------------------------- | ------------------------------------ |
| estimated\_price\_creative\_units              | Expected cost of the run.            |
| workspace\_balance\_creative\_units            | Current available balance.           |
| estimated\_remaining\_balance\_creative\_units | Balance after the run.               |
| has\_sufficient\_creative\_units               | Whether the workspace can afford it. |

## Workspace balance

`GET /v1/workspaces/{id}` returns the balance as three numbers:

| Field                      | Meaning                                               |
| -------------------------- | ----------------------------------------------------- |
| balance\_creative\_units   | Total CUs in the workspace.                           |
| reserved\_creative\_units  | CUs held by in-progress runs.                         |
| available\_creative\_units | Usable now (balance − reserved). Can go **negative**. |

When you start a priced run, Layer places a **reservation** against the balance (it expires after \~1 hour if the run doesn’t complete), which is why `reserved` rises while a run is in flight. On completion, the run reports the actual amount charged as `actual_price_creative_units`.

## Cost is not enforced at submit

Caution

Balance is checked at **estimate** time, not at submit. An underfunded run is still accepted with `202` and then terminates `FAILED` with `error_code: INSUFFICIENT_BALANCE` (HTTP 402 semantics). Always [estimate first](#estimate-before-you-execute) and check the terminal run status. See [Async jobs](/docs/async-jobs) and [Errors](/docs/errors).

## Topping up

Creative Units are managed in the Layer app under **Settings → Billing**. There is no REST endpoint to purchase or transfer CUs.
