@@ -47,6 +47,7 @@ import {
4747 DEFAULT_GEMINI_EMBEDDING_MODEL ,
4848 DEFAULT_GEMINI_FLASH_MODEL ,
4949 DEFAULT_GEMINI_MODEL ,
50+ DEFAULT_GEMINI_MODEL_AUTO ,
5051 DEFAULT_THINKING_MODE ,
5152} from './models.js' ;
5253import { shouldAttemptBrowserLaunch } from '../utils/browser.js' ;
@@ -278,6 +279,7 @@ export interface ConfigParameters {
278279 policyEngineConfig ?: PolicyEngineConfig ;
279280 output ?: OutputSettings ;
280281 useModelRouter ?: boolean ;
282+ disableModelRouterForAuth ?: AuthType [ ] ;
281283 enableMessageBusIntegration ?: boolean ;
282284 codebaseInvestigatorSettings ?: CodebaseInvestigatorSettings ;
283285 continueOnFailedApiCall ?: boolean ;
@@ -374,7 +376,9 @@ export class Config {
374376 private readonly messageBus : MessageBus ;
375377 private readonly policyEngine : PolicyEngine ;
376378 private readonly outputSettings : OutputSettings ;
377- private readonly useModelRouter : boolean ;
379+ private useModelRouter : boolean ;
380+ private readonly initialUseModelRouter : boolean ;
381+ private readonly disableModelRouterForAuth ?: AuthType [ ] ;
378382 private readonly enableMessageBusIntegration : boolean ;
379383 private readonly codebaseInvestigatorSettings : CodebaseInvestigatorSettings ;
380384 private readonly continueOnFailedApiCall : boolean ;
@@ -470,7 +474,11 @@ export class Config {
470474 this . enableToolOutputTruncation = params . enableToolOutputTruncation ?? true ;
471475 this . useSmartEdit = params . useSmartEdit ?? true ;
472476 this . useWriteTodos = params . useWriteTodos ?? false ;
473- this . useModelRouter = params . useModelRouter ?? false ;
477+ this . initialUseModelRouter = params . useModelRouter ?? false ;
478+ this . useModelRouter = this . initialUseModelRouter ;
479+ this . disableModelRouterForAuth = params . disableModelRouterForAuth ?? [
480+ AuthType . LOGIN_WITH_GOOGLE ,
481+ ] ;
474482 this . enableMessageBusIntegration =
475483 params . enableMessageBusIntegration ?? false ;
476484 this . codebaseInvestigatorSettings = {
@@ -541,6 +549,16 @@ export class Config {
541549 }
542550
543551 async refreshAuth ( authMethod : AuthType ) {
552+ this . useModelRouter = this . initialUseModelRouter ;
553+ if ( this . disableModelRouterForAuth ?. includes ( authMethod ) ) {
554+ this . useModelRouter = false ;
555+ if ( this . model === DEFAULT_GEMINI_MODEL_AUTO ) {
556+ this . model = DEFAULT_GEMINI_MODEL ;
557+ }
558+ } else {
559+ this . model = DEFAULT_GEMINI_MODEL_AUTO ;
560+ }
561+
544562 // Vertex and Genai have incompatible encryption and sending history with
545563 // thoughtSignature from Genai to Vertex will fail, we need to strip them
546564 if (
0 commit comments