MCPcopy Create free account
hub / github.com/arctic-cli/interface / formatCost

Function formatCost

packages/arctic/src/provider/pricing.ts:393–399  ·  view source on GitHub ↗
(cost: number)

Source from the content-addressed store, hash-verified

391 * Format cost as currency string
392 */
393 export function formatCost(cost: number): string {
394 if (cost === 0) return "$0.00"
395 if (cost < 0.0001) return `$${cost.toExponential(2)}`
396 if (cost < 0.01) return `$${cost.toFixed(4)}`
397 if (cost < 1) return `$${cost.toFixed(3)}`
398 return `$${cost.toFixed(2)}`
399 }
400
401 /**
402 * Get all available models

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected