You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have been using opencode for the last 10 days or so. I can say - intensively. However, till yesterday, not once did I reach a stage where we get out of tokens/out of context window. Even with reasonably big operations - somehow opencode managed to run - most of the times - not even reaching 50% of token size. However, from yesterday - after upgrade to 0.2.3x or so - suddenly, the consumption increased very significantly. Every restart getting exhausted in minutes. In fact, with my claude MAX $200 subscription - never reached its limits. In less than an hour - dramatically I am told that my limit gets reset after 4 hours.
Has something changed? Or problem is at my end?
Raising an issue because - nothing much changed in the way I use - but - I see a dramatic increase in token consumption and context exhaustion.
Just wanted to alert. Close it, if it is not related.
Thanks for the quick response. I will share if it happens. So, no change on that front in code? One difference I can think of is the FigmaMCP that I used. Maybe its output is doing some mischief. Earlier with my Elixir Code - it never crossed 20% - including contexts, tests etc.
I can confirm that token usage/context window usage has dramatically increased. I tried to run the same task in both claude cli and opencode cli - and opencode cli exhausted context window by the time claude cli reached 50%. Earlier it used to be reverse. Something changed.
Neither to hurry you nor cribbing. Just wanted to share the information. Please do not mind.
But, this is not a newly introduced feature. I was dealing with a bigger project (same in elixir, phoenix and liveview) a week before this issue - and - opencode was handling the context beautifully. I mean, it reached a maximum of 50% even with a long conversation. Something changed for sure.
@thdxr@adamdotdevin I'm noticing this also with GitHub Copilot as a provider in particular, across various projects seeing the token limit being hit after a few messages. I think it's probably related to diagnostic messages as I'm debugging some large error logs in both cases
Reacted by Kamil Kseń and Matheus Mortatti Diamantino
in 0.3.16 i filter out only Error diagnostics. we might remove them all together for project level ones but this is a first step
I wanted to add that I’m also seeing extremely high input token usage on a relatively small SvelteKit project, even after adding an AGENTS.md file that excludes node_modules, .svelte-kit/, and build/ folders.
Since last night, I’ve already burned through $20 in usage, which is far beyond what I expected for this project.
Here’s the exact error I’m now encountering on each prompt:
[!ERROR]
{
"data": { "message": "AI_APICallError: input length and max_tokens exceed context limit: 172775 + 32000 > 200000, decrease input length or max_tokens and try again"},
"name": "UnknownError"}
I also pulled my Claude usage logs and saw input token counts regularly in the 160k–172k range, all within minutes:
I’ve tried compacting the session and deleting recent messages, but I’m now completely blocked due to the context limit being exceeded on every request. As a result, I am unable to do anything.
I’d be happy to share my session log privately if that helps with debugging
Yeah it's worth me stating that one of mine was particularly small also which is why I imagined it may be diagnostics related. I'm wondering if there are restrictions around reading very large files or very large logs. Mine had 3-4 normal files, but some large files after a build that may have been picked up, or some long logs.
Reviewing with AI, it said that there are not per file context limitations - I wonder if there should be. If someone has a large pdf or text file that they need to commit in their project that keeps getting picked up, this would be a point of frustration. I understand not everyone would want this, so it might need to be configurable, but I think we could decide on a sensible default considering any good code project shouldn't have code files longer than a certain amount of lines.
Is there anything in place here, and if not, could we put something in place?
Yes, there is something wrong... plain message costs 45k+ tokens... e.g. Kimi K2 is not able work... and is possible somewhere set model provider for OpenRouter?
having context breakdown is good we should have that too
Reacted by Fredrik Averpil, janschlue, aaronweisberg, Mark Jaquith, Mishaa, Wildan Zulfikar, Oskar Szrajer, Tejas Thorat, Lucas Willems, Arhen and 3 more
Activity
thdxr commentedon Jul 12, 2025
can you reproduce a situation where the context window gets big faster than you expect a /share a link?
cvkmohan commentedon Jul 12, 2025
Thanks for the quick response. I will share if it happens. So, no change on that front in code? One difference I can think of is the FigmaMCP that I used. Maybe its output is doing some mischief. Earlier with my Elixir Code - it never crossed 20% - including contexts, tests etc.
cvkmohan commentedon Jul 13, 2025
https://opencode.ai/s/e7oOMJ1y
cvkmohan commentedon Jul 16, 2025
I can confirm that token usage/context window usage has dramatically increased. I tried to run the same task in both claude cli and opencode cli - and opencode cli exhausted context window by the time claude cli reached 50%. Earlier it used to be reverse. Something changed.
Neither to hurry you nor cribbing. Just wanted to share the information. Please do not mind.
thdxr commentedon Jul 16, 2025
i looked through your session (if you open browser console in share page it prints out an object with everything)
i don't immediately notice anything suspicious - you can see in each
step-finishpart it report how many tokens it wrote into the cacheit progressively gets bigger - not sure
thdxr commentedon Jul 16, 2025
ahhh i think the issue is with every edit we include project level diagnostics and you have a lot of them. let me play with this
thdxr commentedon Jul 16, 2025
in 0.3.16 i filter out only Error diagnostics. we might remove them all together for project level ones but this is a first step
ShivaR333 commentedon Jul 17, 2025
Facing the same issue. Burnt through around 800K tokens for just a few edits. Is there any way to remove the diagnostics and start from a clean slate?
adamdotdevin commentedon Jul 17, 2025
@thdxr maybe we make this a flag to disable project diagnostics altogether, but default to errors only enabled
cvkmohan commentedon Jul 17, 2025
But, this is not a newly introduced feature. I was dealing with a bigger project (same in elixir, phoenix and liveview) a week before this issue - and - opencode was handling the context beautifully. I mean, it reached a maximum of 50% even with a long conversation. Something changed for sure.
claidler commentedon Jul 20, 2025
@thdxr @adamdotdevin I'm noticing this also with GitHub Copilot as a provider in particular, across various projects seeing the token limit being hit after a few messages. I think it's probably related to diagnostic messages as I'm debugging some large error logs in both cases
jakubdonovan commentedon Jul 20, 2025
I wanted to add that I’m also seeing extremely high input token usage on a relatively small SvelteKit project, even after adding an AGENTS.md file that excludes node_modules, .svelte-kit/, and build/ folders.
Since last night, I’ve already burned through $20 in usage, which is far beyond what I expected for this project.
Here’s the exact error I’m now encountering on each prompt:
I also pulled my Claude usage logs and saw input token counts regularly in the 160k–172k range, all within minutes:
I’ve tried compacting the session and deleting recent messages, but I’m now completely blocked due to the context limit being exceeded on every request. As a result, I am unable to do anything.
I’d be happy to share my session log privately if that helps with debugging
claidler commentedon Jul 20, 2025
Yeah it's worth me stating that one of mine was particularly small also which is why I imagined it may be diagnostics related. I'm wondering if there are restrictions around reading very large files or very large logs. Mine had 3-4 normal files, but some large files after a build that may have been picked up, or some long logs.
claidler commentedon Jul 21, 2025
Reviewing with AI, it said that there are not per file context limitations - I wonder if there should be. If someone has a large pdf or text file that they need to commit in their project that keeps getting picked up, this would be a point of frustration. I understand not everyone would want this, so it might need to be configurable, but I think we could decide on a sensible default considering any good code project shouldn't have code files longer than a certain amount of lines.
Is there anything in place here, and if not, could we put something in place?
ivanglushko commentedon Aug 5, 2025
This is the issue for me as well, just a simple prompt skyrockets the token usage. Would be nice to see what files / additional info was sent.
raxtor commentedon Aug 19, 2025
Yes, there is something wrong... plain message costs 45k+ tokens... e.g. Kimi K2 is not able work... and is possible somewhere set model provider for OpenRouter?

rekram1-node commentedon Aug 19, 2025
@raxtor seems like the kimi k2 free configuration is off we will investigate
timcreatedit commentedon Sep 10, 2025
I also fully can't use opencode with claude anymore, it often maxes out after my first message.
mrgoonie commentedon Sep 16, 2025
@thdxr I think in
v0.9.5the token count is incorrect:Screenshot: (26.4K for a simple prompt)
But when I open the shared session, it's showing
252 tokens: https://opencode.ai/s/Whzi8BH0thdxr commentedon Sep 17, 2025
do you have any MCP servers enabled? baseline should be around 11k
mrgoonie commentedon Sep 17, 2025
yes, I have a couple ones, is there a way to see how many tokens that the MCP servers are taking?
westito commentedon Oct 10, 2025
MCP-s cost a lot of tokens! I enabled just a few. Figma, jetbrains, and it eats up 52k (20%) tokens!!
Figma use A LOT. I always keep it disabled and enable if I need. This is Claude Code, not OpenCode, but you can see context content there.
rekram1-node commentedon Oct 10, 2025
having context breakdown is good we should have that too
Nindaleth commentedon Dec 18, 2025
@rekram1-node Is there an issue tracking the context breakdown that I could subscribe to? I can't seem to find it.
rekram1-node commentedon Dec 18, 2025
Idk if we do tbh can't find one
github-actions commentedon Mar 27, 2026
To stay organized issues are automatically closed after 90 days of no activity. If the issue is still relevant please open a new one.
fix so webdev:local works reliably from the script (anomalyco#924)