Skip to content

Compaction Fails with APIContextOverflow due to sending the wrong context length #476

Closed

Description

@frosty00

The token_size bug where it is not propagating the context_size correctly from #306 still exists during compaction

Error: compaction.failed APIContextOverflowError: 400 This endpoint's maximum context length is 262144 tokens. However, you requested about 264896 tokens (52139 of text input, 12757 of tool input, 200000 in the output). Please reduce the length of either one.

my config looks like this:

[models. "openrouter/kimi-k2.6"]
provider = "openrouter"
model = "moonshotai/kimi-k2.6:baidu"
max_context_size = 200000
max_output_size = 16384
max_tokens = 16384

It shouldn't be sending the max_context_size for the max_output_size when doing /compaction, it works normally for regular input, but crashes as soon as it tries to issue a /compaction command

Activity

  1. qkunio commented on Jun 5, 2026

    @qkunio
    Contributor

    great, I met the same question.

  2. leonardobrunelli-OX commented on Jun 5, 2026

    @leonardobrunelli-OX

    Error: [compaction.failed] APIStatusError: 400 total message size 10176584 exceeds limit 2097152
    same here

  3. voku682 commented on Jun 21, 2026

    @voku682

    @frosty00 can you tell how you are using openrouter in Kimi code ? the "/providers" doesn't lists openrouter as one of the providers

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions