Skip to content

The wrong context window is being reported for OpenRouter models for specific providers #3428

@daniel-lxs

Description

@daniel-lxs

App Version

3.16.4

API Provider

OpenRouter

Model Used

Llama 4 Scout

Actual vs. Expected Behavior

Current Behavior:

  • src/api/providers/openrouter.ts uses rawModel.context_length (model-level context window)
  • This causes incorrect context window display when different providers support different sizes for the same model

Expected Behavior:

  • Should use provider-specific context window size (endpoint.context_length)
  • As correctly implemented in webview-ui/src/components/ui/hooks/useOpenRouterModelProviders.ts

Impact:

  • Leads to incorrect token limit calculations
  • May cause unexpected behavior when provider's actual context window is smaller than displayed

Detailed Steps to Reproduce

Reproduction Steps:

  1. Create an OpenRouter profile
  2. Select Llama 4 Scout model
  3. Choose Cerebras provider (32k tokens context window)
  4. Observe task header shows 1M tokens (model default) instead of 32k

Metadata

Metadata

Assignees

Labels

Issue - In ProgressSomeone is actively working on this. Should link to a PR soon.bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions