Additional Diagnostic Information
Environment
- Kimi Code Version: 0.5.0
- Node.js: v24.15.0
- Platform: macOS Darwin 24.6.0 x86_64
- Model: kimi-code/kimi-for-coding (thinkingEffort=high)
Local Environment Ruled Out
- Proxy not involved: Confirmed via Clash Verge Rev traffic logs that
api.kimi.com traffic is marked as DIRECT and does not go through any proxy node.
- Environment variables:
HTTP_PROXY=http://127.0.0.1:7897 and HTTPS_PROXY=http://127.0.0.1:7897 are set, but proxy logs confirm the Kimi API connection is direct.
- Other models work fine: In the same session and network environment, switching to
deepseek/deepseek-v4-pro produces no terminated or APIEmptyResponseError errors at comparable context lengths.
Error Types and Statistics
Error counts across historical sessions in the current working directory:
| Session |
Model |
terminated |
APIEmptyResponseError |
| session_04ec300e |
kimi-for-coding |
8 |
0 |
| session_1bdc5439 |
kimi-for-coding |
4 |
3 |
| session_27f2da98 |
kimi-for-coding |
4 |
0 |
| session_29f5f704 (current) |
kimi-for-coding |
6+ |
1 |
| session_d194ec6b |
kimi-for-coding |
0 |
0 |
| session_f0e7f83a |
kimi-for-coding |
0 |
0 |
Key finding: Errors occur exclusively on the kimi-for-coding model. All turns using deepseek-v4-pro are error-free.
Current Session Error Timeline (session_29f5f704)
02:33:10 turnId=0 step=8 input=36,560 tokens → terminated (attempt 1/3)
02:33:31 turnId=1 step=2 input=37,480 tokens → terminated (attempt 1/3)
02:35:37 turnId=3 step=2 input=40,868 tokens → terminated (attempt 1/3)
02:49:34 turnId=6 step=1 input=43,704 tokens → APIEmptyResponseError (attempts 1, 2, 3 all failed)
02:xx:xx User reports another terminated error
Root Cause Analysis of Both Error Types
A. Error: terminated
- Location:
KimiStreamedMessage._convertStreamResponse → convertOpenAIError
- Nature: The SSE stream is abnormally interrupted during transmission.
- Pattern: Intermittent; retrying the same request may succeed. Frequency increases as context grows beyond ~36K tokens.
B. APIEmptyResponseError: The API returned a response containing only thinking content without any text or tool calls...
- Location:
Agent.generate (main.cjs:53690)
- Nature: The SSE stream ends normally, but the response contains only thinking fragments with no actual text or tool_call content.
- Pattern: At 43K+ input tokens, all 3 retry attempts fail consecutively, ruling out a transient network issue.
Preliminary Conclusions
- Not a local network/proxy issue — DeepSeek works fine on the same network, and Clash logs confirm direct connection to the Kimi API.
- Not a context window overflow — 43K tokens is far below the 256K limit.
- Suspected Kimi API server-side issue:
- SSE long connections become unstable when generation time increases.
- The
kimi-for-coding thinking mode may consume an excessive portion of the output token budget, leaving no room for the final response.
Suggested Investigation Directions
- Check whether the
kimi-for-coding server-side SSE long-connection keep-alive / timeout mechanism is defective.
- Verify if the output token budget allocation for thinking mode is reasonable (43K input causing exhaustion seems abnormal).
- Investigate whether HTTP/2 stream control is triggering connection resets (Node.js v24 + undici enables HTTP/2 by default).
Additional Diagnostic Information
Environment
Local Environment Ruled Out
api.kimi.comtraffic is marked asDIRECTand does not go through any proxy node.HTTP_PROXY=http://127.0.0.1:7897andHTTPS_PROXY=http://127.0.0.1:7897are set, but proxy logs confirm the Kimi API connection is direct.deepseek/deepseek-v4-proproduces noterminatedorAPIEmptyResponseErrorerrors at comparable context lengths.Error Types and Statistics
Error counts across historical sessions in the current working directory:
terminatedAPIEmptyResponseErrorKey finding: Errors occur exclusively on the
kimi-for-codingmodel. All turns usingdeepseek-v4-proare error-free.Current Session Error Timeline (session_29f5f704)
Root Cause Analysis of Both Error Types
A.
Error: terminatedKimiStreamedMessage._convertStreamResponse→convertOpenAIErrorB.
APIEmptyResponseError: The API returned a response containing only thinking content without any text or tool calls...Agent.generate(main.cjs:53690)Preliminary Conclusions
kimi-for-codingthinking mode may consume an excessive portion of the output token budget, leaving no room for the final response.Suggested Investigation Directions
kimi-for-codingserver-side SSE long-connection keep-alive / timeout mechanism is defective.