---
title: Cap what your team spends on AI with AI Runtime Control
summary: >-
  Use AI Runtime Control (ARC) to keep a team's AI spending predictable by
  setting a warning limit, a hard stop, and a rate limit on each engineer's
  virtual key.
url: >-
  https://www.fastly.com/documentation/solutions/tutorials/ai-runtime-control/cap-team-ai-spending
---

In this tutorial, you'll use AI Runtime Control (ARC) to keep a team's AI spending inside a monthly budget. We'll use the same three engineers from the [per-engineer usage tutorial](https://www.fastly.com/documentation/solutions/tutorials/ai-runtime-control/track-per-engineer-ai-usage/) as a stand-in for a larger team. You'll set two budget limits on each engineer's virtual key, one that warns you and one that stops spending. You'll also learn how to add a rate limit to stop a runaway client and watch spending against those limits.

By the end, you'll understand how to give each key a warning threshold and a hard stop, which can keep a surprise bill from arriving at the end of the month.

## Before you begin

This tutorial assumes you've already [tracked per-engineer AI usage](https://www.fastly.com/documentation/solutions/tutorials/ai-runtime-control/track-per-engineer-ai-usage/), so you have a virtual key for each engineer. If you don't, create one key per person before you start. You'll also need the following:

- The [superuser role](https://www.fastly.com/documentation/guides/organizations-and-accounts/account-members-and-permissions/about-user-roles-and-permissions/). Other account roles can't access ARC.
- A monthly budget for the team, and a sense of what each engineer's share of it is.

We'll budget $400 per engineer per month, warn at $300, and cap requests at 500 per minute. Use whatever numbers fit your team.

## Step 1: Set a warning limit on a key

First, add a budget limit that notifies you without interrupting anyone's work. This is the limit that gives you time to react.

1. Go to **Tools** > **AI Runtime Control**.
2. Click the **Virtual keys** tab.
3. Click the three dots <span class="inline-icons"><img src="/img/icons/more.png" alt="More icon" /></span> to the right of the engineer's virtual key and then click **Edit**.
4. Click **Add budget limit** and then:
   - In the **Monthly budget limit (USD)** field, enter `300`.
   - From the **Action** menu, select **Alert**.
   - Click **Add budget limit**.
5. Click **Save**.

When this key's spending reaches $300 in a month, all superusers on your account receive an email and a [notification](https://www.fastly.com/documentation/guides/organizations-and-accounts/account-activity-and-notifications/about-the-notification-center/). Requests keep flowing.

## Step 2: Set a hard stop on the same key

Next, add a second budget limit to the same key that stops spending.

1. Click the three dots <span class="inline-icons"><img src="/img/icons/more.png" alt="More icon" /></span> to the right of the same virtual key and then click **Edit**.
2. Click **Add budget limit** and then:
   - In the **Monthly budget limit (USD)** field, enter `400`.
   - From the **Action** menu, select **Alert & Block**.
   - Click **Add budget limit**.
3. Click **Save**.

The key now has two budget limits. At $300 you're notified, and at $400 the key stops routing requests until the next month.

When a key is blocked, the engineer's AI client displays an error saying the key's limit was exceeded. They'll need to have you raise it or remove it before they can keep working, so set the hard stop at a number you're willing to interrupt someone over.

## Step 3: Add a rate limit

Now, add a rate limit to prevent a client from spending more than an employee's budget.

1. Click the three dots <span class="inline-icons"><img src="/img/icons/more.png" alt="More icon" /></span> to the right of the same virtual key and then click **Edit**.
2. Click **Add rate limit** and then:
   - From the **Limit metric** menu, select **Requests per minute**.
   - In the **Threshold** field, enter `500`.
   - Click **Add rate limit**.
3. Click **Save**.

Pick a threshold above what normal work produces. The point isn't to shape day-to-day use, it's to stop one engineer's session from consuming far more than expected, like an agent spawning subagents across a large codebase, before it runs up a bill.

As with a budget block, an engineer whose requests exceed a rate limit sees an error in their AI client saying the limit was exceeded.

## Step 4: Repeat for each engineer

Repeat the steps for setting a warning limit, a hard stop, and a rate limit on each remaining engineer's virtual key. When you're done, each key has all three.

Because limits are set per key, you can give different engineers different budgets. Someone running large evaluation jobs might need a higher cap than someone doing occasional refactoring.

## Step 5: Watch spending against your limits

Now that limits are in place, you can monitor spending.

1. Click the **Summary** tab.
2. Set the date range to **Month-to-date**.
3. Review the **Spend** metric for total team spending, and the **Spend** chart for how it's accumulating over the month.
4. In the **Key usage** table, review **MTD spend** for each key.

The Key usage table is the one to watch. It shows each engineer's month-to-date spending next to the limits you set, so you can see who's approaching a cap before the alert arrives.

## What's next

You've capped a team's AI spending with a warning limit, a hard stop, and a rate limit on each virtual key. From here, you can:

- apply the same pattern to the virtual keys your applications use.
- set a token-based rate limit instead of a request-based one, for work where a few requests can consume a great deal.
- [set up failover providers](https://www.fastly.com/documentation/solutions/tutorials/ai-runtime-control/set-up-failover-ai-providers/) for those same virtual keys.
