Skip to content

Commit 6b51449

Browse files
fix: prevent model selector label degradation after first conversation
After the first conversation, captureCapabilities() caches the SDK's supportedModels() which have different displayNames ("Sonnet", "Opus 4") than our catalog ("Sonnet 4.6", "Opus 4.6"). The /api/providers/models route was using m.displayName directly from the SDK cache, overriding the correct labels. Fix: prefer CLAUDE_MODELS[alias].displayName when available, fall back to SDK's displayName for unknown/future models. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent fa91329 commit 6b51449

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

src/app/api/providers/models/route.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { NextResponse } from 'next/server';
22
import { getAllProviders, getDefaultProviderId, setDefaultProviderId, getProvider, getModelsForProvider, getSetting } from '@/lib/db';
33
import { getContextWindow } from '@/lib/model-context';
4+
import { CLAUDE_MODELS } from '@/lib/model-ids';
45
import { getDefaultModelsForProvider, inferProtocolFromLegacy, findPresetForLegacy } from '@/lib/provider-catalog';
56
import type { Protocol } from '@/lib/provider-catalog';
67
import type { ErrorResponse, ProviderModelGroup } from '@/types';
@@ -73,7 +74,7 @@ export async function GET() {
7374
const cw = getContextWindow(m.value);
7475
return {
7576
value: m.value,
76-
label: m.displayName,
77+
label: CLAUDE_MODELS[m.value as keyof typeof CLAUDE_MODELS]?.displayName ?? m.displayName,
7778
description: m.description,
7879
supportsEffort: m.supportsEffort,
7980
supportedEffortLevels: m.supportedEffortLevels,

0 commit comments

Comments
 (0)