Skip to content

fix(opencode): add input token limit for Claude Opus 4.6#819

Closed
okhsunrog wants to merge 1 commit intoanomalyco:devfrom
okhsunrog:fix/opus-4-6-input-limit
Closed

fix(opencode): add input token limit for Claude Opus 4.6#819
okhsunrog wants to merge 1 commit intoanomalyco:devfrom
okhsunrog:fix/opus-4-6-input-limit

Conversation

@okhsunrog
Copy link

Summary

Adds input = 200_000 to the opencode provider's Claude Opus 4.6 model definition.

Context

Related to anomalyco/opencode#12342 (comment)

Claude Opus 4.6 has a 1M context window, but without the context-1m-2025-08-07 beta header the Anthropic API enforces a 200k input token limit. The opencode provider uses OAuth, which doesn't support this beta header, so the effective input limit is 200k.

This is different from models with a 200k context window (like Haiku 4.5), where 200k is the total budget for input + output combined. For Opus 4.6, the 200k only gates input tokens — output and thinking tokens live in the larger 1M context window space.

Without this field, opencode's compaction logic (compaction.ts:37) falls back to context - output (1M - 128k = ~872k) as the compaction threshold, which is far too high. The API rejects requests at 200k input tokens long before compaction triggers.

The model.limit.input field is already supported in opencode's compaction check — it just wasn't populated for this model.

@okhsunrog
Copy link
Author

Looks like I was wrong about this, closing it

@okhsunrog okhsunrog closed this Feb 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant