Skip to content

[BUG] _DEFAULT_CONTEXT_LIMITS hardcodes DeepSeek-V3 at 128K — should be 1M (1,048,576) #1038

Description

@ZongrongLi

Bug

_DEFAULT_CONTEXT_LIMITS in headroom/providers/openai_compatible.py hardcodes DeepSeek models at outdated context window sizes:

"deepseek": 32768,
"deepseek-coder": 16384,
"deepseek-v2": 128000,
"deepseek-v3": 128000,

DeepSeek V3 (and V4) supports 1,048,576 tokens (1M context). The hardcoded 128K causes Headroom to trigger compression far too early — at 128K instead of letting the full 1M window be utilized.

Impact

When using Headroom as a proxy in front of DeepSeek (directly or via a router like Manifest), the proxy compresses messages once they exceed ~128K tokens. This defeats the purpose of using a long-context model — users pay for 1M context but only get 128K before compression kicks in.

Additionally, the fallback for unknown model names is 128K (return 128000). This means any routing proxy that sends model names like auto will also be capped at 128K regardless of the downstream model.

Suggested Fix

  1. Update _DEFAULT_CONTEXT_LIMITS:
"deepseek": 1048576,       # V3/V4 family default
"deepseek-coder": 128000,  # DeepSeek Coder V2+
"deepseek-v2": 128000,     # V2 remains 128K
"deepseek-v3": 1048576,    # 1M context
"deepseek-v4": 1048576,    # 1M context
  1. Consider a mechanism to override the fallback default (128K) or allow per-request context_limit / token_budget hints so routing proxies can signal the true downstream context window.

Environment

  • Headroom version: 0.23.0
  • Provider: OpenAI-compatible (custom endpoint via Manifest router)
  • Model: DeepSeek V3 / V4 Flash (routed as auto)

Workaround

Manually patching _DEFAULT_CONTEXT_LIMITS in site-packages and adding "auto": 1048576 for router model aliases.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    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