Skip to content

bmel:estimateCost

Category: LLM & AI Observability · Returns: bmel:number

bmel:estimateCost(tokens: bmel:integer, model: bmel:string)

Description

Returns the estimated cost in USD for a given number of tokens and a named model. Model identifiers follow the pattern used in the BizMetry agent catalog (e.g. 'gpt-4o', 'claude-3-5-sonnet', 'gemini-1.5-pro'). Pricing tables are maintained server-side and updated on model releases.

Arguments

Parameter Type Required Description
tokens bmel:integer Total token count (input + output combined, or split into separate calls for asymmetric pricing).
model bmel:string Model identifier string (e.g. 'gpt-4o', 'claude-3-5-sonnet', 'gemini-1.5-pro').

Example

bmel:estimateCost({getCompletion:Response Payload}.$.usage.total_tokens, 'gpt-4o')

Back to BMEL Reference