Skip to content

Output is truncated when using Kimi K2 #6936

@greyishsong

Description

@greyishsong

App Version

3.25.10 (c75549c)

API Provider

OpenAI Compatible

Model Used

Kimi K2

Roo Code Task Links (Optional)

No response

🔁 Steps to Reproduce

  1. Use the latest VS Code (on Arch Linux) and the latest stable version of Roo Code
  2. Switch to Kimi K2 (use the official Moonshot provider, both kimi-k2-0711-preview and kimi-k2-turbo-preview are ok), following the official instructions.
  3. Prepare a task that is big enough, e.g., implement a Vue component requiring 200+ lines of code
  4. Roo Code is able to create or modify the target file, but the output is truncated

💥 Outcome Summary

The newly created file is truncated. In my Moonshot console, I can see that the model's output is truncated exactly to 1024 tokens even if I set the max token limit to -1 or 32000.

Image

What's more, I have also tried to set max_tokens: 32000 through a custom header according to Moonshot's Chat API doc, but this doesn't work at all. During the whole process, no error is reported.

It seems that a wrong max_tokens parameter is very likely to be the reason for truncation. I have tried to use VS Code's DevTool to check the header of the API request, but I cannot find Roo Code's request on it.

📄 Relevant Logs or Errors (Optional)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Issue - Needs InfoMissing details or unclear. Waiting on author to provide more context.bugSomething isn't working

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions