MCPcopy Create free account
hub / github.com/AnukarOP/claude-code-leaked / getModelCosts

Function getModelCosts

source code/utils/modelCost.ts:146–166  ·  view source on GitHub ↗
(model: string, usage: Usage)

Source from the content-addressed store, hash-verified

144}
145
146export function getModelCosts(model: string, usage: Usage): ModelCosts {
147 const shortName = getCanonicalName(model)
148
149 // Check if this is an Opus 4.6 model with fast mode active.
150 if (
151 shortName === firstPartyNameToCanonical(CLAUDE_OPUS_4_6_CONFIG.firstParty)
152 ) {
153 const isFastMode = usage.speed === 'fast'
154 return getOpus46CostTier(isFastMode)
155 }
156
157 const costs = MODEL_COSTS[shortName]
158 if (!costs) {
159 trackUnknownModelCost(model, shortName)
160 return (
161 MODEL_COSTS[getCanonicalName(getDefaultMainLoopModelSetting())] ??
162 DEFAULT_UNKNOWN_MODEL_COST
163 )
164 }
165 return costs
166}
167
168function trackUnknownModelCost(model: string, shortName: ModelShortName): void {
169 logEvent('tengu_unknown_model_cost', {

Callers 1

calculateUSDCostFunction · 0.85

Calls 5

getCanonicalNameFunction · 0.85
getOpus46CostTierFunction · 0.85
trackUnknownModelCostFunction · 0.85

Tested by

no test coverage detected