Feature hasn't been suggested before.
Describe the enhancement you want to request
Description
I am using OpenCode Desktop with a local model served through an OpenAI-compatible endpoint, and I cannot see how much of the context window is currently used.
My setup:
- OpenCode version:
1.17.13
- Client: OpenCode Desktop
- Provider: custom OpenAI-compatible provider
- Model backend: local
llama-server
- Models:
Qwen 3.6 35B A3B
Huihui Qwen 3.6 35B A3B
- Context window:
262144
- Endpoint shape:
{
"provider": {
"local-qwen": {
"npm": "@ai-sdk/openai-compatible",
"name": "Local Qwen on Mac",
"options": {
"baseURL": "http://127.0.0.1:18080/v1"
},
"models": {
"huihui-qwen36-35b-262k": {
"name": "Huihui Qwen 3.6 35B A3B via Mac"
}
}
}
},
"model": "local-qwen/huihui-qwen36-35b-262k"
}
The local endpoint returns OpenAI-compatible usage fields, for example:
{
"usage": {
"prompt_tokens": 8851,
"completion_tokens": 38,
"total_tokens": 8889,
"prompt_tokens_details": {
"cached_tokens": 8835
}
}
}
But in OpenCode Desktop, I do not see any visible context usage indicator, percentage, token count, or /context command.
Why this matters
For local long-context models, context visibility is very important.
In my case, the model supports a large context window of 262144 tokens, but OpenCode can still send a large amount of system prompt, tools, skills, and conversation history. Without a visible context indicator in Desktop, it is hard to know:
- how much context is currently used
- when compaction is likely to happen
- whether tool schemas or skills are consuming too much context
- whether a local provider is reporting usage correctly
- whether the session is close to context overflow
This is especially important when comparing OpenCode Desktop with the TUI, Cursor, or other agents.
Related issues / PRs
This seems related to these existing issues and PRs:
Expected behavior
OpenCode Desktop should show context usage for the active session, similar to the TUI.
Ideally, it should show:
- current context tokens
- context window size
- percentage used
- prompt tokens
- completion tokens
- cached tokens, if available
- estimated non-cached input tokens
- breakdown by:
- system prompt
- messages
- tools
- skills
- MCP / provider metadata, if available
At minimum, Desktop should show something like:
Context: 8.9K / 262K tokens (3.4%)
Actual behavior
In OpenCode Desktop, I only see the chat UI and selected model. I do not see context usage, token usage, context percentage, or a /context command.
Suggested implementation
A minimal implementation could display the same context percentage meter that exists in the TUI inside the Desktop chat header or footer.
A more advanced implementation could add a Desktop panel or command that shows a context breakdown, similar to:
Context usage:
- Total: 8,851 / 262,144 tokens
- System prompt: ...
- Tools: ...
- Skills: ...
- Conversation: ...
- Cached tokens: ...
For OpenAI-compatible local providers, OpenCode could use the usage object from responses when available:
usage.prompt_tokens
usage.completion_tokens
usage.total_tokens
usage.prompt_tokens_details.cached_tokens
If exact provider-side token accounting is unavailable, an estimated tokenizer-based value would still be better than no visibility.
Additional notes
I am using a local model specifically because I want long-context local development workflows. Context visibility is one of the main reasons to use OpenCode over other IDE agents, so having this only in the TUI but not in Desktop makes Desktop much harder to use for serious long-running sessions.
Thanks.
Feature hasn't been suggested before.
Describe the enhancement you want to request
Description
I am using OpenCode Desktop with a local model served through an OpenAI-compatible endpoint, and I cannot see how much of the context window is currently used.
My setup:
1.17.13llama-serverQwen 3.6 35B A3BHuihui Qwen 3.6 35B A3B262144{ "provider": { "local-qwen": { "npm": "@ai-sdk/openai-compatible", "name": "Local Qwen on Mac", "options": { "baseURL": "http://127.0.0.1:18080/v1" }, "models": { "huihui-qwen36-35b-262k": { "name": "Huihui Qwen 3.6 35B A3B via Mac" } } } }, "model": "local-qwen/huihui-qwen36-35b-262k" }The local endpoint returns OpenAI-compatible usage fields, for example:
{ "usage": { "prompt_tokens": 8851, "completion_tokens": 38, "total_tokens": 8889, "prompt_tokens_details": { "cached_tokens": 8835 } } }But in OpenCode Desktop, I do not see any visible context usage indicator, percentage, token count, or
/contextcommand.Why this matters
For local long-context models, context visibility is very important.
In my case, the model supports a large context window of
262144tokens, but OpenCode can still send a large amount of system prompt, tools, skills, and conversation history. Without a visible context indicator in Desktop, it is hard to know:This is especially important when comparing OpenCode Desktop with the TUI, Cursor, or other agents.
Related issues / PRs
This seems related to these existing issues and PRs:
[FEATURE]: Show context usage in OpenCode Desktop #5892 — [FEATURE]: Show context usage in OpenCode Desktop
This appears to describe the same Desktop-specific problem: the TUI has a context percentage meter, but Desktop does not expose an equivalent context indicator.
[FEATURE]: Show context usage in OpenCode Desktop #5892
[FEATURE]: Session context usage (similar to /context in Claude) #6152 — [FEATURE]: Session context usage, similar to
/contextin ClaudeRelated request for a session context usage view or breakdown.
Add /context command to display session token usage #10575 — Add
/contextcommand to display session token usageRelated request for an explicit command to inspect context/token usage.
feat: new tool
context_usageto show context usage statistics #9900 — feat: new toolcontext_usageto show context usage statisticsThis PR appears to add a
context_usagetool, but it is closed and does not appear to be available in1.17.13.feat: new tool
context_usageto show context usage statistics #9900[FEATURE]: show tool usage breakdown in context window #11434 — [FEATURE]: show tool usage breakdown in context window
Related because tool schemas can consume a significant portion of the context window.
[FEATURE]: show tool usage breakdown in context window #11434
Context tokens resets to zero with every new action of AI agent. #3982 — Context tokens resets to zero with every new action of AI agent
Related to context/token reporting problems, including local OpenAI-compatible providers.
Context tokens resets to zero with every new action of AI agent. #3982
Context usage count is always 0 for some local openai-compatible providers #423 — Context usage count is always 0 for some local OpenAI-compatible providers
Related to local LLM servers such as Ollama, LM Studio, and OpenAI-compatible local endpoints.
Expected behavior
OpenCode Desktop should show context usage for the active session, similar to the TUI.
Ideally, it should show:
At minimum, Desktop should show something like:
Actual behavior
In OpenCode Desktop, I only see the chat UI and selected model. I do not see context usage, token usage, context percentage, or a
/contextcommand.Suggested implementation
A minimal implementation could display the same context percentage meter that exists in the TUI inside the Desktop chat header or footer.
A more advanced implementation could add a Desktop panel or command that shows a context breakdown, similar to:
For OpenAI-compatible local providers, OpenCode could use the
usageobject from responses when available:If exact provider-side token accounting is unavailable, an estimated tokenizer-based value would still be better than no visibility.
Additional notes
I am using a local model specifically because I want long-context local development workflows. Context visibility is one of the main reasons to use OpenCode over other IDE agents, so having this only in the TUI but not in Desktop makes Desktop much harder to use for serious long-running sessions.
Thanks.