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