Repository navigation
Description
Feature hasn't been suggested before.
- I have verified this feature I'm about to request 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 A3BHuihui 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:
-
[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 Claude
Related request for a session context usage view or breakdown. -
Add /context command to display session token usage #10575 — Add
/contextcommand to display session token usage
Related 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 statistics
This PR appears to add acontext_usagetool, but it is closed and does not appear to be available in1.17.13.
feat: new toolcontext_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:
- 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.
Activity
github-actions commentedon Jul 2, 2026
This issue might be a duplicate of existing open issues. Please check:
You've already referenced these in your issue body, which is great. If this is intentionally scoped to Desktop specifically (vs. the TUI), it may still be distinct — please clarify if needed so maintainers can assess.
yooo1999 commentedon Jul 2, 2026
Thanks for pointing this out.
I agree that this request overlaps with both issues, but I believe this issue is still distinct because it is specifically about OpenCode Desktop and the absence of any visible context usage indicator there.
How this differs from #6152
#6152 asks for session context usage similar to Claude's
/contextcommand. That is related, but it appears to be broader and more command/TUI oriented.My issue is specifically about the Desktop UI.
In OpenCode Desktop, I currently do not see:
/contextcommandSo even if #6152 adds a command or improves TUI behavior, Desktop users may still have no visible context information unless the Desktop UI exposes it directly.
The minimal request here is not necessarily a full
/contextcommand. It could simply be a small Desktop indicator such as:How this differs from #11434
#11434 is about showing a tool usage breakdown in the context window. That is also related, especially because tool schemas can consume a lot of context.
However, my issue is more basic and Desktop-specific:
A tool breakdown would be very useful, but it is a second-level improvement. The primary missing feature is that Desktop does not show the user any overall context usage at all.
So the relationship is:
I referenced #11434 because it would be a great enhancement once Desktop has a visible context usage indicator.
Why Desktop-specific tracking matters
The key distinction is that I am using OpenCode Desktop, not only the TUI.
My setup is a local OpenAI-compatible provider backed by
llama-server, using long-context models such as:262144tokensThe local endpoint returns OpenAI-compatible
usagefields, for example:{ "usage": { "prompt_tokens": 8851, "completion_tokens": 38, "total_tokens": 8889, "prompt_tokens_details": { "cached_tokens": 8835 } } }So for this kind of provider, Desktop has enough information available, or at least enough information to show an estimate.
Without context visibility in Desktop, it is hard to know:
Suggested scoping
To avoid duplicating #6152 and #11434, I would scope this issue as:
Optional later improvements could include:
/contextparity with TUI or Claude-style commandsSo I think this issue is related to #6152 and #11434, but not exactly the same. It is specifically about making context usage visible in the Desktop UI, especially for local OpenAI-compatible long-context providers.
GollyTicker commentedon Jul 2, 2026
I'd also highly appreciate this feature! I moved from the TUI to the web UI, since the latter can be used in many other contexts as well (e.g. from phone). But the context as shown in the TUI was missing for me and I'd be very happy to see this!
logari81 commentedon Jul 14, 2026
I also really miss this feature.
github-actions commentedon Sep 14, 2026
To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.
SeriesOfTubez commentedon Sep 14, 2026
Re-open