---
title: "LLM & Billing in Rig: choose a model, track its cost"
description: "Run Rig on its hosted model or your own OpenAI, Anthropic, Gemini, AWS Bedrock or Azure OpenAI key, add a builder key, and see usage and cost by model and agent."
canonical: "https://rig.so/guides/llm-and-billing"
format: markdown
---

Search guides, references, playbooks…⌘K

Browse guides

# LLM & Billing: choose a model and watch what it costs

Rig uses a language model to read your warehouse, build context and answer questions. This page is where an owner decides whose model that is, and sees what it has cost.

## Where it is

Open **Settings** and choose **LLM & Billing** in the **Workspace** group. The section is headed **Language model**, with **Usage & cost** below it.

Only workspace owners see it in Settings, and only owners can change it. If it is missing from your Settings, an owner has to make any change for you. In a self-serve workspace, the same panel is also the **Language model** step of the setup wizard under **Connections** → **Connectors**. With the **Manage connections** permission you can see it there read-only, without the **Change** button, and before a model is set it asks you to have an owner pick one.

If Rig set up your workspace and you see both options, ask Rig before choosing, so you don't replace the setup Rig made.

## Rig-hosted or your own key

Rig has two options:

- **Use Rig-hosted LLM** needs no key. Rig provisions a dedicated OpenAI project for your workspace, with its own keys, isolated from every other customer, and with do-not-train enforced. Click **Provision dedicated keys** to set it up.
- **Bring your own key** runs Rig on your own provider account. Pick the **Provider** (OpenAI, Anthropic, Gemini, AWS Bedrock or Azure OpenAI), paste the key and click **Save LLM choice**. AWS Bedrock takes no single key: it asks for an **AWS region**, an **AWS access key id** and an **AWS secret access key** instead. Azure OpenAI asks for a **Resource endpoint** and an **API version** as well as the key.

With an OpenAI, Anthropic or Gemini key, **Default model (optional)** can be left blank, and Rig then picks a model for each kind of task. AWS Bedrock needs a **Bedrock model id** and Azure OpenAI a **Chat deployment name**. Bedrock has no embeddings model, so Rig embeds on an OpenAI key: leave **OpenAI embeddings key (optional)** blank to use Rig's, or paste your own. For Azure OpenAI, set **API version** to one that supports the Responses API, 2025-03-01-preview or later. Older versions only support chat completions, and the tool calls Rig's chat relies on fail. Whichever option you choose, keys are stored in AWS Secrets Manager and never in Rig's database or logs.

Rig checks the key before saving it
When you save your own key, Rig calls the provider to confirm it works. If the provider rejects it, or it looks like a key for a different provider, nothing is saved and the message tells you why. For AWS Bedrock the check confirms the AWS credentials only, so a missing permission for the model shows up on the first question instead.

## A separate builder key

With your own key you can tick **Add a separate builder key (optional, recommended)**. Rig then builds context on that second key while live chat stays on the first, so building and chatting are metered separately. The builder key can be OpenAI, Anthropic or Gemini. The option does not appear when the main provider is AWS Bedrock or Azure OpenAI.

## Changing provider or key

Click **Change** on the summary of your current choice, then pick an option again and save, as above. Change acts as soon as you click it, with no confirmation, so have the new key ready first:

- It deletes the keys Rig has stored for you, including a builder key.
- On Rig-hosted, it archives your dedicated provider project and revokes its keys. Choosing Rig-hosted again provisions new ones.
- It clears any monthly spend cap Rig has set for your workspace, because the cap is stored with your provider choice. Ask Rig support to set it again.

Swapping providers needs no re-sync of any data. Your sources and your context layer stay as they are.

## Usage and cost

**Usage & cost** shows the tokens and cost of every model call the workspace makes. Switch between **Today**, **Month** and **All**; it opens on Month. Today starts at midnight UTC, and Month at midnight UTC on the 1st. The cards at the top give **Total cost**, **Calls** and **Tokens (in / out)**, and two tables split the same figures **By model** and **By agent**, so you can see which part of Rig is doing the spending. Calls that failed or were refused are shown in red beside the count, as **N failed**, and are not included in it. Their tokens and cost still count, because the provider may have billed them. On a busy period the page may say *Showing the most recent calls only — totals are capped for this period.* The figures then cover only the most recent calls.

Cost is Rig's estimate at the provider's list price, with cached prompt tokens at the provider's lower cached rate, so it can differ from your invoice if you have agreed other rates. When the published rates do not cover a model, such as an Azure deployment name, Rig prices it from its own table of model prices. A model with no known price still counts its tokens but shows its cost as $0.00. There is no spend cap to set on this page; if you want one, ask Rig support.

## When the model fails

When the model provider refuses a call, the answer stops and Rig shows you the provider's own error. In a chat it is a red line that starts *This turn ended with an error: Turn failed:* and usually goes on with the type of error, such as *RateLimitError*, and then the provider's message. In Slack, @rig replies with *Query failed:* and the same text, then a line reading *View details:* followed by a link. Look for these words in the message:

| If the error mentions | What to do |
| --- | --- |
| quota, insufficient\_quota or credit balance is too low | The provider account is out of credit. On your own key, top up the account with the provider or save a key that has credit. On Rig-hosted, contact Rig support. |
| rate limit, rate\_limit or 429 | Too many requests in a short time. Wait a minute and ask again. If it keeps happening on your own key, ask your provider for a higher limit. |
| invalid\_api\_key or authentication | The provider no longer accepts the key. On your own key, an owner saves a working key in LLM & Billing. On Rig-hosted, contact Rig support. |
| overloaded, 502 or 503 | The provider is busy. Wait a moment and ask again. |
| LLM monthly budget exceeded | Your workspace has spent its monthly cap, and Rig stops model calls until the next month starts (midnight UTC on the 1st). Ask Rig support to raise the cap. |
| context\_length\_exceeded or maximum context length | The conversation has grown too long for the model. Start a new chat or ask a narrower question. |

A few places in Rig replace the provider's text with a shorter message, such as *The AI provider key for this workspace was rejected — contact your Rig admin.* Those mean the same as the matching row above.

For a failed step in a data app, see [When a data app run fails](https://rig.so/guides/data-app-troubleshooting).

Was this guide helpful?

Yes No

---

- [This page as HTML](https://rig.so/guides/llm-and-billing)
- [Site map for language models](https://rig.so/llms.txt)
- [API and agent documentation](https://rig.so/developers)
