MCPcopy Index your code
hub / github.com/Noumena-Network/code / getModelCosts

Function getModelCosts

src/utils/modelCost.ts:192–212  ·  view source on GitHub ↗
(model: string, usage: Usage)

Source from the content-addressed store, hash-verified

190}
191
192export function getModelCosts(model: string, usage: Usage): ModelCosts {
193 const shortName = getCanonicalName(model)
194
195 // Check if this is an Opus 4.6 model with fast mode active.
196 if (
197 shortName === firstPartyNameToCanonical(CLAUDE_OPUS_4_6_CONFIG.firstParty)
198 ) {
199 const isFastMode = usage.speed === 'fast'
200 return getOpus46CostTier(isFastMode)
201 }
202
203 const costs = MODEL_COSTS[shortName]
204 if (!costs) {
205 trackUnknownModelCost(model, shortName)
206 return (
207 MODEL_COSTS[getCanonicalName(getDefaultMainLoopModelSetting())] ??
208 DEFAULT_UNKNOWN_MODEL_COST
209 )
210 }
211 return costs
212}
213
214function trackUnknownModelCost(model: string, shortName: ModelShortName): void {
215 logEvent('ncode_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