v2.48.0
Kimi OAuth: Auto Context Tier for K3
The k3 model on the Kimi for Coding OAuth endpoint now starts on the cheaper k3-256k wire ID and seamlessly upgrades to the full k3 (1M context) only when the session needs it — instead of paying the premium for every request.
How it works
- Single selectable
k3. OAuth discovery no longer exposesk3-256kas a separate model; you selectk3and dreb handles the wire variant. - Starts cheap. Fresh sessions send
k3-256kon the wire (256k context window). - Upgrades at 245,760 tokens. When context approaches the 256k cutoff, dreb switches to the
k3wire ID and the 1M context window — the Kimi backend upgrades the prompt cache server-side with no loss. - Lowered compaction threshold = opt-out. If you lower the compaction threshold below the default, auto-compaction fires first and effectively disables the upgrade, keeping you on
k3-256k. - Compacted sessions return to cheap. After auto or manual compaction, the tier re-derives from the reduced context and goes back to
k3-256kwhere possible. models.jsonoverride respected. A user-overriddenk3context window disables automatic tiering rather than being silently replaced.- Scoped to Kimi OAuth only. The
k3-256ktier is exclusive to the Kimi for Coding OAuth endpoint; the Moonshot AI Platform and other providers are unaffected.
Technical details
- New optional
Model.wireModelId— the OpenAI-compatible completions provider sends it on the wire while assistant messages keep the stable registry ID (k3). - New
k3-context-tier.tsmodule with pure derivation helpers;AgentSessionapplies the tier at every model set, cycle, refresh, restore, and creation site. - New
context_window_upgradesession event with interactive-mode status line and footer refresh.
Fixes
- Disabled-compaction path: K3 upgrade fires even when auto-compaction is disabled, since the upgrade is model-capability management, not context reduction.
- Overflow recovery: a 256k-tier overflow upgrades and retries; a 1M-tier overflow still falls back to compact-and-retry.