(model: string, usage: Usage)
| 190 | } |
| 191 | |
| 192 | export 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 | |
| 214 | function trackUnknownModelCost(model: string, shortName: ModelShortName): void { |
| 215 | logEvent('ncode_unknown_model_cost', { |
no test coverage detected