agentskit.js

computeCost

Auto-generated API reference for computeCost.

Function: computeCost()

computeCost(usage, price): number

Defined in: observability/src/cost-guard.ts:111

Compute dollar cost from a usage record plus a price record. Hostile token counts are normalized to zero so NaN never poisons totals.

#Parameters

#usage

#completionTokens

number

#promptTokens

number

#price

TokenPrice

#Returns

number

Explore nearby

✎ Edit this page on GitHubΒ·Found a problem? Open an issue β†’Β·How to contribute β†’

On this page

Ask the docs
Ask anything about AgentsKit. Answers come from the docs corpus and cite their sources.