Kimi-K2 icon indicating copy to clipboard operation
Kimi-K2 copied to clipboard

Supplying relatively large untokenized input (though tried specifying max_output_tokens of 16384) receiving truncated reply and "stop_reason: length"

Open DXXS opened this issue 3 months ago • 0 comments

From the log of my custom tool:

[2025-10-17 19:08:54] Agent 0: Sending API request to: https://api.moonshot.ai/v1/chat/completions [2025-10-17 19:08:54] Agent 0: Request body: {"model":"kimi-k2-turbo-preview","messages":[...],"max_output_tokens":16384} [2025-10-17 19:08:54] Agent 0: Approx tokens (body) ~= 63539 [2025-10-17 19:08:54] Agent 0: Request saved: ./logs/0-req-1.json [2025-10-17 19:08:54] Agent 0: curl cmd chars=489, POST body bytes=254155 [2025-10-17 19:08:54] Agent 0: Executing provider call via curl+jq (with timeouts)... [2025-10-17 19:09:18] Agent 0: curl+jq completed: status=0, bytes=4304 [2025-10-17 19:09:18] Agent 0: stop_reason: length [2025-10-17 19:09:18] Agent 0: Initial response generated - Length: 4303 chars

[ Note: I was getting similar truncation issues using model 'kimi-latest', also tried max_tokens, and initially without specifying tokens at all ].

The pre-tokenization input body size is close to the claimed 256k token limit for the model [but tokenization estimates indicate that should be ~compressed to ~1/4 of the size], so there should theoretically be plenty of room for the requested output (should result in approximately ~25k or 5 pages of uncompressed output)...

DXXS avatar Oct 18 '25 02:10 DXXS