@@ -42,6 +42,8 @@ export const MODEL_ALIASES: Record<string, string> = {
4242 // For Antigravity, these are bypassed and full model name is kept
4343 "gemini-3-pro-low" : "gemini-3-pro" ,
4444 "gemini-3-pro-high" : "gemini-3-pro" ,
45+ "gemini-3.1-pro-low" : "gemini-3.1-pro" ,
46+ "gemini-3.1-pro-high" : "gemini-3.1-pro" ,
4547 "gemini-3-flash-low" : "gemini-3-flash" ,
4648 "gemini-3-flash-medium" : "gemini-3-flash" ,
4749 "gemini-3-flash-high" : "gemini-3-flash" ,
@@ -59,6 +61,8 @@ export const MODEL_ALIASES: Record<string, string> = {
5961
6062const TIER_REGEX = / - ( m i n i m a l | l o w | m e d i u m | h i g h ) $ / ;
6163const QUOTA_PREFIX_REGEX = / ^ a n t i g r a v i t y - / i;
64+ const GEMINI_3_PRO_REGEX = / ^ g e m i n i - 3 (?: \. \d + ) ? - p r o / i;
65+ const GEMINI_3_FLASH_REGEX = / ^ g e m i n i - 3 (?: \. \d + ) ? - f l a s h / i;
6266
6367// ANTIGRAVITY_ONLY_MODELS removed - all models now default to antigravity
6468
@@ -125,6 +129,14 @@ function isThinkingCapableModel(model: string): boolean {
125129 ) ;
126130}
127131
132+ function isGemini3ProModel ( model : string ) : boolean {
133+ return GEMINI_3_PRO_REGEX . test ( model ) ;
134+ }
135+
136+ function isGemini3FlashModel ( model : string ) : boolean {
137+ return GEMINI_3_FLASH_REGEX . test ( model ) ;
138+ }
139+
128140/**
129141 * Resolves a model name with optional tier suffix and quota prefix to its actual API model name
130142 * and corresponding thinking configuration.
@@ -167,8 +179,8 @@ export function resolveModelWithTier(requestedModel: string, options: ModelResol
167179 // For Antigravity Gemini 3 Pro models without explicit tier, append default tier (-low)
168180 // Antigravity API: gemini-3-pro requires tier suffix (gemini-3-pro-low/high)
169181 // gemini-3-flash uses bare name + thinkingLevel param
170- const isGemini3Pro = modelWithoutQuota . toLowerCase ( ) . startsWith ( "gemini-3-pro" ) ;
171- const isGemini3Flash = modelWithoutQuota . toLowerCase ( ) . startsWith ( "gemini-3-flash" ) ;
182+ const isGemini3Pro = isGemini3ProModel ( modelWithoutQuota ) ;
183+ const isGemini3Flash = isGemini3FlashModel ( modelWithoutQuota ) ;
172184
173185 let antigravityModel = modelWithoutQuota ;
174186 if ( skipAlias ) {
@@ -308,10 +320,11 @@ export function resolveModelForHeaderStyle(
308320
309321 if ( headerStyle === "antigravity" ) {
310322 let transformedModel = requestedModel
323+ . replace ( / - p r e v i e w - c u s t o m t o o l s $ / i, "" )
311324 . replace ( / - p r e v i e w $ / i, "" )
312325 . replace ( / ^ a n t i g r a v i t y - / i, "" ) ;
313326
314- const isGemini3Pro = transformedModel . toLowerCase ( ) . startsWith ( "gemini-3-pro" ) ;
327+ const isGemini3Pro = isGemini3ProModel ( transformedModel ) ;
315328 const hasTierSuffix = / - ( l o w | m e d i u m | h i g h ) $ / i. test ( transformedModel ) ;
316329 const isImageModel = IMAGE_GENERATION_MODELS . test ( transformedModel ) ;
317330
@@ -328,8 +341,9 @@ export function resolveModelForHeaderStyle(
328341 let transformedModel = requestedModel
329342 . replace ( / ^ a n t i g r a v i t y - / i, "" )
330343 . replace ( / - ( l o w | m e d i u m | h i g h ) $ / i, "" ) ;
331-
332- if ( ! transformedModel . endsWith ( "-preview" ) ) {
344+
345+ const hasPreviewSuffix = / - p r e v i e w ( $ | - ) / i. test ( transformedModel ) ;
346+ if ( ! hasPreviewSuffix ) {
333347 transformedModel = `${ transformedModel } -preview` ;
334348 }
335349
@@ -372,7 +386,7 @@ export function resolveModelWithVariant(
372386 if ( isGemini3 ) {
373387 const level = budgetToGemini3Level ( budget ) ;
374388 const isAntigravityGemini3Pro = base . quotaPreference === "antigravity" &&
375- base . actualModel . toLowerCase ( ) . startsWith ( "gemini-3-pro" ) ;
389+ isGemini3ProModel ( base . actualModel ) ;
376390
377391 let actualModel = base . actualModel ;
378392 if ( isAntigravityGemini3Pro ) {
0 commit comments