fix(opencode): add input token limit for Claude Opus 4.6 #819
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Adds
input = 200_000to theopencodeprovider'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-07beta header the Anthropic API enforces a 200k input token limit. Theopencodeprovider 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 tocontext - 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.inputfield is already supported in opencode's compaction check — it just wasn't populated for this model.