Skip to content

Add user-configurable context window size override for non-Claude models #345

Closed

Description

@111-test-111

Problem

When using non-Claude models (e.g., custom API proxies or third-party models) with Claude Code, the context_window_size passed to ccstatusline via the JSON pipe defaults to 200,000 tokens. This is hardcoded in Claude Code's internal model database and cannot be overridden without also disabling the /compact command (via DISABLE_COMPACT + CLAUDE_CODE_MAX_CONTEXT_TOKENS environment variables).

ccstatusline's getContextConfig() function (in src/utils/model-context.ts) trusts the context_window_size value from Claude Code when it's a valid positive number, and never falls back to parseContextWindowSize() model name parsing. This means even if the user appends a context hint like (1m) to the model identifier, it has no effect.

Example

Using a model like mimo-v2.5-pro with a 1M context window via a third-party API proxy shows 200k in the status line instead of 1M.

Proposed Solutions (any one would work)

  1. Add a contextWindowOverride setting in ~/.config/ccstatusline/settings.json that takes precedence over the value from Claude Code:

    {
      "contextWindowOverride": 1000000
    }
  2. Support an environment variable like CCSTATUSLINE_CONTEXT_WINDOW_SIZE that overrides the JSON value.

  3. Fall back to model name parsing even when context_window_size is provided — use parseContextWindowSize() as a secondary check on the model identifier, preferring its result if the Claude Code value looks like a default (e.g., exactly 200000).

Option 1 or 2 would be the most straightforward and non-breaking. Option 3 could cause regressions for Claude model users.

Context

  • ccstatusline version: 2.2.10
  • Claude Code version: 2.1.119
  • The parseContextWindowSize() regex already handles patterns like (1m), [1m], 1M context — it just never gets called when Claude Code sends a valid number.

Activity

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions