Skip to content

Spend Limits

A spend limit is a monthly dollar ceiling on a team or an API key in one environment. Requests count against it as they are charged, and once it is spent the next request is refused before any model is called. Limits are set per environment, so a team’s Test and Live limits are separate.

The month is the calendar month in UTC. A limit starts again at 00:00 UTC on the first of the next month; the limit’s resets_at says when.

Two figures count against a limit and are shown apart:

  • Real spend: what was charged, in credits or USDC, for replies from Katara’s own models, Katara Community and the platform meters.
  • Shadow spend: the organization’s own price for replies its Plexus served, from its rate card. It is recorded and never charged. With no rate card it is zero.

A limit is spent when the two together reach it. Neither figure is ever debited by the limit itself; it only decides whether the next request may start.

A key’s requests count against the key’s own limit and against the limit of every team its person belongs to. A service account’s key counts against its own limit only. An agent run counts against the key that started it, if any, and against the teams of the person who started it.

Open Administration → Spend Limits in the portal. Limits this month lists every limit in the environment with what each has used. To add or change a team’s, choose the team and fill in Monthly limit (USD) and, if you want a warning, Alert at (percent), then Save Limit. Remove Limit takes it away.

A key’s limit is set on the key: the Monthly limit (USD) field when you create it, or the Monthly limit section on its page later. If the key is made but its limit could not be saved, the portal says so; set it again from the key’s page.

Owners and administrators can set any team’s or key’s limit. A person may set or lower the limit on their own key. Limits are set by a person signed in; an API key, service account or workload cannot set one.

Each limit reports state:

StateMeaning
okUnder the alert threshold, or no threshold is set
alertReal and shadow spend together have reached alert_percent of the limit
spentThey have reached the limit; new requests are refused until it resets or is raised
noneThe write took the limit away

A chat or API request is refused with 402 and "code": "insufficient_quota", and the header x-should-retry: false, so a client that retries on its own stops. The message names the key or team whose limit is reached, what was spent and what was served by your own endpoint, and when it starts again. Nothing is sent to a model or charged.

An agent run whose next step would pass a spent limit ends with reason budget_exhausted. Shadow spend also draws down agent and project budgets, though nothing is debited from them for it: a run on a budget whose remaining amount your own endpoint’s shadow cost has used up stops the same way.

The routes are GET and PUT /katara/v1/orgs/{org_id}/environments/{environment_id}/spend-limits. In TypeScript use client.spendLimits.list and client.spendLimits.put; in Python client.spend_limits.list and client.spend_limits.put.

A write names kind (team or key), subject_id, monthly_limit as a dollar string such as "250.00" (or null to remove it), an optional alert_percent from 1 to 100, and expected_version: 0 for a new limit, otherwise the version you read. A stale version is refused with a conflict, so two people changing one limit cannot overwrite each other. Amounts come back as dollar strings with nine decimal places, in monthly_limit, real_spend and shadow_spend, beside period_start and resets_at. An environment holds up to 5,000 limits.