opencode icon indicating copy to clipboard operation
opencode copied to clipboard

feat: anthropic oauth w/ 1m context

Open haoxiangliew opened this issue 2 months ago • 0 comments

This is available with the Claude Max plans on "sonnet-4+' models

Has corresponding changes as a prerequisite in haoxiangliew/opencode-anthropic-auth https://github.com/sst/opencode-anthropic-auth/pull/2

opencode on  anthropic-1m [!?] via 🥟 v1.3.1 took 8s
❯ bun dev run "Respond with the exact value of budget:token_budget"
$ bun run --cwd packages/opencode --conditions=browser src/index.ts run "Respond with the exact value of budget:token_budget"

1000000
  • https://docs.claude.com/en/docs/build-with-claude/context-windows#context-awareness-in-claude-sonnet-4-5-and-haiku-4-5

At the start of a conversation, Claude receives information about its total context window:

<budget:token_budget>200000</budget:token_budget>

Might also need a corresponding models.dev update w/ claude-sonnet-4-5[1m] (if we are to use the same convention as claude code) and/or users should increase the limits under the provider/anthropic/models/claude-sonnet-4-5 options in ~/.config/opencode/config.json :)

haoxiangliew avatar Nov 01 '25 00:11 haoxiangliew