Smarter Budget

Overview

A Smarter Budget is a set of spending limits, in USD or in tokens, per hour, day, week or month, and in total. It is enforced on each of the resources that it is attached to: a user, an Account, an LLMClient, a Provider, a Proxy, an LLMHost compute, a Plugin, a Connection, an MCPClient, and more.

When a resource’s spending reaches a limit, Smarter refuses further requests that would be charged to it, until the billing period renews or the budget is raised. An LLMClient’s chat answers with the budget’s message instead of calling the LLM, and the Proxy and APIs answer 402 Payment Required. A budget can optionally also only warn, sending a signal instead of refusing.

Budgets are managed by superusers, with Budget manifests. spec.resources lists the resources that the budget is enforced on, by kind and name:

Example Budget Manifest
apiVersion: smarter.sh/v1
kind: Budget
metadata:
  name: student_monthly_allowance
  description: |
    An example Budget manifest: a per-user allowance. Each student may spend $10 a month on AI,
    and $100 in total. When a student reaches a limit, their chat is answered with the message
    below until the limit renews, or the budget is raised.
  version: 1.0.0
  tags:
    - example
    - education
    - user
  annotations:
    - smarter.sh/budget/purpose: per-user allowance
spec:
  config:
    unit: cost
    period: month
    periodicLimit: 10.00
    absoluteLimit: 100.00
    duration: 0
    action: block
    warningThreshold: 80
    message: You have used this month's AI allowance. It renews on the 1st of next month.
  resources:
    - kind: User
      name: student1
    - kind: User
      name: student2

The web console’s Budgets page, and the dashboard’s Budget vs Actual chart, show each resource’s spending against its budget.

Note

Budgets are included in v0.16.0 and later. manage.py initialize_platform creates a catalogue of built-in budgets, detached, which superusers can attach to resources.

See also

Technical Reference