Problem
Currently, OpenCode enforces a hard-coded 200,000 token limit per conversation session. When this limit is reached, the session terminates and all context is lost, forcing users to start a new conversation.
For developers running OpenCode locally with their own compute resources and API keys, this restriction feels arbitrary - especially when their providers don't impose similar limits or when they have higher quotas available.
Proposed Solution
Add a configuration option to customize the per-session token budget, allowing users to adjust it based on their needs and resources.
Possible implementation approaches:
- Config file option (e.g.,
~/.opencode/config.json or .opencode/config.json)
- Environment variable (e.g.,
OPENCODE_TOKEN_BUDGET)
- CLI flag (e.g.,
opencode --token-budget 500000)
Use Case
As a developer working on complex, multi-step tasks that require extended context:
- I want to maintain conversation continuity for longer sessions
- Since I'm using my own local resources and API keys, I should be able to configure resource limits
- Different users have different provider limits and use cases
Why This Belongs in OpenCode
OpenCode's philosophy emphasizes flexibility and user control (provider-agnostic, open source, customizable). Allowing users to configure their own resource limits aligns with this philosophy - especially since the computation happens locally on the user's machine with their own API keys.
This is particularly important for developers as extended context windows are often needed for complex refactoring, architecture decisions, or comprehensive code reviews.
Problem
Currently, OpenCode enforces a hard-coded 200,000 token limit per conversation session. When this limit is reached, the session terminates and all context is lost, forcing users to start a new conversation.
For developers running OpenCode locally with their own compute resources and API keys, this restriction feels arbitrary - especially when their providers don't impose similar limits or when they have higher quotas available.
Proposed Solution
Add a configuration option to customize the per-session token budget, allowing users to adjust it based on their needs and resources.
Possible implementation approaches:
~/.opencode/config.jsonor.opencode/config.json)OPENCODE_TOKEN_BUDGET)opencode --token-budget 500000)Use Case
As a developer working on complex, multi-step tasks that require extended context:
Why This Belongs in OpenCode
OpenCode's philosophy emphasizes flexibility and user control (provider-agnostic, open source, customizable). Allowing users to configure their own resource limits aligns with this philosophy - especially since the computation happens locally on the user's machine with their own API keys.
This is particularly important for developers as extended context windows are often needed for complex refactoring, architecture decisions, or comprehensive code reviews.