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

Function computePiCost

apps/sim/executor/handlers/pi/keys.ts:81–92  ·  view source on GitHub ↗
(
  model: string,
  inputTokens: number,
  outputTokens: number,
  isBYOK: boolean
)

Source from the content-addressed store, hash-verified

79
80/** Run cost, zeroed for BYOK keys and models Sim does not bill. */
81export function computePiCost(
82 model: string,
83 inputTokens: number,
84 outputTokens: number,
85 isBYOK: boolean
86) {
87 if (isBYOK || !shouldBillModelUsage(model)) {
88 return { input: 0, output: 0, total: 0 }
89 }
90 const multiplier = getCostMultiplier()
91 return calculateCost(model, inputTokens, outputTokens, false, multiplier, multiplier)
92}
93
94/**
95 * Env var the Pi CLI reads each provider's key from in the cloud sandbox. Keyed

Callers 2

keys.test.tsFile · 0.90
buildOutputMethod · 0.90

Calls 3

shouldBillModelUsageFunction · 0.90
getCostMultiplierFunction · 0.90
calculateCostFunction · 0.90

Tested by

no test coverage detected