diff --git a/src/auth/kiro-oauth.js b/src/auth/kiro-oauth.js index 13a5bfa6..0de9ca01 100644 --- a/src/auth/kiro-oauth.js +++ b/src/auth/kiro-oauth.js @@ -436,6 +436,7 @@ async function pollKiroBuilderIDToken(clientId, clientSecret, deviceCode, interv authMethod: 'builder-id', clientId, clientSecret, + region: options.region || 'us-east-1', idcRegion: options.region || 'us-east-1' }; diff --git a/src/providers/claude/claude-kiro.js b/src/providers/claude/claude-kiro.js index 719ea160..ec164917 100644 --- a/src/providers/claude/claude-kiro.js +++ b/src/providers/claude/claude-kiro.js @@ -205,6 +205,7 @@ const KIRO_MODELS = getProviderModels(MODEL_PROVIDER.KIRO_API); // 完整的模型映射表 const FULL_MODEL_MAPPING = { "claude-haiku-4-5":"claude-haiku-4.5", + "claude-haiku-4-5-20251001":"claude-haiku-4.5", "claude-opus-4-8":"claude-opus-4.8", "claude-opus-4-7":"claude-opus-4.7", "claude-opus-4-6":"claude-opus-4.6", @@ -722,8 +723,8 @@ async loadCredentials() { applyCredential('idcRegion'); if (!this.region) { - logger.warn('[Kiro Auth] Region not found in credentials. Using default region us-east-1 for URLs.'); - this.region = 'us-east-1'; + this.region = this.idcRegion || 'us-east-1'; + logger.warn(`[Kiro Auth] Region not found in credentials. Using idcRegion/default: ${this.region}`); } // idcRegion 用于 REFRESH_IDC_URL,如果未设置则使用 region @@ -2124,7 +2125,7 @@ async saveCredentialsToFile(filePath, newData) { this._markCredentialNeedRefresh('Token near expiry in generateContent'); } - const finalModel = MODEL_MAPPING[model] ? model : model; + const finalModel = MODEL_MAPPING[model] || model; logger.info(`[Kiro] Calling generateContent with model: ${finalModel}`); // Estimate input tokens before making the API call @@ -2483,7 +2484,7 @@ async saveCredentialsToFile(filePath, newData) { this._markCredentialNeedRefresh('Token near expiry in generateContentStream'); } - const finalModel = MODEL_MAPPING[model] ? model : model; + const finalModel = MODEL_MAPPING[model] || model; logger.info(`[Kiro] Calling generateContentStream with model: ${finalModel} (real streaming)`); let inputTokens = 0;