MCPcopy Index your code
hub / github.com/simstudioai/sim / sumToolCosts

Function sumToolCosts

apps/sim/providers/utils.ts:802–810  ·  view source on GitHub ↗
(toolResults?: Record<string, unknown>[])

Source from the content-addressed store, hash-verified

800 * Tool results may carry a `cost` object injected by `applyHostedKeyCostToResult`.
801 */
802export function sumToolCosts(toolResults?: Record<string, unknown>[]): number {
803 if (!toolResults?.length) return 0
804 let total = 0
805 for (const tr of toolResults) {
806 const cost = tr?.cost as Record<string, unknown> | undefined
807 if (cost?.total && typeof cost.total === 'number') total += cost.total
808 }
809 return total
810}
811
812export function getModelPricing(modelId: string): any {
813 const embeddingPricing = getEmbeddingModelPricing(modelId)

Callers 15

executeProviderRequestFunction · 0.90
executeGeminiRequestFunction · 0.90
index.tsFile · 0.90
index.tsFile · 0.90
index.tsFile · 0.90
index.tsFile · 0.90
index.tsFile · 0.90
index.tsFile · 0.90
index.tsFile · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected