# Models and cost

> Which models your agents can run on, how to choose one per agent or per workspace, how to bring your own provider key, and how model usage turns into credits and the estimates shown in the editor.

Source: https://docs.go-lumen.ai/ai/models-and-cost

An agent runs on a model. Lumen offers platform models you pay for in credits, and on a plan that includes it you can add models on your own provider key, whose tokens cost no credits. The flow editor estimates what a run will cost before you turn it on.

-   Uses credits
-   Own keys need a plan that includes them

## Which model an agent uses

Lumen picks the model in this order and uses the first that applies:

1.  The model the agent names for itself (its **Model** segment, or `modelRef` on a flow node).
2.  For an agent that only fills fields and has no tools, the platform's fast model, if the installation has one, it is offered to your workspace, and your workspace default is not a model on your own key. See [Find details in documents](https://docs.go-lumen.ai/ai/find-details.md).
3.  Your workspace's default model.
4.  The platform's default model.

If none of these exists, AI is not switched on for the workspace and AI steps say so instead of running.

## See and choose models

## Look at your models

1.  Open **Settings**. The **Models** card has two lists: **Platform models** and **On your own key**. Each row shows its **Provider**, **Model** and **Status**.
2.  The row marked **Default** is what agents use when they name no model. Admins can set another with the star (**Set as the default for this workspace**). A model that is the default cannot be deleted until you pick another.
3.  If no default is set, the card says AI steps run on a named platform model, or that they do not run yet when the platform has none.

![The Models card in Settings. Under On your own key, one model on a provider key is listed with the status Ready, and an Add model button. Under Platform models, two Anthropic models are listed with the status Ready, one of them marked Default. Rows have star, edit and delete icons for admins.](https://docs.go-lumen.ai/img/ai/models-01-settings.png)

*Settings, Models: platform models and your own, with the workspace default marked.*

## Choose a model for one agent

1.  Open the agent, then its **Model** segment, and pick a model. Left empty, the agent uses your default.
2.  Save. A saved agent records this in its next revision.

Which models are on the **Platform models** list depends on your installation. Some can be limited to certain workspaces.

## Bring your own key

A model on your own provider key is billed by your provider, not in credits. Lumen still records the calls for audit, limits and metering. Only the key is yours.

> **Plan feature:**
> 
> Models on your own key are the `byoModel` feature of a plan. The default **Enterprise** plan includes it; **Pro** and **Team** do not. Without it, **Add model** is not offered and the console says the feature is not part of your plan.

**Console:**

1.  In **Settings**, **Models**, click **Add model**. Only admins see it.
2.  Enter a **Name** (lowercase letters, digits and dashes; it cannot change later), choose the **Provider**, and enter the **Model** id, for example `claude-sonnet-5-5`. **List models** shows what the key can reach.
3.  Paste the **API key**. It is stored securely and never shown again, not even to admins.
4.  Click **Test**, then **Save**. Lumen checks the key once. The row's **Status** reads **Ready**, or says why not: **Key rejected**, **Model not found**, **No key**, **Provider not allowed**, **Settings not valid**.
5.  Use the star to make it the workspace default, or pick it in an agent's **Model** segment.

**YAML:**

```yaml title="our-claude.yaml"
apiVersion: lumen.ai/v1alpha1
kind: ModelClass
metadata:
  name: our-claude
  namespace: tenant-acme
spec:
  provider: anthropic
  model: claude-sonnet-5-5
  credentialsRef:
    name: our-claude-key
```

`credentialsRef` names a Secret in the workspace holding the key under `apiKey`. The console writes it for you. On a self-hosted installation it can be fed from your own secret store. A model that is not **Ready** is refused by AI steps.

To use it on one agent node:

```yaml title="excerpt of an agent's config"
config:
  modelRef: {kind: ModelClass, name: our-claude}
```

An installation allows a set of providers, for example Anthropic and OpenAI, and may allow more providers (Azure OpenAI, Gemini, Vertex, Bedrock, Mistral and others). A provider outside that set is **Provider not allowed**. Some providers take non-secret settings besides the key, such as a region or a base URL.

## How tokens become credits

A run is charged credits for what its steps do. For an AI step:

```text
agent credits = the step's weight
              + input tokens  x the model's input rate
              + output tokens x the model's output rate
              + each successful tool call x that tool's weight
```

The step's weight is 3 credits for an agent with tools and 1 for an agent that only fills fields. Rates are credits per 1,000 tokens, input and output. A model with no rate is not charged for its tokens, and a model on your own key never is. A tool call that fails costs nothing.

For example, at a rate of 0.2 credits per 1,000 input tokens and 1 per 1,000 output tokens, a call that uses 10,000 tokens in and 1,000 out costs 2 + 1 = 3 credits, on top of the step's weight.

Each model's credit rate is shown on the Models page in the console. For how credits, plans and budgets work, see [Credits and budgets](https://docs.go-lumen.ai/concepts/credits-and-budgets.md).

## Estimates in the editor

Every step on the canvas shows what it will cost, and the flow shows the total next to its name. Click it to open **What this flow costs per run**.

![The estimate popover of a flow. The heading is What this flow costs per run, followed by About 3 credits ($0.06) per run and About 948 credits ($19) a month at 316 runs. A Runs a month field holds 316. Below it reads 380 of your 1,500 included credits left this month, then a list of three steps with about 1 credit each.](https://docs.go-lumen.ai/img/ai/models-02-estimate.png)

*The flow's estimate: per run, per month at a volume you can change, and what is left of your plan.*

-   **Per run** and **a month** at the **Runs a month** you enter. With no runs in the last 30 days, a month is estimated at 100 runs.
-   Each step's share, and for a step that runs only on some paths, how often a run reaches it.
-   **Where it comes from.** With at least 5 runs of a step, the estimate uses the flow's own history: the typical tokens, priced at the model's rate today. It says **Estimated from this flow's last N runs**, and is firmer from 20 runs. Before that it is **A typical estimate** from a table of typical sizes by kind of step and model.
-   **Warnings.** **Some steps run on your own AI key: their AI usage costs no credits**, **A model here has no credit price yet, so its AI usage is not counted**, and **AI is not switched on for this workspace, so the AI steps' usage is not counted**.
-   Turning on a flow whose month would use more than the included credits you have left asks first: **Turn on this flow?**

An estimate is an estimate. The run itself shows what it used, and an agent's **Try it** shows its tokens and tool credits.

## Next steps

[Credits and budgetsWhat a credit is and how a budget holds runs.](https://docs.go-lumen.ai/concepts/credits-and-budgets.md)[AgentsChoose a model for an agent.](https://docs.go-lumen.ai/ai/agents.md)[Find details in documentsThe cheapest way to read a document.](https://docs.go-lumen.ai/ai/find-details.md)[Billing and usageSee what your workspace has used.](https://docs.go-lumen.ai/operate/billing-and-usage.md)
