CostGuardOptions
Auto-generated API reference for CostGuardOptions.
Interface: CostGuardOptions
Defined in: cost-guard.ts:45
#Properties
#budgetUsd
budgetUsd:
number
Defined in: cost-guard.ts:47
Hard budget in USD. Aborts the run when exceeded.
#controller
controller:
AbortController
Defined in: cost-guard.ts:52
AbortController to signal the runtime to stop. The runtime picks this up via RunOptions.signal (RT13).
#modelOverride?
optionalmodelOverride?:string
Defined in: cost-guard.ts:72
Force a specific model id if the runtime doesn't emit one.
#name?
optionalname?:string
Defined in: cost-guard.ts:74
Observer name for tracing.
#onCost?
optionalonCost?: (info) =>void
Defined in: cost-guard.ts:60
Called whenever the running total changes. Useful for progress UI.
#Parameters
info
budgetRemainingUsd
number
completionTokens
number
costUsd
number
promptTokens
number
#Returns
void
#onExceeded?
optionalonExceeded?: (info) =>void
Defined in: cost-guard.ts:70
Called when the budget is exceeded (just before abort). By default also logs a warning to stderr.
#Parameters
info
budgetUsd
number
costUsd
number
#Returns
void
#prices?
optionalprices?:Record<string,TokenPrice>
Defined in: cost-guard.ts:56
Optional price table override. Partial — merged over DEFAULT_PRICES.