Skip to main content

UsageUpdatedEvent

@forge/monorepo


@forge/monorepo / backend/src / UsageUpdatedEvent

Type Alias: UsageUpdatedEvent

UsageUpdatedEvent = EventBase<"usage.updated"> & object

Defined in: backend/src/core/events.ts:127

Type Declaration

audioSeconds?

readonly optional audioSeconds?: number

cachedInputTokens?

readonly optional cachedInputTokens?: number

cacheWriteTokens?

readonly optional cacheWriteTokens?: number

Tokens written into a prompt cache — task #247. Absent means the provider reported no breakdown.

costMinorUnits?

readonly optional costMinorUnits?: number

currency?

readonly optional currency?: string

imageCount?

readonly optional imageCount?: number

Non-text input this step carried — #185 AC-4.

On the event, not only in the cost, so the ledger can say why a step cost what it did. A multimodal turn and a text turn that happened to price the same are otherwise indistinguishable after the fact, which makes a pricing mistake invisible.

inputTokens

readonly inputTokens: number

modelId?

readonly optional modelId?: string

When present, the worker records a durable UsageEvent for this realized step.

outputTokens

readonly outputTokens: number

reasoningTokens?

readonly optional reasoningTokens?: number

stepId?

readonly optional stepId?: string

Stable per-step id so recording is idempotent across a recovery.