MCPcopy
hub / github.com/codeaashu/claude-code / calculateUSDCost

Function calculateUSDCost

src/utils/modelCost.ts:177–180  ·  view source on GitHub ↗
(resolvedModel: string, usage: Usage)

Source from the content-addressed store, hash-verified

175// Calculate the cost of a query in US dollars.
176// If the model's costs are not found, use the default model's costs.
177export function calculateUSDCost(resolvedModel: string, usage: Usage): number {
178 const modelCosts = getModelCosts(resolvedModel, usage)
179 return tokensToUSDCost(modelCosts, usage)
180}
181
182/**
183 * Calculate cost from raw token counts without requiring a full BetaUsage object.

Callers 4

addToTotalSessionCostFunction · 0.85
calculateCostFromTokensFunction · 0.85
queryModelFunction · 0.85

Calls 2

getModelCostsFunction · 0.85
tokensToUSDCostFunction · 0.85

Tested by

no test coverage detected