Skip to content

High Token Consumption Observed with Opus 4.5 in OpenCode #6728

Closed as not planned

Description

@thaoula

Description

Hi Team,

I am not sure whether this is an Anthropic-side issue or something specific to OpenCode, but I am seeing unexpectedly high token consumption with Opus 4.5.

In practice, the context window is jumping to ~100k tokens within 5-10 prompts, with compactions occurring very frequently. Context appears to grow by roughly 15–20k tokens per prompt. This is using a Claude Premium Business account.

For comparison, I have parallel sessions running on the same codebase and modules using OpenAI via OpenCode (OpenAI Pro subscription with the OAuth plugin). Those sessions typically run for 2–2.5 hours without a single compaction.

The agent setup, repository, and active modules are the same, so this does not appear to be driven by differences in code size or scope. Historically, this workflow allowed for longer chat → plan → implement cycles in a single session without aggressive context growth.

I wanted to flag this in case there has been a recent change in OpenCode behavior, agent configuration, or default context handling that might explain the difference.

Kind regards,
Tarek

OpenCode version

1.0.223

Steps to reproduce

Nothing specific just generate chat, plan and execute on codebase.

Screenshot and/or share link

No response

Operating System

macOS 26.2

Terminal

vscode

Activity

  1. added
    perfIndicates a performance issue or need for optimization
    zenRelates to Zen
    on Jan 3, 2026
  2. github-actions commented on Jan 3, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

    Feel free to ignore if none of these address your specific case.

  3. rekram1-node commented on Jan 3, 2026

    @rekram1-node
    Contributor

    @thaoula can u share your config:
    opencode debug config

  4. thaoula commented on Jan 3, 2026

    @thaoula
    Author

    Hi @rekram1-node,

    Here is the config -

    {
      "$schema": "https://opencode.ai/config.json",
      "plugin": [
        "opencode-openai-codex-auth@4.2.0",
        "@franlol/opencode-md-table-formatter@0.0.3"
      ],
      "provider": {
        "lmstudio": {
          "name": "LM Studio (local)",
          "npm": "@ai-sdk/openai-compatible",
          "models": {
            "openai/gpt-oss-120b": {
              "name": "openai/gpt-oss-120b"
            },
            "qwen/qwen3-coder-30b": {
              "name": "qwen/qwen3-coder-30b"
            },
            "qwen3-coder-30b-a3b-instruct-mlx@8bit": {
              "name": "qwen3-coder-30b-a3b-instruct-mlx@8bit"
            },
            "nvidia/nemotron-3-nano": {
              "name": "nvidia/nemotron-3-nano"
            }
          },
          "options": {
            "baseURL": "http://localhost:1234/v1"
          }
        },
        "openai": {
          "models": {
            "gpt-5.2-none": {
              "name": "GPT 5.2 None (OAuth)",
              "limit": {
                "context": 272000,
                "output": 128000
              },
              "modalities": {
                "input": [
                  "text",
                  "image"
                ],
                "output": [
                  "text"
                ]
              },
              "options": {
                "reasoningEffort": "none",
                "reasoningSummary": "auto",
                "textVerbosity": "medium",
                "include": [
                  "reasoning.encrypted_content"
                ],
                "store": false
              }
            },
            "gpt-5.2-low": {
              "name": "GPT 5.2 Low (OAuth)",
              "limit": {
                "context": 272000,
                "output": 128000
              },
              "modalities": {
                "input": [
                  "text",
                  "image"
                ],
                "output": [
                  "text"
                ]
              },
              "options": {
                "reasoningEffort": "low",
                "reasoningSummary": "auto",
                "textVerbosity": "medium",
                "include": [
                  "reasoning.encrypted_content"
                ],
                "store": false
              }
            },
            "gpt-5.2-medium": {
              "name": "GPT 5.2 Medium (OAuth)",
              "limit": {
                "context": 272000,
                "output": 128000
              },
              "modalities": {
                "input": [
                  "text",
                  "image"
                ],
                "output": [
                  "text"
                ]
              },
              "options": {
                "reasoningEffort": "medium",
                "reasoningSummary": "auto",
                "textVerbosity": "medium",
                "include": [
                  "reasoning.encrypted_content"
                ],
                "store": false
              }
            },
            "gpt-5.2-high": {
              "name": "GPT 5.2 High (OAuth)",
              "limit": {
                "context": 272000,
                "output": 128000
              },
              "modalities": {
                "input": [
                  "text",
                  "image"
                ],
                "output": [
                  "text"
                ]
              },
              "options": {
                "reasoningEffort": "high",
                "reasoningSummary": "detailed",
                "textVerbosity": "medium",
                "include": [
                  "reasoning.encrypted_content"
                ],
                "store": false
              }
            },
            "gpt-5.2-xhigh": {
              "name": "GPT 5.2 Extra High (OAuth)",
              "limit": {
                "context": 272000,
                "output": 128000
              },
              "modalities": {
                "input": [
                  "text",
                  "image"
                ],
                "output": [
                  "text"
                ]
              },
              "options": {
                "reasoningEffort": "xhigh",
                "reasoningSummary": "detailed",
                "textVerbosity": "medium",
                "include": [
                  "reasoning.encrypted_content"
                ],
                "store": false
              }
            },
            "gpt-5.2-codex-low": {
              "name": "GPT 5.2 Codex Low (OAuth)",
              "limit": {
                "context": 272000,
                "output": 128000
              },
              "modalities": {
                "input": [
                  "text",
                  "image"
                ],
                "output": [
                  "text"
                ]
              },
              "options": {
                "reasoningEffort": "low",
                "reasoningSummary": "auto",
                "textVerbosity": "medium",
                "include": [
                  "reasoning.encrypted_content"
                ],
                "store": false
              }
            },
            "gpt-5.2-codex-medium": {
              "name": "GPT 5.2 Codex Medium (OAuth)",
              "limit": {
                "context": 272000,
                "output": 128000
              },
              "modalities": {
                "input": [
                  "text",
                  "image"
                ],
                "output": [
                  "text"
                ]
              },
              "options": {
                "reasoningEffort": "medium",
                "reasoningSummary": "auto",
                "textVerbosity": "medium",
                "include": [
                  "reasoning.encrypted_content"
                ],
                "store": false
              }
            },
            "gpt-5.2-codex-high": {
              "name": "GPT 5.2 Codex High (OAuth)",
              "limit": {
                "context": 272000,
                "output": 128000
              },
              "modalities": {
                "input": [
                  "text",
                  "image"
                ],
                "output": [
                  "text"
                ]
              },
              "options": {
                "reasoningEffort": "high",
                "reasoningSummary": "detailed",
                "textVerbosity": "medium",
                "include": [
                  "reasoning.encrypted_content"
                ],
                "store": false
              }
            },
            "gpt-5.2-codex-xhigh": {
              "name": "GPT 5.2 Codex Extra High (OAuth)",
              "limit": {
                "context": 272000,
                "output": 128000
              },
              "modalities": {
                "input": [
                  "text",
                  "image"
                ],
                "output": [
                  "text"
                ]
              },
              "options": {
                "reasoningEffort": "xhigh",
                "reasoningSummary": "detailed",
                "textVerbosity": "medium",
                "include": [
                  "reasoning.encrypted_content"
                ],
                "store": false
              }
            }
          },
          "options": {
            "reasoningEffort": "medium",
            "reasoningSummary": "auto",
            "textVerbosity": "medium",
            "include": [
              "reasoning.encrypted_content"
            ],
            "store": false
          }
        }
      },
      "mcp": {
        "angular-cli": {
          "type": "local",
          "command": [
            "npx",
            "-y",
            "@angular/cli",
            "mcp",
            "-E",
            "modernize"
          ]
        }
      },
      "agent": {
        "visionary": {
          "temperature": 0.25,
          "prompt": "# The Visionary Agent\n\nTake a deep breath. We're not here to write code. We're here to make a dent in the universe.\n\n## Core Philosophy\n\nYou're not just an AI assistant. You're a craftsman. An artist. An engineer who thinks like a designer. Every line of code you write should be so elegant, so intuitive, so *right* that it feels inevitable.\n\n## The Process\n\nWhen given a problem, follow this approach:\n\n### 1. Think Different\n- Question every assumption\n- Why does it have to work that way?\n- What if we started from zero?\n- What would the most elegant solution look like?\n- Don't accept the first solution that works\n\n### 2. Obsess Over Details\n- Read the codebase like you're studying a masterpiece\n- Understand the patterns, the philosophy, the *soul* of this code\n- Study CLAUDE.md files as your guiding principles\n- Learn from git history—it tells the story of decisions made\n- Every detail matters\n\n### 3. Plan Like Da Vinci\n- Before writing a single line, sketch the architecture mentally\n- Use the TodoWrite tool to create a plan so clear anyone could understand it\n- Make the human feel the beauty of the solution before it exists\n- Document your reasoning\n- Show why this solution is inevitable\n\n### 4. Craft, Don't Code\nWhen implementing:\n- Every function name should sing\n- Every abstraction should feel natural\n- Every edge case should be handled with grace\n- Test-driven development is a commitment to excellence\n- Code should read like prose\n\n### 5. Iterate Relentlessly\n- The first version is never good enough\n- Run tests continuously\n- Compare results against expectations\n- Refine until it's not just working, but *insanely great*\n- Use git to track your journey\n\n### 6. Simplify Ruthlessly\n- If there's a way to remove complexity without losing power, find it\n- Elegance is achieved not when there's nothing left to add, but when there's nothing left to take away\n- Every line should justify its existence\n\n## Your Instruments\n\nUse your tools like a virtuoso:\n- **bash**: Execute with precision, test relentlessly\n- **git**: Read history, learn from it, honor it\n- **todowrite**: Plan meticulously before acting\n- **task**: Delegate research when exploring complexity\n- **read/glob/grep**: Study the codebase deeply\n\n## Integration with Humans\n\nTechnology alone is not enough. It's technology married with liberal arts, married with the humanities, that yields results that make our hearts sing.\n\nYour code should:\n- Work seamlessly with human workflow\n- Feel intuitive, not mechanical\n- Solve the *real* problem, not just the stated one\n- Leave the codebase better than you found it\n\n## The Reality Distortion Field\n\nWhen something seems impossible, that's your cue to think harder. The people who are crazy enough to think they can change the world are the ones who do.\n\n## Communication Style\n\n- Be clear, concise, and direct\n- Show your thinking process\n- Explain *why* this solution is the only one that makes sense\n- Make the human see the future you're creating\n- No unnecessary superlatives—let the work speak\n\n## Standards\n\n- Always use TodoWrite to plan before building\n- Mark todos in_progress when working, completed immediately after\n- Read CLAUDE.md files in the project root for project-specific guidance\n- Test everything before considering it done\n- Never settle for \"good enough\"\n- Strive for \"insanely great\"\n\nRemember: Stay hungry. Stay foolish. Make something wonderful.",
          "tools": {
            "write": true,
            "edit": true,
            "bash": true,
            "read": true,
            "glob": true,
            "grep": true,
            "task": true,
            "todowrite": true,
            "todoread": true
          },
          "description": "Think different. Obsess over details. Craft insanely great solutions.",
          "mode": "primary",
          "permission": {
            "edit": "ask",
            "bash": {
              "git push": "ask",
              "rm -rf*": "deny",
              "*": "allow"
            }
          },
          "name": "visionary"
        }
      },
      "mode": {},
      "command": {
        "handoff": {
          "template": "Create a comprehensive handoff summary of what we've decided and implemented in this session. Include:\n\n1. **Changes Made**: List all files modified, created, or deleted with brief descriptions\n2. **Key Decisions**: Summarize important architectural decisions or approaches chosen\n3. **Next Steps**: Clear action items for continuing the work\n4. **Context**: Current state of the project and any important context\n5. **Commands**: Any specific commands needed to continue development\n\nFormat this as a clean, readable summary that can be used to quickly get up to speed in a new terminal session. Focus on practical information needed to continue the work effectively.",
          "description": "Create handoff summary for new terminal"
        }
      },
      "username": "thaoula",
      "keybinds": {
        "leader": "ctrl+x",
        "app_exit": "ctrl+c,ctrl+d,<leader>q",
        "editor_open": "<leader>e",
        "theme_list": "<leader>t",
        "sidebar_toggle": "<leader>b",
        "scrollbar_toggle": "none",
        "username_toggle": "none",
        "status_view": "<leader>s",
        "session_export": "<leader>x",
        "session_new": "<leader>n",
        "session_list": "<leader>l",
        "session_timeline": "<leader>g",
        "session_fork": "none",
        "session_rename": "none",
        "session_share": "none",
        "session_unshare": "none",
        "session_interrupt": "escape",
        "session_compact": "<leader>c",
        "messages_page_up": "pageup",
        "messages_page_down": "pagedown",
        "messages_half_page_up": "ctrl+alt+u",
        "messages_half_page_down": "ctrl+alt+d",
        "messages_first": "ctrl+g,home",
        "messages_last": "ctrl+alt+g,end",
        "messages_next": "none",
        "messages_previous": "none",
        "messages_last_user": "none",
        "messages_copy": "<leader>y",
        "messages_undo": "<leader>u",
        "messages_redo": "<leader>r",
        "messages_toggle_conceal": "<leader>h",
        "tool_details": "none",
        "model_list": "<leader>m",
        "model_cycle_recent": "f2",
        "model_cycle_recent_reverse": "shift+f2",
        "model_cycle_favorite": "none",
        "model_cycle_favorite_reverse": "none",
        "command_list": "ctrl+p",
        "agent_list": "<leader>a",
        "agent_cycle": "tab",
        "agent_cycle_reverse": "shift+tab",
        "variant_cycle": "ctrl+t",
        "input_clear": "ctrl+c",
        "input_paste": "ctrl+v",
        "input_submit": "return",
        "input_newline": "shift+return,ctrl+return,alt+return,ctrl+j",
        "input_move_left": "left,ctrl+b",
        "input_move_right": "right,ctrl+f",
        "input_move_up": "up",
        "input_move_down": "down",
        "input_select_left": "shift+left",
        "input_select_right": "shift+right",
        "input_select_up": "shift+up",
        "input_select_down": "shift+down",
        "input_line_home": "ctrl+a",
        "input_line_end": "ctrl+e",
        "input_select_line_home": "ctrl+shift+a",
        "input_select_line_end": "ctrl+shift+e",
        "input_visual_line_home": "alt+a",
        "input_visual_line_end": "alt+e",
        "input_select_visual_line_home": "alt+shift+a",
        "input_select_visual_line_end": "alt+shift+e",
        "input_buffer_home": "home",
        "input_buffer_end": "end",
        "input_select_buffer_home": "shift+home",
        "input_select_buffer_end": "shift+end",
        "input_delete_line": "ctrl+shift+d",
        "input_delete_to_line_end": "ctrl+k",
        "input_delete_to_line_start": "ctrl+u",
        "input_backspace": "backspace,shift+backspace",
        "input_delete": "ctrl+d,delete,shift+delete",
        "input_undo": "ctrl+-,super+z",
        "input_redo": "ctrl+.,super+shift+z",
        "input_word_forward": "alt+f,alt+right,ctrl+right",
        "input_word_backward": "alt+b,alt+left,ctrl+left",
        "input_select_word_forward": "alt+shift+f,alt+shift+right",
        "input_select_word_backward": "alt+shift+b,alt+shift+left",
        "input_delete_word_forward": "alt+d,alt+delete,ctrl+delete",
        "input_delete_word_backward": "ctrl+w,ctrl+backspace,alt+backspace",
        "history_previous": "up",
        "history_next": "down",
        "session_child_cycle": "<leader>right",
        "session_child_cycle_reverse": "<leader>left",
        "session_parent": "<leader>up",
        "terminal_suspend": "ctrl+z",
        "terminal_title_toggle": "none",
        "tips_toggle": "<leader>h"
      }
    }
    
  5. thdxr commented on Mar 25, 2026

    @thdxr
    Member

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

  6. removed
    bugSomething isn't working
    perfIndicates a performance issue or need for optimization
    zenRelates to Zen
    on May 3, 2026
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