# Credits and budgets

> How Lumen meters work in credits, what makes a run cost more or less, how budgets hold runs instead of failing them, what the plans include, and what the savings figures mean.

Source: https://docs.go-lumen.ai/he/concepts/credits-and-budgets

**In one sentence**: Lumen charges every run in credits, drawn from one pool per workspace: a fixed weight for each step that succeeded plus model tokens for AI steps; an optional monthly budget on a flow or the whole workspace holds new runs once it is used up, never failing them.

One unit, credits, covers everything a run uses. There are no separate line items for compute, storage per run or API calls. A step's weight stands for what it costs to run, so the price of a flow is something you can add up in advance and read back on every run.

This page explains the model. To read the **Billing** screens, see [Billing and usage](https://docs.go-lumen.ai/he/operate/billing-and-usage.md).

## What a run costs

```text
run credits = the weight of each step that succeeded
            + model tokens at the model's credit rate   (nothing on your own key)
```

-   **Step weights.** Every step in the catalog has a weight, shown next to it in the editor as an estimate. Most steps weigh 1 or less. A few weigh 0, such as the agent memory tools **Remember** and **Recall**, and a few weigh more: **Merge them into one PDF** and **Split the PDF** are 3, and **Read a scan or photo** is 5 because a photo has no text to read. A step whose catalog entry states no weight counts as 1 credit, so nothing is free by being left out.
-   **Only success is charged.** A step that fails costs nothing, and neither does one that is skipped. A step reused when you run again from a step (its earlier outputs are copied, not run again) costs nothing either.
-   **Model tokens.** An AI step also pays for the tokens its model reads and writes, at that model's credit rate per thousand tokens, rounded up so a call is never charged as less than it was. A step that does not call a model costs only its weight.
-   **Precision.** Credits are counted in thousandths. The smallest amount is 0.001, and sums are exact.

The flow editor shows an estimate on each step and for the whole flow. It is the sum of the weights, so a flow with an AI step reads as a floor: the tokens come on top and depend on the documents.

### Agents and their tool calls

An **agent** step is charged its own weight and its tokens. When the agent calls a tool (another step, such as finding a row or sending an email), each **successful call** costs that tool's weight, per call and not per declared tool. A failed call costs nothing. If a tool itself calls a model, its tokens are counted with the agent's.

An agent can be capped. Its `limits.maxToolCredits` is the most its tool calls may be charged in one run of the step. The call that would pass it is not made, and the agent stops with that reason. Unset, tool calls are bounded by the agent's turn limit only. The run page and **Billing** show tool credits under the agent. See [Agents](https://docs.go-lumen.ai/he/ai/agents.md) and [Models and cost](https://docs.go-lumen.ai/he/ai/models-and-cost.md).

### Your own model key

On a plan that includes it, a workspace can add models on its own provider key. A call on your own key costs no token credits, because your provider bills you for those tokens directly. The step's weight is still charged, and **Billing** lists the tokens on your key separately as **Your own models**.

### Free flows

Some of Lumen's own system flows, such as the ones behind problem reports, are free: they are metered but never charged and never held by a budget. You cannot mark your own flow free.

### Tests

Trying a single step in the editor is metered but never charged. An evaluation, which runs a flow on its test cases, is charged at the normal rate and marked as an evaluation in the ledger. Neither counts against a budget. See [Test and evaluate](https://docs.go-lumen.ai/he/build/test-and-evaluate.md).

## Budgets

A **budget** caps how many credits runs may use in a calendar month. There are two kinds.

| Budget | Set by | Where |
| --- | --- | --- |
| A **flow's** budget | The flow's author | `spec.budget.monthlyCredits` on the flow |
| The **workspace's** budget | A workspace admin | The `budget` endpoint of the runtime API |

A budget counts the credits of the runs that **started** in the month, runs still in progress included. It is checked when a run is admitted, and two things follow:

-   **A run that would go over is held, not failed.** It waits with the status **On hold** and a reason of `budget`. Nothing it carries is lost.
-   **Runs already going are not stopped.** A budget decides whether a new run may start, never whether a run in progress may finish.

A held run starts by itself as soon as the reason clears: the month turns over, or the budget is raised or removed. Setting a budget of `0` holds every new run. No budget, or an empty one, is no limit.

### Notices at 80% and 100%

For the workspace budget, the workspace's admins are told at 80% and again at 100%, once each per month. The notice appears in their in-app inbox, titled **Workspace budget: 80% used** and **Workspace budget reached**, and links to **Billing**. An alert rule for a budget threshold can tell people too; see [Alerts](https://docs.go-lumen.ai/he/operate/alerts.md).

**YAML:**

```yaml title="credits-capped-invoice-flow.yaml"
apiVersion: lumen.ai/v1alpha1
kind: Flow
metadata:
  name: credits-capped-invoice-flow
  namespace: tenant-acme
spec:
  displayName: Keep invoice PDFs (capped)
  budget:
    monthlyCredits: "200"
  triggers:
    - id: email
      ref: {name: email-arrives}
      connectorRef: {name: invoices-inbox}
      config: {attachments: separate, requireAttachment: true}
      next: [pdfs]
  nodes:
    - id: pdfs
      stepRef: {name: keep-pdfs}
      next: [keep]
    - id: keep
      stepRef: {name: keep-in-lumen}
```

**Console:**

**Billing** shows how much of the month's credits are used and which flows used them. A flow's budget is set on the flow's resource (see the YAML tab), and the workspace budget through the API by an admin.

**CLI:**

```bash title="Apply the flow"
lumen apply -f credits-capped-invoice-flow.yaml
```

A budget is part of the flow resource, so `lumen apply` sets it with the rest.

## Plans

A workspace is on a **plan**, which sets its limits and the features it has. A workspace with none named is on **Pro**. The plans that ship are:

|  | Pro | Team | Enterprise |
| --- | --- | --- | --- |
| Seats (every member, admins included) | 5 | 20 | 100 |
| Parallel runs | 3 | 10 | Unlimited |
| Flow history kept | 30 days | 90 days | Forever |
| Models on your own key |  |  | Yes |
| Single sign-on |  |  | Yes |
| Billed by | Credits | Credits | License |
| Compute | Shared | Shared | Dedicated |

An installation can edit these numbers or add plans of its own, so the figures on your **Billing** page are the ones that apply to you. A few notes:

-   **Parallel runs.** Runs beyond the limit are queued, never failed.
-   **Credits-billed plans** have a monthly fee with included credits, then top-ups. The prices and included credits are set by whoever runs the installation. When the plan sets a credit price, **Billing** also shows credits as dollars; otherwise credits only.
-   **License plans** (Enterprise, and installations in your own cluster) are metered for visibility and never charged.
-   A feature your plan does not include is shown with the plan that would unlock it, for example "Available on Enterprise".

## Savings

**Saved by Lumen** on **Billing** reports model tokens Lumen kept away from the models, and what they would have cost. It does not measure time saved by automating a chore, and it is not money you were refunded. It counts two kinds of token, never mixed:

| Figure | Kind | How it is worked out |
| --- | --- | --- |
| **Tokens saved** | Estimated | Lumen avoids sending duplicate or unneeded images to the model, and the tokens that would have cost are counted here. |
| **Tokens served from cache** | Reported | Input tokens the model provider served from its prompt cache, which it reports itself. |
| **Estimated worth** | Estimated | The saved tokens of agent steps at each model's input credit rate, shown in credits, and in dollars when the plan sets a credit price. Steps on your own key are valued in dollars at the provider's input price. |
| **Data deduplicated** | Measured | The size of duplicate images never stored again. |

Each run also shows an icon with the tokens it saved.

## Next steps

[Billing and usageRead the Billing screens: credits left, daily usage, cost per flow and per step.](https://docs.go-lumen.ai/he/operate/billing-and-usage.md)[Models and costChoose a model, add your own key, and see what an AI step costs.](https://docs.go-lumen.ai/he/ai/models-and-cost.md)[AlertsBe told when a budget is close or a run costs far more than usual.](https://docs.go-lumen.ai/he/operate/alerts.md)[Workspaces and accessWho may change budgets, and how plans gate features.](https://docs.go-lumen.ai/he/concepts/workspaces-and-access.md)
