Skip to main content

QuotaObserver

@forge/monorepo


@forge/monorepo / backend/src / QuotaObserver

Interface: QuotaObserver

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

Told when a tenant crosses a warning threshold.

A sink of its own rather than a RunEvent, because a RunEvent carries a runId and a quota warning fires before a run exists — which is the whole point of warning at admission. Squeezing it into the run stream would mean inventing a run id for an event about not starting one.

Methods

onRefusal()?

optional onRefusal(context, refusal): void | Promise<void>

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

Parameters

context

ExecutionContext

refusal
admitted

false

dimension

"cost" | "input-tokens" | "output-tokens"

limit

number

message

string

modelId?

string

Present when the limit that refused is scoped to one model — #182.

retryAfter

string

used

number

Returns

void | Promise<void>


onWarning()

onWarning(context, warning): void | Promise<void>

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

Parameters

context

ExecutionContext

warning

QuotaWarning

Returns

void | Promise<void>