Skip to main content

QuotaLimits

@forge/monorepo


@forge/monorepo / backend/src / QuotaLimits

Type Alias: QuotaLimits

QuotaLimits = object

Defined in: backend/src/usage/quota.ts:142

Properties

costMinorUnits?

readonly optional costMinorUnits?: number

Defined in: backend/src/usage/quota.ts:168


inputTokens?

readonly optional inputTokens?: number

Defined in: backend/src/usage/quota.ts:169


modelId?

readonly optional modelId?: string

Defined in: backend/src/usage/quota.ts:167

The model this allowance covers, or absent for any model — #182.

Load-bearing in the same way principalId is: it decides which records the usage is read from. A limit on an expensive model checked against all traffic is not a per-model limit — a busy hour on a cheap model exhausts it, and the person refused has not touched the model they are being refused for.


outputTokens?

readonly optional outputTokens?: number

Defined in: backend/src/usage/quota.ts:170


principalId?

readonly optional principalId?: PrincipalId

Defined in: backend/src/usage/quota.ts:159

Whose allowance this is — absent means the whole tenant's (#175).

Load-bearing, not informational: it decides which rollup the usage is read from. A per-person limit checked against the tenant's total is not a per-person limit — the first busy colleague exhausts everyone's allowance, and the person refused has spent nothing. That was the shape of the bug before this existed: the guard already accepted per-principal limits through resolveLimits, and always compared them against tenant-wide usage.


warnAt?

readonly optional warnAt?: number

Defined in: backend/src/usage/quota.ts:177

Fraction of a limit at which a warning fires. Defaults to 0.8.

A fraction rather than an absolute, so it scales with the limit instead of being meaningless on a large plan and constantly tripping on a small one.


window

readonly window: QuotaWindow

Defined in: backend/src/usage/quota.ts:149

The span this allowance covers.

Was period: RollupPeriod until #181. Widened rather than supplemented, so there is exactly one place a window is described and no combination of fields that means two things at once.