opencode zen claude-sonnet-4-5 advertising incorrect context limit #2296

Closed
opened 2026-02-16 17:35:02 -05:00 by yindo · 2 comments
Owner

Originally created by @teepark on GitHub (Oct 27, 2025).

Originally assigned to: @fwang on GitHub.

Description

models.dev lists the opencode "claude-sonnet-4-5" model as having a 1M token context, but this is an option that anthropic provides at a higher cost. Most multi-model agents I've seen with this option expose it like a separate model. The opencode zen service doesn't actually activate this option, so the context %age in the top right is incorrect, and compaction doesn't get triggered when we're reaching the real limit of the session.

Users can work around this issue now by overriding the model's limit in their openrc.jsonc config file.

{
  "$schema": "https://opencode.ai/config.json",
  "autoupdate": true,
  "provider": {
    "opencode": {
      "models": {
        "claude-sonnet-4-5": {
          "limit": {
            "context": 200000,
            "output": 64000
          }
        }
      }
    }
  }
}

For reference, opencode.models["claude-sonnet-4-5"] should be the same as anthropic.models["claude-sonnet-4-5"]. The costs do correctly match, but if the opencode zen service were actually making use of the 1M token extension they'd be higher.

OpenCode version

v0.15.3

Steps to reproduce

  1. sign up for the opencode zen service
  2. start opencode
  3. run opencode auth login and log in to your zen account
  4. ctrl-x m and select Claude Sonnet 4.5 under OpenCode Zen
  5. begin a session with sonnet 4.5 - the relationship between the tokens used and the % in the top right indicates it thinks there's a 1M token context
  6. exceed 200K tokens in the session - the session is dead because opencode doesn't compact it and anthropic won't allow it to continue

Screenshot and/or share link

No response

Operating System

macOS 15.6

Terminal

Ghostty

Originally created by @teepark on GitHub (Oct 27, 2025). Originally assigned to: @fwang on GitHub. ### Description models.dev lists the opencode "claude-sonnet-4-5" model as having a 1M token context, but this is an option that anthropic provides at a higher cost. Most multi-model agents I've seen with this option expose it like a separate model. The opencode zen service doesn't actually activate this option, so the context %age in the top right is incorrect, and compaction doesn't get triggered when we're reaching the real limit of the session. Users can work around this issue now by overriding the model's limit in their openrc.jsonc config file. ``` { "$schema": "https://opencode.ai/config.json", "autoupdate": true, "provider": { "opencode": { "models": { "claude-sonnet-4-5": { "limit": { "context": 200000, "output": 64000 } } } } } } ``` For reference, `opencode.models["claude-sonnet-4-5"]` should be the same as `anthropic.models["claude-sonnet-4-5"]`. The costs do correctly match, but if the opencode zen service were actually making use of the 1M token extension they'd be higher. ### OpenCode version v0.15.3 ### Steps to reproduce 1. sign up for the opencode zen service 2. start opencode 3. run `opencode auth login` and log in to your zen account 4. `ctrl-x m` and select `Claude Sonnet 4.5` under `OpenCode Zen` 5. begin a session with sonnet 4.5 - the relationship between the tokens used and the % in the top right indicates it thinks there's a 1M token context 6. exceed 200K tokens in the session - the session is dead because opencode doesn't compact it and anthropic won't allow it to continue ### Screenshot and/or share link _No response_ ### Operating System macOS 15.6 ### Terminal Ghostty
yindo added the bug label 2026-02-16 17:35:02 -05:00
yindo closed this issue 2026-02-16 17:35:02 -05:00
Author
Owner

@github-actions[bot] commented on GitHub (Oct 27, 2025):

This issue might be a duplicate of existing issues. Please check:

  • #3322: Reports discrepancies in token usage calculation between TUI and web, where TUI correctly shows actual token usage while web incorrectly aggregates all tokens
  • #3314: Describes 2x token reporting in TUI causing compaction to trigger too early - similar to the incorrect context limit display issue
  • #3409: Reports getting stuck after "token too long" error, which relates to incorrect context limit handling
  • #3463: Feature request to undo prompts that exceed token limit, addressing similar context management issues

Feel free to ignore if none of these address your specific case with the claude-sonnet-4-5 model advertising 1M context when only 200K is actually available.

@github-actions[bot] commented on GitHub (Oct 27, 2025): This issue might be a duplicate of existing issues. Please check: - #3322: Reports discrepancies in token usage calculation between TUI and web, where TUI correctly shows actual token usage while web incorrectly aggregates all tokens - #3314: Describes 2x token reporting in TUI causing compaction to trigger too early - similar to the incorrect context limit display issue - #3409: Reports getting stuck after "token too long" error, which relates to incorrect context limit handling - #3463: Feature request to undo prompts that exceed token limit, addressing similar context management issues Feel free to ignore if none of these address your specific case with the claude-sonnet-4-5 model advertising 1M context when only 200K is actually available.
Author
Owner

@fwang commented on GitHub (Oct 27, 2025):

Just pushed out a fix. ^ was missing the context-1m-2025-08-07 header to anthropic.

Feel free to reopen if issue persist.

@fwang commented on GitHub (Oct 27, 2025): Just pushed out a fix. ^ was missing the `context-1m-2025-08-07` header to anthropic. Feel free to reopen if issue persist.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#2296