# Budgets

Set shared token limits for your own models and check how many tokens you’ve used.



A budget limits how many tokens people can send to and receive from the models you connect to Teleport Beams. Everyone using the same named connection shares its budget, even if they use different models. Teleport counts input and output tokens separately; it does not set or report budgets by model, user, or role. These limits can be exceeded in some cases and do not cap what your provider charges.

**Install the client tools and sign in**

Beams is a [Teleport](https://goteleport.com) project and uses [official Teleport client tools](https://goteleport.com/download/client-tools/).

The client tools include `tsh` to sign in and run commands, and `tctl` to administer your cluster if you have permission.



Cluster: `example.beams.run`. Edit this example to use your cluster name.

Install version **18.11.10** of the client:

**macOS**

Download and open the macOS installer, then follow its instructions.

```sh
curl -O https://cdn.teleport.dev/teleport-tools-18.11.10.pkg
open teleport-tools-18.11.10.pkg
```

**Linux**

For Linux x86-64, download and install the client tools:

```sh
curl -O https://cdn.teleport.dev/teleport-v18.11.10-linux-amd64-bin.tar.gz
tar -xzf teleport-v18.11.10-linux-amd64-bin.tar.gz
sudo ./teleport/install
```

**Windows**

For Windows x86-64, run these commands in PowerShell. Add the extraction directory (`$env:LOCALAPPDATA\Teleport`) to your user PATH to use `tsh` in future terminals; the last command adds it to this terminal's PATH.

```powershell
Invoke-WebRequest -Uri https://cdn.teleport.dev/teleport-v18.11.10-windows-amd64-bin.zip -OutFile teleport.zip
Expand-Archive -Path teleport.zip -DestinationPath "$env:LOCALAPPDATA\Teleport" -Force
$env:Path += ";$env:LOCALAPPDATA\Teleport"
```

Follow the official client [tools install guide](https://goteleport.com/download/client-tools/) for other versions and architectures.

Check that you’re running v18.11.10 of the client with `tsh version`.

```sh
tsh version
```

**Passwordless**

I sign in without a password (e.g. a passkey).

```sh
tsh login --proxy='example.beams.run' --auth=passwordless
```

**Password \& MFA**

I have a password & MFA set up for my account:

Replace `you@example.com` with your Teleport username.

```sh
tsh login --proxy='example.beams.run' --user=you@example.com
```

**SSO**

I sign in with SSO (e.g. Okta, GitHub, SAML).

```sh
tsh login --proxy='example.beams.run'
```

You’ll need `jq` to read the configured limits. To change limits or see everyone’s usage, sign in as a Teleport Cloud tenant administrator with permission to manage your inference connections and view usage. App session recording must be enabled on your cluster to track token usage.

## Check configured limits and usage

See the token limits for the model connections you can use:

**Local terminal**

```sh
tsh apps ls --format=json | jq '.[] | select(.sub_kind == "llm") | {endpoint: .metadata.name, quota: .spec.inference.quota}'
```

The built-in `anthropic` and `openai` connections each have their own daily quota, for example **35 million input tokens** and **5 million output tokens**, reset at **00:00 UTC**. Limits can differ between clusters, so check yours. [Built-in inference](/docs/llm/built-in/) is for evaluation only.

Administrators can see usage for all connections or use `--endpoint` to select one by name. The CLI also supports `--format=json` and `--format=yaml`:

**Administrator terminal**

```sh
tctl llm usage
tctl llm usage --endpoint=openai --format=json
```

The text output shows the connection name under **Endpoint**, along with the budget period, input and output usage, and next reset in UTC. The usage counts are **tokens consumed**, not tokens remaining. Compare them with the configured limits above. Reports are batched, so recent requests may not be reflected immediately.

## Set limits for your own models

You can set budgets for models you connect through Amazon Bedrock. You can’t change the limits on the built-in `openai` and `anthropic` connections from your Cloud tenant.

This example uses an AWS integration that already has permission to invoke a model through Bedrock Mantle. If you haven’t connected your AWS account or granted Bedrock permissions yet, complete the AWS setup in [Bring Your Own Inference](/docs/llm/byoi/) first. You don’t need to create the model connection there; the steps below do that.

### 1. Set daily and monthly limits

For a new connection, save the example below as `llm-proxy.yaml`. Replace `teleport.example.com` with your tenant’s hostname, `my-integration` with the name of your AWS integration, and `REPLACE_WITH_UUID` with a new UUID (for example, from `uuidgen`). If you use a different model, set `provider_name` to its Bedrock model ID and `name` to the name clients will send. Choose a region where that model is available.

If you already have a connection, edit its original YAML file instead. Copy only the `quota:` block into its `inference:` block, aligned with `format:` and `provider:`. Replace an existing `quota:` block rather than adding a second one. Keep the original names, `host_id`, and model settings.

```yaml
kind: app_server
version: v3
metadata:
  name: beams-anthropic
spec:
  host_id: REPLACE_WITH_UUID
  app:
    kind: app
    sub_kind: llm
    version: v3
    metadata:
      name: beams-anthropic
      labels:
        teleport.internal/beams/app-type: llm
    spec:
      public_addr: beams-anthropic.teleport.example.com
      integration: my-integration
      aws:
        region: us-east-1
      inference:
        format: anthropic
        provider: bedrock
        models:
          - name: claude-opus-4-8
            provider_name: anthropic.claude-opus-4-8
        quota:
          requests:
            default_max_tokens: 8192
          intervals:
            - interval: daily
              input_tokens: 5000000
              output_tokens: 1000000
            - interval: monthly
              input_tokens: 100000000
              output_tokens: 20000000
```

This example allows up to 5 million input tokens and 1 million output tokens per day, with higher limits for the full month. `default_max_tokens` sets the maximum reply size for requests that don’t specify one; it is not a daily allowance.

### 2. Apply and check the limits

If this is a new connection, apply the full file:

**Administrator terminal**

```sh
tctl create llm-proxy.yaml
```

If you’re updating an existing connection instead, apply the **full** edited file with `--force`. Use your original filename if it differs:

**Administrator terminal**

```sh
tctl create --force llm-proxy.yaml
```

Check that the new limits appear. Replace `beams-anthropic` with the name from your file if you chose a different one:

**Administrator terminal**

```sh
tsh apps ls --format=json | jq -e '.[] | select(.metadata.name == "beams-anthropic") | .spec.inference.quota'
```

If nothing appears, check that you’re signed in to the right cluster, that the name matches, and that your role can use the connection.

### 3. Send a request and check usage

Start a local proxy for the connection and leave it running:

**Local terminal: keep the proxy running**

```sh
tsh proxy app --port 56789 beams-anthropic
```

In a second terminal, send a request. If you changed the model name in the YAML, use that name in the request:

**Second local terminal**

```sh
curl --fail-with-body --silent --show-error \
  http://localhost:56789/v1/messages \
  -H 'Content-Type: application/json' \
  -H 'anthropic-version: 2023-06-01' \
  -d '{"model":"claude-opus-4-8","max_tokens":128,"messages":[{"role":"user","content":"Say hello in one sentence."}]}'
```

Once you get a reply, check recorded usage. If the request isn’t reflected yet, wait a few minutes and run the command again:

**Administrator terminal**

```sh
tctl llm usage --endpoint=beams-anthropic
```

### Use the connection in new beams

If you created a new connection and want new beams to use it for Anthropic requests, run `tctl edit beams_config` and set `spec.llm.anthropic.app_name` to `beams-anthropic` (or your chosen name). Leave the other settings unchanged. Existing beams keep the connection they were created with. If you updated the budget on the connection beams already use, no routing change is needed.

## How limits reset

Each interval needs an input limit, an output limit, or both. If you configure both a shorter and a longer interval for the same token type, the shorter interval must have a strictly lower limit. Requests count toward both the daily and monthly limits when both are configured. Daily windows reset each day, weekly on Sunday, monthly on the first of the month, and lifetime windows do not reset automatically. Check `tctl llm usage` for the reset timestamp rather than assuming a reset time.

Changing a token limit preserves recorded usage. Changing the reset schedule starts new accounting for the affected window; don't use a schedule change as a manual reset. There is no built-in manual reset command.

## Troubleshoot rejected requests

- **Quota exceeded:** Check usage and the next reset, or ask your Teleport administrator. Teleport reserves the request's maximum output tokens before forwarding it and accounts for actual output afterward. A request can be rejected even when some output quota remains if its requested maximum does not fit. Try a smaller output maximum if appropriate. For clients that omit it, `requests.default_max_tokens` sets the default.
- **Input limit reached:** Teleport does not estimate or reserve input tokens. It rejects new requests once recorded input usage reaches the limit. An in-flight request can take usage past the configured limit.
- **Temporary overload:** If the gateway returns a retry-later error, honor the `Retry-After` header. That is different from exceeding a token quota.

Quotas are soft: concurrent requests and delays in sharing usage totals across the gateway can let consumption exceed the configured limit. Do not rely on token quotas as a hard ceiling on provider charges.
