Skip to content

[FEATURE]:Show context usage in OpenCode Desktop, including for local OpenAI-compatible models #34900

Closed as not planned

Description

@yooo1999

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 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.

Activity

  1. github-actions commented on Jul 2, 2026

    @github-actions
    Contributor

    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.

  2. yooo1999 commented on Jul 2, 2026

    @yooo1999
    Author

    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 /context command. 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:

    • a context percentage meter
    • current token usage
    • context window size
    • a /context command
    • any equivalent context visibility panel

    So 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 /context command. It could simply be a small Desktop indicator such as:

    Context: 8.9K / 262K tokens (3.4%)
    

    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:

    OpenCode Desktop should first show the total context usage for the active session.

    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:

    This issue:
      Show overall context usage in OpenCode Desktop.
    
    #11434:
      Break down how much of that context is consumed by tools.
    

    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:

    • Qwen 3.6 35B A3B
    • Huihui Qwen 3.6 35B A3B
    • context window around 262144 tokens

    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
        }
      }
    }

    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:

    • how close the session is to compaction
    • whether a local provider is reporting usage correctly
    • whether tools, skills, or system prompt are consuming too much context
    • whether a long-running Desktop session is close to overflow
    • when it is time to manually summarize or start a new session

    Suggested scoping

    To avoid duplicating #6152 and #11434, I would scope this issue as:

    Add a visible context usage indicator to OpenCode Desktop, at least showing total used tokens, context window size, and percentage used for the active session.

    Optional later improvements could include:

    So 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.

  3. GollyTicker commented on Jul 2, 2026

    @GollyTicker

    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!

  4. logari81 commented on Jul 14, 2026

    @logari81

    I also really miss this feature.

  5. github-actions commented on Sep 14, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

  6. SeriesOfTubez commented on Sep 14, 2026

    @SeriesOfTubez

    Re-open

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions