GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — feat(provider): add adaptive thinking and 1M context support for Claude Opus 4.6 by okhsunrog · Pull Request #12342 · anomalyco/opencode Conversation
| ||||||||||||||||||||||||||||||||||||
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
The following comment was made by an LLM, it may be inaccurate: No duplicate PRs found |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
7ffe6a8 to
a3ebbc5
Compare
There was an error while loading. Please reload this page.
|
Adding of adaptive thinking needs an upgrade of @ai-sdk/anthropic which leads to upgrading of a bunch of other packages. Making it a draft for now. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
a3ebbc5 to
5316c7e
Compare
|
Added a commit with dependencies upgrade. Tested locally, switching effort levels with Opus 4.6 now works as expected |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Can anyone test if 1M context for you? It works for me just fine with Opus 4.6. I managed to get up to 340k token |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@okhsunrog what's the easiest way to test this? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@ItsWendell make sure you have latest bun installed, then run these commands: git clone -b feat/opus-4-6-adaptive-thinking https://github.com/okhsunrog/opencode.git
cd opencode
bun install
bun dev |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
@ItsWendell yes, I confirm the issue is there. but if we'd pass |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
|
Confirmed, the 200k limit is enforced by the Anthropic API. The status bar shows a combined total (input + output + cache tokens), but the API only counts input tokens against the 200k limit. That's why I didn't hit it earlier — actual input tokens stayed under 200k even though the status bar showed 385k. // compaction.ts:35 const count = input.tokens.input + input.tokens.cache.read + input.tokens.output So opencode thinks there's plenty of headroom (39% of 1M) while the API is already at the 200k input limit. I'll update my PR to add the P.S. Worth noting that the 200k limit on Opus 4.6 without the beta header is different from the 200k context window on models like Haiku 4.5. For Haiku 4.5, 200k is the total context window — input tokens, output tokens, everything has to fit within that 200k budget. For Opus 4.6, the context window is actually 1M — the 200k is only a gate on input tokens. Output and thinking tokens live in the larger 1M space and don't count against the 200k. So even without the |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
- Add adaptive-thinking-2026-01-28 beta header for Anthropic provider - Detect Opus 4.6 models and use adaptive thinking with effort parameter - Support all effort levels: low, medium, high, max - Older models continue to use manual thinking with budgetTokens Opus 4.6 uses adaptive thinking where the model decides how much to think based on task complexity, guided by the effort parameter. This is more efficient than fixed budgetTokens as simple tasks use minimal thinking. Ref: https://docs.anthropic.com/en/docs/build-with-claude/adaptive-thinking
- Upgrade ai package from 5.0.124 to 6.0.72 - Upgrade @ai-sdk/anthropic from 2.0.58 to 3.0.37 (adds adaptive thinking support) - Upgrade all @ai-sdk/* packages to v3+/v4+ for compatibility - Update LanguageModelV2 to LanguageModelV3 across codebase - Make toModelMessages async per AI SDK 6 requirements - Update toModelOutput signature to use destructured parameter - Fix tool factory renames and remove deprecated name property - Update tests for new LanguageModelUsage type structure Enables Claude Opus 4.6 to use adaptive thinking with effort levels (low/medium/high/max) instead of fixed budget tokens.
|
@rekram1-node @thdxr could anyone review this, please? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
cd15179 to
b49a992
Compare
|
how did anyone manage to use with this branch? i keep getting : The long context beta is not yet available for this subscription |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…ounting, use plugin fork for OAuth context cap
b49a992 to
471746d
Compare
| @@ -16,15 +16,14 @@ import { gitlabAuthPlugin as GitlabAuthPlugin } from "@gitlab/opencode-gitlab-au | |||
| export namespace Plugin { | |||
| const log = Log.create({ service: "plugin" }) | |||
|
|
|||
| const BUILTIN = ["opencode-anthropic-auth@0.0.13"] | |||
| const BUILTIN = ["github:okhsunrog/opencode-anthropic-auth#feat/oauth-context-cap"] | |||
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
opencode core shouldn't have builtin plugins that pull from forks.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
correct
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
It was only supposed for testing till changes to opencode-anthropoc-auth are accepted
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Hi, anything new here ? I'm using this branch (with official opencode anthropic auth) and it works perfectly (Azure Anthropic & Anthropic API) untested with claude code. Double tokens counting is fixed 👌 Opus 4.6 is inusable with custom config without this PR 😅 (usable with Zen, Openrouter, Cloudflare Gateway, ... but any advanced config is ignored) |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Is there a plugin or something i can install in the meantime to fix this error? |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
can't be fixed with a plugin, you need to fork last version of opencode, then merge this branch into your fork (and resolve merge conflicts, if any), then build it and use the new binary until opencode team merge this PR Note : I had to revert this change :
Working well with API, don't know if it will works well with Claude Code. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
Closing this pull request because it has had no updates for more than 60 days. If you plan to continue working on it, feel free to reopen or open a new PR. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
should that be reopened? This is the only thing I'm missing to completely switch away from Claude Code. |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
should be working now as they updated ai-sdk, you might need to edit your provider configuration depending on your anthropic provider & available options at your account level |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
Claude Opus 4.6 context window limits still 200k 1M tokens for Opus 4.6 [FEATURE]: Add support of Claude Opus 4.6
There was an error while loading. Please reload this page.