diff --git a/packages/cli/src/validateNonInterActiveAuth.ts b/packages/cli/src/validateNonInterActiveAuth.ts index c8a4f810b..f5d71b08d 100644 --- a/packages/cli/src/validateNonInterActiveAuth.ts +++ b/packages/cli/src/validateNonInterActiveAuth.ts @@ -22,7 +22,7 @@ export async function validateNonInteractiveAuth( const authType = nonInteractiveConfig.modelsConfig.getCurrentAuthType(); if (!authType) { throw new Error( - 'No auth type is selected. Please configure an auth type (e.g. via settings) before running in non-interactive mode.', + 'No auth type is selected. Please configure an auth type (e.g. via settings or `--auth-type`) before running in non-interactive mode.', ); } const resolvedAuthType: NonNullable = authType; diff --git a/packages/core/src/models/modelConfigResolver.ts b/packages/core/src/models/modelConfigResolver.ts index 9f4b43b6a..a6c734f72 100644 --- a/packages/core/src/models/modelConfigResolver.ts +++ b/packages/core/src/models/modelConfigResolver.ts @@ -128,10 +128,11 @@ export function resolveModelConfig( return resolveQwenOAuthConfig(input, warnings); } - // Get auth-specific env var mappings + // Get auth-specific env var mappings. + // If authType is not provided, do not read any auth env vars. const envMapping = authType ? AUTH_ENV_MAPPINGS[authType] - : AUTH_ENV_MAPPINGS[AuthType.USE_OPENAI]; + : { model: [], apiKey: [], baseUrl: [] }; // Build layers for each field in priority order // Priority: modelProvider > cli > env > settings > default