GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat(provider): add 1M context window support for Anthropic models by DusKing1 · Pull Request #14375 · anomalyco/opencode

Conversation

@DusKing1

@DusKing1 DusKing1 commented Feb 20, 2026 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Issue for this PR

Closes #12323

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Enables the 1M token context window for Anthropic models that support it (Opus 4.6, Sonnet 4.6, Sonnet 4.5, Sonnet 4.0).

Three changes:

  1. Beta header (provider.ts): Appends context-1m-2025-08-07 to the anthropic-beta header. This is the only thing the Anthropic API requires to unlock 1M context.

  2. Context limit override (provider.ts): models.dev currently reports context: 200000 for these models, which causes compaction to trigger at ~168K tokens. The code now detects 1M-capable models by API ID pattern and overrides limit.context to 1_000_000. Guarded by < 1_000_000 so it becomes a no-op once models.dev updates.

  3. Compaction fix (compaction.ts): When model.limit.input is set, the overflow check now counts only input tokens instead of total tokens. Output/thinking tokens don't consume the input context window.

This is a minimal alternative to #12342 — same 1M result without the AI SDK v5-v6 upgrade.

How did you verify your code works?

  • All 24 compaction tests pass (the previously-documented bug test now asserts the corrected behavior)
  • LSP diagnostics clean on both changed files
  • CI typecheck and unit tests pass

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

kashik0i and 381181295 reacted with thumbs up emoji
All reactions
  • 👍 2 reactions
@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label Feb 20, 2026
@github-actions

github-actions Bot commented Feb 20, 2026

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

Based on my search, I found one related PR:

PR #12342: "feat(provider): add adaptive thinking and 1M context support for Claude Opus 4.6"
#12342

This PR is related because it addresses the same feature (1M context window support for Anthropic models, specifically Claude Opus 4.6). According to the current PR description, PR #14375 is "a minimal alternative to #12342 — no AI SDK version upgrade required," indicating these PRs take different approaches to solving the same problem.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Feb 20, 2026
@github-actions

github-actions Bot commented Feb 20, 2026

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@sergical

sergical commented Feb 22, 2026

Copy link
Copy Markdown
Contributor

+1 on this one, a bit annoying to have opencode keep hitting 200k limit thinking its at 20% of the context rn 😓

DusKing1, ShanePresley, jasgeo75, Jaakkonen, wilburx3, spectrl, and illera88 reacted with thumbs up emoji
All reactions
  • 👍 7 reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@jasgeo75

jasgeo75 commented Feb 28, 2026

Copy link
Copy Markdown

any plans to merge this?

makiri1993 reacted with thumbs up emoji makiri1993 reacted with rocket emoji
All reactions
  • 👍 1 reaction
  • 🚀 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This was referenced Feb 28, 2026
📊 AI CLI 工具社区动态日报 2026-02-28 duanyytop/agents-radar#27
Closed
feat(provider): graceful context-1m fallback for sub-Tier-4 accounts #15641
Closed
@DusKing1
feat(provider): add 1M context window support for Anthropic models
d471249
Add context-1m-2025-08-07 beta header for Anthropic provider, enabling
1M token context window for Claude Opus 4.6, Sonnet 4.6, Sonnet 4.5,
and Sonnet 4.0.

Override context limit from 200K to 1M for supported models so compaction
triggers at the correct threshold instead of prematurely at 200K.

Fix compaction token counting: when model.limit.input is set, only count
input tokens (not output/thinking) against the input limit. Output tokens
do not consume the input context window.
@DusKing1
DusKing1 force-pushed the feat/1m-context-support branch from 5103e1e to d471249 Compare March 2, 2026 15:57
@github-actions github-actions Bot mentioned this pull request Mar 5, 2026
feat(gitlab): send context-1m-2025-08-07 beta header to enable 1M context window #16153
Merged
3 of 6 tasks
vbuccigrossi pushed a commit to vbuccigrossi/opencode that referenced this pull request Mar 7, 2026
EBrown @claude
feat: port remaining Tier 1+2 upstream fixes and features
63e7373
Tier 1 bug fixes:
- Fix O(n²) bash output concatenation with StreamingOutput class (anomalyco#9693)
- Fix memory leaks in Bus.once, Format, Plugin, ShareNext, Bootstrap (anomalyco#13514)
- Fix FileTime race condition using actual file mtime instead of JS clock
- Free memory on compaction prune: clear output/attachments/metadata (anomalyco#7049)
- Throttle reasoning-delta storage writes to 50ms intervals (anomalyco#11328)
- Handle SIGHUP/SIGTERM to prevent orphaned processes (anomalyco#12718)
- Add process.once("close") handler for bash tool reliability

Tier 2 features:
- Support 1M context window for Anthropic models via beta header (anomalyco#14375)
- Input-only token counting for compaction with limit.input models
- MCP lazy loading: on-demand tool discovery via mcp_search tool (anomalyco#8771)
- MCP servers listed in system prompt when lazy mode enabled
- StreamingOutput: output_filter regex for build diagnostics
- LSP server cleanup callback for temp directory removal
- Extract formatSize utility from uninstall to shared util/format
- GitHub CI: fix Bus subscription leak in session event handler

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@github-actions github-actions Bot mentioned this pull request Apr 1, 2026
update beta header for github copilot claude opus 4.6 to support 1m context #20498
Closed
3 of 6 tasks
@opencode-agent
opencode-agent Bot force-pushed the dev branch from 2f2ed11 to 9f201d6 Compare April 16, 2026 21:55
@github-actions

github-actions Bot commented May 2, 2026

Copy link
Copy Markdown
Contributor

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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot closed this May 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

[FEATURE]: Add support of Claude Opus 4.6

Uh oh!

There was an error while loading. Please reload this page.

3 participants

@DusKing1 @sergical @jasgeo75
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.