Skip to main content

computeModelCostMinorUnits

@forge/monorepo


@forge/monorepo / backend/src / computeModelCostMinorUnits

Function: computeModelCostMinorUnits()

computeModelCostMinorUnits(pricing, usage): number

Defined in: backend/src/models/pricing.ts:18

Cost of a unit of usage, in the pricing currency's minor units. Prices are per-million tokens. Cached input is billed at the cache-read rate when present. This is what feeds usage accounting.

Parameters

pricing

ModelPricing

usage

audioSeconds?

number

cachedInputTokens?

number

cacheWriteTokens?

number

Tokens written into the cache — a subset of inputTokens, priced separately. See below.

imageCount?

number

Images sent with the turn — counted from the parts, not from the provider. See NeutralUsage.

inputTokens

number

outputTokens

number

Returns

number