From a362243fdd941e2db8e76a40365a8bbc42a2124e Mon Sep 17 00:00:00 2001 From: yin1245 <2573101189@qq.com> Date: Wed, 25 Mar 2026 19:29:54 +0800 Subject: [PATCH] fix: update TOTAL_CONTEXT_TOKENS to 1M for Kiro context window upgrade Kiro has upgraded its context window from 173k to 1M tokens. The hardcoded TOTAL_CONTEXT_TOKENS: 172500 causes input_tokens in the converted Claude SSE response to be severely underestimated (~17% of actual value). input_tokens is calculated as: totalTokens = TOTAL_CONTEXT_TOKENS * contextUsagePercentage / 100 inputTokens = totalTokens - outputTokens With the old 172500 constant, a request with real input of 169,944 tokens gets reported as ~35,000 tokens, causing downstream billing systems to undercharge by ~5x. --- src/providers/claude/claude-kiro.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/providers/claude/claude-kiro.js b/src/providers/claude/claude-kiro.js index 3f037db..70683af 100644 --- a/src/providers/claude/claude-kiro.js +++ b/src/providers/claude/claude-kiro.js @@ -44,7 +44,7 @@ const KIRO_CONSTANTS = { AUTH_METHOD_SOCIAL: 'social', CHAT_TRIGGER_TYPE_MANUAL: 'MANUAL', ORIGIN_AI_EDITOR: 'AI_EDITOR', - TOTAL_CONTEXT_TOKENS: 172500, // 总上下文 173k tokens + TOTAL_CONTEXT_TOKENS: 1000000, // Kiro now supports 1M context window }; // 从 provider-models.js 获取支持的模型列表