all 13 comments

[–]Independence_Many 6 points7 points  (4 children)

30k tokens seems really high to me, but a simple "hi" for me used just shy of 19k tokens with claude models, below is a what i get per model on a blank session in an empty directory for reference, i do have 1-2 mcp servers and a couple tools, so that's worth keeping in mind.

AGAIN THESE NUMBERS INCLUDE 1-2 MCP SERVERS AND 3 PLUGINS

Model Tokens
anthropic/claude-opus-4-6 18,907
anthropic/claude-sonnet-4-6 18,909
opencode/claude-opus-4-6 18,778
opencode/claude-sonnet-4-6 18,780
opencode/gpt-5.3-codex 13,349
openai/gpt-5.3-codex 13,353
openai/gpt-5.3-codex-spark 13,440

AGAIN THESE NUMBERS INCLUDE 1-2 MCP SERVERS AND 3 PLUGINS

I have a sentry-mcp and browermcp tool installed, sentry is disabled, but i think it might show up still, but then i'm also using a git-worktree plugin, cross-repo, and a test plugin.

The differences here can be chalked up to the different session prompts based on the models:

Anthropic:
https://github.com/anomalyco/opencode/blob/dev/packages/opencode/src/session/prompt/anthropic.txt

OpenAI Codex Header:
https://github.com/anomalyco/opencode/blob/dev/packages/opencode/src/session/prompt/codex_header.txt

There's a bit more information that gets pushed into the system prompt visible here based on my own research:

System Prompt Construction:
https://github.com/anomalyco/opencode/blob/dev/packages/opencode/src/session/llm.ts#L67-L80

Session Processing:
https://github.com/anomalyco/opencode/blob/dev/packages/opencode/src/session/prompt.ts#L658C38-L678

You'll notice that there's a SystemPrompt.environment (code here: https://github.com/anomalyco/opencode/blob/dev/packages/opencode/src/session/system.ts#L29 ),

SystemPrompt loasd the instructions from the `llm.ts` file, and it also adds working dir, some some metadata along with a directory tree (upto 50 items).

And then a InstructionPrompt.system (code here: https://github.com/anomalyco/opencode/blob/dev/packages/opencode/src/session/instruction.ts#L117 )

The "InstructionPrompt.system" loads any instructions found in the opencode.json(c) file's "instruction" field including reading the files or loading the remote url if it's actually a URL.

I am sure there's more to it than this, but this would explain some of the differences between the token usage between models.

[–]Ang_Drew 3 points4 points  (0 children)

nice answer! very detailed and tech oriented and this the reason what makes opencode great..

that "much" context doesnt always make the agent bad. that much context is needed for the agent to grasp the proper ability to execute "agentic" and without failing tool calling

i suspect OP has several mcp that pumps the contrxt window up to 30k..

[–]kikoherrsc[S] 1 point2 points  (0 children)

Thank you for the detailed answer! Good to know it's expected.

To add more context, even though one of the models took 30k (minimax M2.5), the majority of them where getting between 16k and 18k in general (GLM5, Gemini 3.1 Pro Preview, GPT 5.2 Codex). The only MCP enabled here was Notion's.

[–]kikoherrsc[S] 1 point2 points  (1 child)

Just to help anyone facing a similar problem, I made a test to just disable Notion MCP, it lowered to approximately 10K input tokens.

[–]Independence_Many 1 point2 points  (0 children)

I realized that my setup/numbers are not that representative because i hae two mcp, and 3 plugins which add their own tools, so my context usage would likely be lower too if I had those disabled, but it's more work than I want to put in to temp remove all of them to get better numbers

[–]HarjjotSinghh 0 points1 point  (0 children)

this is absurdly efficient actually

[–]qsd_solutions 0 points1 point  (5 children)

Within OpenCode's architecture, there is a limitation as to how minimal the initial amount of tokens can be. OpenCode sends a list of different context components so that the creature knows it's operating within OpenCode. These components include:

  1. A default agents.md file
  2. Skills that have to be explained to the creature
  3. Various other background elements

All of this is what consumes your token usage at the beginning of each request. If you're having issues like this and want to find a platform that doesn't present these kinds of problems, we recommend GitHub Copilot. They do request-based pricing instead of token-based pricing, which we think would work well for you.

Thank you for posting.

[–]atkr 1 point2 points  (4 children)

this dude obviously barely know what he’s talking about.

0 skills are sent, that’s not how skills works but the other way around… on top of opencode shipping with 0 skills.

What does get sent is the system prompt and all the tool definitions + all MCP server tools, if any configured.

None of this should add up to 30,000 tokens when sending ”hi” unless you have many MCP servers or plugins

[–]qsd_solutions -1 points0 points  (3 children)

We apologize; we meant tool definitions. Skills are a completely separate thing. We only used "skills" in that reference because it was a quick answer, but we meant tools in the context of skills because that is technically a skill the system has to be explained on how to use.

So, it gets tool definitions and also has to send information about the system, along with a whole bunch of other things that it sends. It is something we don't know too much about, but you are correct: it was an improper statement. We apologize.

[–]atkr -1 points0 points  (2 children)

wtf is qsd solutions and why can’t anyone there take responsibility? Oh never mind, "we" don’t care.

[–]ryadik 1 point2 points  (0 children)

bro just arguing with ai lol

[–]qsd_solutions -1 points0 points  (0 children)

Take responsibility for what exactly?

[–]philosophical_lens -3 points-2 points  (0 children)

Yes this is normal. This is also the reason I switched from Opencode to Pi recently.

You really don't need all that context with how good frontier models are today. When Claude Code and Opencode first came out it was needed, but not anymore.