@@ -146,18 +146,32 @@ export function parseGenericCliVersion(output: string): string | null {
146146/**
147147 * Append the user's custom models after the built-ins. A custom entry that
148148 * declares its own capabilities keeps them; a bare slug gets the driver's
149- * default set. Slugs that collide with a built-in are dropped.
149+ * default set. A named entry whose slug matches a built-in renames that
150+ * built-in instead (for example `{ "slug": "gpt-5.5", "name": "GPT" }` in
151+ * `settings.json`); other fields on such an entry are ignored.
150152 */
151153export function providerModelsFromSettings (
152154 builtInModels : ReadonlyArray < ServerProviderModel > ,
153155 customModels : ReadonlyArray < CustomModelSetting > ,
154- customModelCapabilities : ModelCapabilities ,
156+ customModelCapabilities : ModelCapabilities | null ,
155157) : ReadonlyArray < ServerProviderModel > {
156- const resolvedBuiltInModels = [ ...builtInModels ] ;
158+ const entries = readCustomModelEntries ( customModels ) ;
159+ if ( entries . length === 0 ) return builtInModels ;
160+
161+ const nameOverrides = new Map (
162+ entries . filter ( ( entry ) => entry . name !== entry . slug ) . map ( ( entry ) => [ entry . slug , entry . name ] ) ,
163+ ) ;
164+ const resolvedBuiltInModels = builtInModels . map ( ( model ) => {
165+ const name = nameOverrides . get ( model . slug ) ;
166+ if ( ! name ) return model ;
167+ // The built-in short name would undo the override in compact UI.
168+ const { shortName : _shortName , ...rest } = model ;
169+ return { ...rest , name } ;
170+ } ) ;
157171 const seen = new Set ( resolvedBuiltInModels . map ( ( model ) => model . slug ) ) ;
158172 const customEntries : ServerProviderModel [ ] = [ ] ;
159173
160- for ( const entry of readCustomModelEntries ( customModels ) ) {
174+ for ( const entry of entries ) {
161175 if ( seen . has ( entry . slug ) ) {
162176 continue ;
163177 }
0 commit comments