(toolResults?: Record<string, unknown>[])
| 800 | * Tool results may carry a `cost` object injected by `applyHostedKeyCostToResult`. |
| 801 | */ |
| 802 | export 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 | |
| 812 | export function getModelPricing(modelId: string): any { |
| 813 | const embeddingPricing = getEmbeddingModelPricing(modelId) |
no outgoing calls
no test coverage detected