Skip to content

Wrong context length for kimi-k2.6 family: OpenRouter returns 32K, overrides correct hardcoded 256K default #24268

@kn8-codes

Description

@kn8-codes

Summary

Hermes Agent incorrectly reports kimi-k2.6 as having a 32,768 token
context window, blocking agent initialization with:

ValueError: Model kimi-k2.6 has a context window of 32,768 tokens,
which is below the minimum 64,000 required by Hermes Agent.

The model actually supports 256K context. The bug is in the resolution
order in agent/model_metadata.py.

Root Cause

get_model_context_length() consults OpenRouter's API metadata before
checking hardcoded defaults. OpenRouter incorrectly reports 32,768 for
the kimi-k2.6 family. Since OpenRouter "succeeds", the correct hardcoded
value of 262,144 is never reached.

Affected Models (verified via OpenRouter API)

Model OpenRouter reports Actual
kimi-k2.6 32,768 256K
kimi-k2.6-20260420 32,768 256K
kimi-latest 32,768 256K

Unaffected (OpenRouter correct)

  • kimi-k2.5 — reports 262,144 ✓
  • kimi-k2-thinking — reports 262,144 ✓
  • kimi-k2-0905 — reports 262,144 ✓

Proposed Fix

Add explicit entries to DEFAULT_CONTEXT_LENGTHS in
agent/model_metadata.py:

"kimi-k2.6": 262144,
"kimi-k2.6-20260420": 262144,
"kimi-latest": 262144,

Workaround

Add context_length: 131072 under both model: and
auxiliary.compression: in config.yaml.

Environment

  • Hermes Agent v0.13.0 (2026.5.7)
  • Provider: kimi-coding
  • Model: kimi-k2.6

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High — major feature broken, no workaroundcomp/agentCore agent loop, run_agent.py, prompt builderprovider/kimiKimi / Moonshotsweeper:implemented-on-mainSweeper: behavior already present on current maintype/bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions