(model: string, usage: Usage)
| 144 | } |
| 145 | |
| 146 | export 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 | |
| 168 | function trackUnknownModelCost(model: string, shortName: ModelShortName): void { |
| 169 | logEvent('tengu_unknown_model_cost', { |
no test coverage detected