Skip to content

Commit ff91c10

Browse files
rajbosCopilot
andauthored
fix: always show friendly model names in all display locations (#828)
- Refactor getModelDisplayName() in modelUtils.ts to derive display names from modelPricing.json instead of a separate hardcoded table. This means the nightly JSON refresh automatically keeps display names in sync — no more models appearing as lowercase IDs. - Add displayNames to all models in modelPricing.json that were missing them: claude-opus-4.5/4.6, claude-haiku/4.5, claude-opus-4.1, claude-sonnet-4.5, claude-opus-4.6-fast variants, gpt-5.1/5.2/5.3 series, gpt-5-mini, gpt-4.1-mini/nano, gemini 2.x/3-flash, grok-code-fast-1, raptor-mini, and others. - Fix logviewer turn model badge (renderTurnModelBadge) to call getModelDisplayName() so claude-sonnet-4.6 and similar show as 'Claude Sonnet 4.6' instead of the raw ID. - Fix sub-agent model badge in logviewer to also use getModelDisplayName(). Fixes: claude-opus-4.7 and gpt-5.4 appearing in lowercase on the details panel, chart per-model view, and file viewer. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent c98fde5 commit ff91c10

3 files changed

Lines changed: 113 additions & 51 deletions

File tree

vscode-extension/src/modelPricing.json

Lines changed: 95 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,20 @@
7474
"outputCostPerMillion": 10.0,
7575
"category": "GPT-5 models",
7676
"tier": "premium",
77-
"multiplier": 1
77+
"multiplier": 1,
78+
"displayNames": [
79+
"GPT-5 Codex (Preview)"
80+
]
7881
},
7982
"gpt-5-mini": {
8083
"inputCostPerMillion": 0.25,
8184
"outputCostPerMillion": 2.0,
8285
"category": "GPT-5 models",
8386
"tier": "standard",
8487
"multiplier": 0,
88+
"displayNames": [
89+
"GPT-5 Mini"
90+
],
8591
"copilotPricing": {
8692
"inputCostPerMillion": 0.25,
8793
"cachedInputCostPerMillion": 0.025,
@@ -95,35 +101,50 @@
95101
"outputCostPerMillion": 10.0,
96102
"category": "GPT-5 models",
97103
"tier": "premium",
98-
"multiplier": 1
104+
"multiplier": 1,
105+
"displayNames": [
106+
"GPT-5.1"
107+
]
99108
},
100109
"gpt-5.1-codex": {
101110
"inputCostPerMillion": 1.25,
102111
"outputCostPerMillion": 10.0,
103112
"category": "GPT-5 models",
104113
"tier": "premium",
105-
"multiplier": 1
114+
"multiplier": 1,
115+
"displayNames": [
116+
"GPT-5.1 Codex"
117+
]
106118
},
107119
"gpt-5.1-codex-max": {
108120
"inputCostPerMillion": 1.75,
109121
"outputCostPerMillion": 14.0,
110122
"category": "GPT-5 models",
111123
"tier": "premium",
112-
"multiplier": 1
124+
"multiplier": 1,
125+
"displayNames": [
126+
"GPT-5.1 Codex Max"
127+
]
113128
},
114129
"gpt-5.1-codex-mini": {
115130
"inputCostPerMillion": 0.25,
116131
"outputCostPerMillion": 2.0,
117132
"category": "GPT-5 models",
118133
"tier": "premium",
119-
"multiplier": 0.33
134+
"multiplier": 0.33,
135+
"displayNames": [
136+
"GPT-5.1 Codex Mini (Preview)"
137+
]
120138
},
121139
"gpt-5.2": {
122140
"inputCostPerMillion": 1.75,
123141
"outputCostPerMillion": 14.0,
124142
"category": "GPT-5 models",
125143
"tier": "premium",
126144
"multiplier": 1,
145+
"displayNames": [
146+
"GPT-5.2"
147+
],
127148
"copilotPricing": {
128149
"inputCostPerMillion": 1.75,
129150
"cachedInputCostPerMillion": 0.175,
@@ -138,6 +159,9 @@
138159
"category": "GPT-5 models",
139160
"tier": "premium",
140161
"multiplier": 1,
162+
"displayNames": [
163+
"GPT-5.2 Codex"
164+
],
141165
"copilotPricing": {
142166
"inputCostPerMillion": 1.75,
143167
"cachedInputCostPerMillion": 0.175,
@@ -151,14 +175,20 @@
151175
"outputCostPerMillion": 168.0,
152176
"category": "GPT-5 models",
153177
"tier": "premium",
154-
"multiplier": 1
178+
"multiplier": 1,
179+
"displayNames": [
180+
"GPT-5.2 Pro"
181+
]
155182
},
156183
"gpt-5.3-codex": {
157184
"inputCostPerMillion": 1.75,
158185
"outputCostPerMillion": 14.0,
159186
"category": "GPT-5 models",
160187
"tier": "premium",
161188
"multiplier": 1,
189+
"displayNames": [
190+
"GPT-5.3 Codex"
191+
],
162192
"copilotPricing": {
163193
"inputCostPerMillion": 1.75,
164194
"cachedInputCostPerMillion": 0.175,
@@ -255,15 +285,21 @@
255285
"outputCostPerMillion": 1.6,
256286
"category": "GPT-4 models",
257287
"tier": "standard",
258-
"multiplier": 0
288+
"multiplier": 0,
289+
"displayNames": [
290+
"GPT-4.1 Mini"
291+
]
259292
},
260293
"gpt-4.1-nano": {
261294
"inputCostPerMillion": 0.1,
262295
"cachedInputCostPerMillion": 0.025,
263296
"outputCostPerMillion": 0.4,
264297
"category": "GPT-4 models",
265298
"tier": "standard",
266-
"multiplier": 0
299+
"multiplier": 0,
300+
"displayNames": [
301+
"GPT-4.1 Nano"
302+
]
267303
},
268304
"gpt-4o": {
269305
"inputCostPerMillion": 2.5,
@@ -350,6 +386,9 @@
350386
"category": "Claude models (Anthropic)",
351387
"tier": "premium",
352388
"multiplier": 1,
389+
"displayNames": [
390+
"Claude Sonnet 4.5"
391+
],
353392
"copilotPricing": {
354393
"inputCostPerMillion": 3.0,
355394
"cachedInputCostPerMillion": 0.3,
@@ -386,7 +425,10 @@
386425
"cacheCreationCostPerMillion": 0.3125,
387426
"category": "Claude models (Anthropic)",
388427
"tier": "standard",
389-
"multiplier": 0
428+
"multiplier": 0,
429+
"displayNames": [
430+
"Claude Haiku"
431+
]
390432
},
391433
"claude-haiku-4.5": {
392434
"inputCostPerMillion": 1.0,
@@ -396,6 +438,9 @@
396438
"category": "Claude models (Anthropic)",
397439
"tier": "premium",
398440
"multiplier": 0.33,
441+
"displayNames": [
442+
"Claude Haiku 4.5"
443+
],
399444
"copilotPricing": {
400445
"inputCostPerMillion": 1.0,
401446
"cachedInputCostPerMillion": 0.1,
@@ -412,7 +457,10 @@
412457
"cacheCreationCostPerMillion": 18.75,
413458
"category": "Claude models (Anthropic)",
414459
"tier": "premium",
415-
"multiplier": 10
460+
"multiplier": 10,
461+
"displayNames": [
462+
"Claude Opus 4.1"
463+
]
416464
},
417465
"claude-opus-4.5": {
418466
"inputCostPerMillion": 5.0,
@@ -422,6 +470,9 @@
422470
"category": "Claude models (Anthropic)",
423471
"tier": "premium",
424472
"multiplier": 3,
473+
"displayNames": [
474+
"Claude Opus 4.5"
475+
],
425476
"copilotPricing": {
426477
"inputCostPerMillion": 5.0,
427478
"cachedInputCostPerMillion": 0.5,
@@ -439,6 +490,9 @@
439490
"category": "Claude models (Anthropic)",
440491
"tier": "premium",
441492
"multiplier": 3,
493+
"displayNames": [
494+
"Claude Opus 4.6"
495+
],
442496
"copilotPricing": {
443497
"inputCostPerMillion": 5.0,
444498
"cachedInputCostPerMillion": 0.5,
@@ -476,6 +530,9 @@
476530
"category": "Claude models (Anthropic)",
477531
"tier": "premium",
478532
"multiplier": 30,
533+
"displayNames": [
534+
"Claude Opus 4.6 (Fast Mode Preview)"
535+
],
479536
"copilotPricing": {
480537
"inputCostPerMillion": 30.0,
481538
"cachedInputCostPerMillion": 3.0,
@@ -493,6 +550,9 @@
493550
"category": "Claude models (Anthropic)",
494551
"tier": "premium",
495552
"multiplier": 30,
553+
"displayNames": [
554+
"Claude Opus 4.6 (Fast)"
555+
],
496556
"copilotPricing": {
497557
"inputCostPerMillion": 30.0,
498558
"cachedInputCostPerMillion": 3.0,
@@ -575,35 +635,50 @@
575635
"outputCostPerMillion": 2.5,
576636
"category": "Google Gemini models",
577637
"tier": "unknown",
578-
"multiplier": 1
638+
"multiplier": 1,
639+
"displayNames": [
640+
"Gemini 2.5 Flash"
641+
]
579642
},
580643
"gemini-2.5-flash-lite": {
581644
"inputCostPerMillion": 0.1,
582645
"outputCostPerMillion": 0.4,
583646
"category": "Google Gemini models",
584647
"tier": "unknown",
585-
"multiplier": 1
648+
"multiplier": 1,
649+
"displayNames": [
650+
"Gemini 2.5 Flash Lite"
651+
]
586652
},
587653
"gemini-2.0-flash": {
588654
"inputCostPerMillion": 0.1,
589655
"outputCostPerMillion": 0.4,
590656
"category": "Google Gemini models",
591657
"tier": "standard",
592-
"multiplier": 0
658+
"multiplier": 0,
659+
"displayNames": [
660+
"Gemini 2.0 Flash"
661+
]
593662
},
594663
"gemini-2.0-flash-lite": {
595664
"inputCostPerMillion": 0.075,
596665
"outputCostPerMillion": 0.3,
597666
"category": "Google Gemini models",
598667
"tier": "standard",
599-
"multiplier": 0
668+
"multiplier": 0,
669+
"displayNames": [
670+
"Gemini 2.0 Flash Lite"
671+
]
600672
},
601673
"gemini-3-flash": {
602674
"inputCostPerMillion": 0.5,
603675
"outputCostPerMillion": 3.0,
604676
"category": "Google Gemini models",
605677
"tier": "premium",
606678
"multiplier": 0.33,
679+
"displayNames": [
680+
"Gemini 3 Flash"
681+
],
607682
"copilotPricing": {
608683
"inputCostPerMillion": 0.5,
609684
"cachedInputCostPerMillion": 0.05,
@@ -666,6 +741,9 @@
666741
"category": "xAI Grok models",
667742
"tier": "premium",
668743
"multiplier": 0.25,
744+
"displayNames": [
745+
"Grok Code Fast 1"
746+
],
669747
"copilotPricing": {
670748
"inputCostPerMillion": 0.2,
671749
"cachedInputCostPerMillion": 0.02,
@@ -680,6 +758,9 @@
680758
"category": "GitHub Copilot fine-tuned models",
681759
"tier": "standard",
682760
"multiplier": 0,
761+
"displayNames": [
762+
"Raptor Mini"
763+
],
683764
"copilotPricing": {
684765
"inputCostPerMillion": 0.25,
685766
"cachedInputCostPerMillion": 0.025,

vscode-extension/src/webview/logviewer/main.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Log Viewer webview - displays session file details and chat turns
22
import { ContextReferenceUsage, getTotalContextRefs, getImplicitContextRefs, getExplicitContextRefs, getContextRefsSummary } from '../shared/contextRefUtils';
33
import { formatCompact, setCompactNumbers } from '../shared/formatUtils';
4+
import { getModelDisplayName } from '../shared/modelUtils';
45
// CSS imported as text via esbuild
56
import themeStyles from '../shared/theme.css';
67
import styles from './styles.css';
@@ -298,7 +299,7 @@ function renderTurnModelBadge(model: string): string {
298299
const family = escapeHtml(model);
299300
return `<span class="turn-model" title="JetBrains session logs only record the model family (inferred from the tool call ID prefix). Specific version isn't persisted.">🎯 ${family}</span>`;
300301
}
301-
return `<span class="turn-model">🎯 ${escapeHtml(model)}</span>`;
302+
return `<span class="turn-model">🎯 ${escapeHtml(getModelDisplayName(model))}</span>`;
302303
}
303304

304305
function renderTurnCard(turn: ChatTurn, isJetBrains = false): string {
@@ -490,7 +491,7 @@ function renderTurnCard(turn: ChatTurn, isJetBrains = false): string {
490491
<tr class="tool-row${tc.isSubAgent ? ' sub-agent-row' : ''}" data-tool-name="${tc.isSubAgent ? '__subagent__' : escapeHtml(lookupToolName(tc.toolName))}">
491492
<td class="tool-name-cell">
492493
<span class="tool-name tool-call-link" data-turn="${turn.turnNumber}" data-toolcall="${idx}" title="${escapeHtml(tc.toolName)}" style="cursor:pointer;">${escapeHtml(tc.isSubAgent ? ({'task':'🤖 Sub-Agent','read_agent':'🤖 Sub-Agent (read)','write_agent':'🤖 Sub-Agent (write)','list_agents':'🤖 Sub-Agent (list)'}[tc.toolName] || `🤖 ${tc.toolName}`) : lookupToolName(tc.toolName))}</span>
493-
${tc.isSubAgent && tc.subAgentModel ? `<span class="sub-agent-model-badge">${escapeHtml(tc.subAgentModel)}</span>` : ''}
494+
${tc.isSubAgent && tc.subAgentModel ? `<span class="sub-agent-model-badge">${escapeHtml(getModelDisplayName(tc.subAgentModel))}</span>` : ''}
494495
${tc.isSubAgent && tc.subAgentTokens ? `<span class="sub-agent-tokens">↑${tc.subAgentTokens.input.toLocaleString()}${tc.subAgentTokens.output.toLocaleString()} tokens</span>` : ''}
495496
${tc.arguments && !tc.isSubAgent ? `<details class="tool-details"><summary>Arguments</summary><pre>${escapeHtml(tc.arguments)}</pre></details>` : ''}
496497
${tc.result && !tc.isSubAgent ? `<details class="tool-details"><summary>Result</summary><pre>${escapeHtml(truncateText(tc.result, 500))}</pre></details>` : ''}
Lines changed: 15 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,20 @@
1+
// @ts-ignore — resolved by esbuild at bundle time
2+
import modelPricingJson from '../../modelPricing.json';
3+
4+
type PricingEntry = { displayNames?: string[] };
5+
6+
// Build display name map from pricing JSON (first displayName = canonical friendly name).
7+
// This is the single source of truth so it stays in sync with the nightly JSON refresh.
8+
const _modelNames: Record<string, string> = {};
9+
for (const [modelId, pricing] of Object.entries(modelPricingJson.pricing as Record<string, PricingEntry>)) {
10+
if (pricing.displayNames && pricing.displayNames.length > 0) {
11+
_modelNames[modelId] = pricing.displayNames[0];
12+
}
13+
}
14+
115
/**
216
* Returns a human-friendly display name for a given model identifier.
317
*/
418
export function getModelDisplayName(model: string): string {
5-
const names: Record<string, string> = {
6-
'gpt-4': 'GPT-4',
7-
'gpt-4.1': 'GPT-4.1',
8-
'gpt-4o': 'GPT-4o',
9-
'gpt-4o-mini': 'GPT-4o Mini',
10-
'gpt-3.5-turbo': 'GPT-3.5 Turbo',
11-
'gpt-5': 'GPT-5',
12-
'gpt-5-codex': 'GPT-5 Codex (Preview)',
13-
'gpt-5-mini': 'GPT-5 Mini',
14-
'gpt-5.1': 'GPT-5.1',
15-
'gpt-5.1-codex': 'GPT-5.1 Codex',
16-
'gpt-5.1-codex-max': 'GPT-5.1 Codex Max',
17-
'gpt-5.1-codex-mini': 'GPT-5.1 Codex Mini (Preview)',
18-
'gpt-5.2': 'GPT-5.2',
19-
'gpt-5.2-codex': 'GPT-5.2 Codex',
20-
'claude-sonnet-3.5': 'Claude Sonnet 3.5',
21-
'claude-sonnet-3.7': 'Claude Sonnet 3.7',
22-
'claude-sonnet-4': 'Claude Sonnet 4',
23-
'claude-sonnet-4.5': 'Claude Sonnet 4.5',
24-
'claude-sonnet-4.6': 'Claude Sonnet 4.6',
25-
'claude-haiku': 'Claude Haiku',
26-
'claude-haiku-4.5': 'Claude Haiku 4.5',
27-
'claude-opus-4.1': 'Claude Opus 4.1',
28-
'claude-opus-4.5': 'Claude Opus 4.5',
29-
'claude-opus-4.6': 'Claude Opus 4.6',
30-
'gemini-2.5-pro': 'Gemini 2.5 Pro',
31-
'gemini-3-flash': 'Gemini 3 Flash',
32-
'gemini-3-pro': 'Gemini 3 Pro',
33-
'gemini-3-pro-preview': 'Gemini 3 Pro (Preview)',
34-
'grok-code-fast-1': 'Grok Code Fast 1',
35-
'raptor-mini': 'Raptor Mini',
36-
'o3-mini': 'o3-mini',
37-
'o4-mini': 'o4-mini (Preview)'
38-
};
39-
return names[model] || model;
19+
return _modelNames[model] || model;
4020
}

0 commit comments

Comments
 (0)