MCPcopy Index your code
hub / github.com/CodebuffAI/codebuff / creditsToFakeCost

Function creditsToFakeCost

web/src/llm-api/openai.ts:172–174  ·  view source on GitHub ↗

* Convert credits (integer cents) back to a cost value that will result in the same * credits when the SDK applies its formula: credits = Math.round(cost * (1 + PROFIT_MARGIN) * 100)

(credits: number)

Source from the content-addressed store, hash-verified

170 * credits when the SDK applies its formula: credits = Math.round(cost * (1 + PROFIT_MARGIN) * 100)
171 */
172function creditsToFakeCost(credits: number): number {
173 return credits / ((1 + PROFIT_MARGIN) * 100)
174}
175
176/**
177 * Overwrite the cost field in an SSE line to reflect actual billed credits.

Callers 2

overwriteCostInLineFunction · 0.70
handleOpenAINonStreamFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected