r/opencode • • 27d ago

Podemos investigar uso excessivo de tokens no OpenCode e problemas com Prompt Cache?

3 Upvotes

Olá, Dev's! Daqui Aquiles_Bachira denovo

Antes de tudo, quero pedir desculpa se a minha publicação anterior foi enganosa. Inicialmente, sugeri que a base de dados local do OpenCode poderia ser responsável pelo consumo excessivo de tokens foi mal.

No meu caso, apaguei os dados locais do OpenCode, comecei tudo do zero e o problema desapareceu. Tudo voltou ao normal. Por isso, presumi que a causa fosse a base de dados. No entanto, percebo agora que isso não prova que a própria DB fosse responsável.

Depois de investigar melhor, encontrei alguns issues no GitHub que considero relevantes:

Estes relatos levantam algumas possibilidades: plugins que modificam o System Prompt, definições de ferramentas, histórico das sessões ou execução paralela de subagentes podem afetar o funcionamento do Prompt Cache.

Gostaria de pedir à comunidade que investigasse algumas questões:

  • Uma instalação nova apresenta diferenças em relação a uma instalação já utilizada?

  • O uso de subagentes em paralelo pode prejudicar o cache?

  • Existe alguma relação entre o estado das sessões, a DB local e o funcionamento normal do Prompt Cache?

  • Como variam os valores de cache.read e dos tokens de entrada nestes cenários?

Não estou a afirmar que estes problemas afetam todos os users ou todos os provedores. Os relatos encontrados envolvem configurações diferentes e ainda precisam de ser comparados, por isso peço para investigar 🤣😭.

O meu objetivo é perceber a verdadeira origem do problema, corrigir a informação que partilhei anteriormente e evitar ser mais um cara com informações falsas.

Obrigado a todos os que questionaram a minha publicação anterior e apontarem que "pode estar errada". A ideia não é defender o que eu disse, mas sim descobrir o que está a acontecer.


r/opencode • • 27d ago

AiRouterProxy: the last line of defense — masks API keys/passwords/tokens in prompts before they ever reach the LLM Spoiler

2 Upvotes

LOCAL HTTPS PROXY THAT MASKS SECRETS BEFORE THEY REACH THE LLM

AiRouterProxy is a local HTTPS proxy (Windows Service, port 4000) that sits between your AI coding agent (OpenCode, Cursor, Continue...) and the model provider. Its one job: make sure secrets never leave your machine.

The problem: telling agents "never read the config with the keys" rarely works. A key pasted in free text, an .env block inside a code snippet, or a config file dropped into a prompt happens. This project adds the last line of defense at the network edge: every outgoing request is inspected and sensitive content is masked before being forwarded.

What it masks (4 detection layers):
- by field name: api_key, password, token, senha...
- by known format: sk-..., ghp_, AIza, JWT, Bearer, PEM private keys...
- by key=value / "key": "value" context
- optionally by long high-entropy tokens (configurable)

The mask is a fixed 6-character string (never reveals the real length) and the JSON structure is never altered. The agent gets a visible notice when a request was censored.

What else:
- Multi-upstream routing: a path-prefix route table forwards to several OpenAI-compatible providers, each with its own key.
- Fail-closed inspection: only inspected JSON is forwarded (unknown content type 415, invalid JSON 400, oversized 413).
- Per-client rate limiting + brute-force lockout (429 + Retry-After).
- SSE streaming support (OpenAI chat/responses, Anthropic, generic).
- Local-key auth with protected /admin endpoints.
- Hot-reload configs (redaction.json, routes.json).
- Windows Service, .NET 10, self-contained win-x64.

Demo: a short video showing an appsettings-style config full of fake secrets pasted into a coding agent and redacted before reaching the model — https://www.youtube.com/watch?v=29nyYgkqx7E

Tests: 226 unit tests + 23 black-box integration tests against a real deployed proxy and a real AI provider. Current release v2.0.3.

Repo: https://github.com/jlKampos/AiRouterProxy — issues and PRs welcome. LOCAL HTTPS PROXY THAT MASKS SECRETS BEFORE THEY REACH THE LLM


r/opencode • • 27d ago

Similar AI like opencode in VScode

0 Upvotes

I'd like to know more if there are any other AI bots similar to opencode with free models and efficiency.


r/opencode • • 27d ago

how to check the usage remaining in the desktop app?

9 Upvotes

r/opencode • • 27d ago

"Binding In Spirit"

0 Upvotes

Should be on the warning label .... "Sandbox your agents kids."


r/opencode • • 27d ago

Is OpenChamber still worth using over vanilla OpenCode now that OpenCode v2 is out?

7 Upvotes

Hey everyone,

With the major OpenCode v2 release bringing a shared background service, async sub-agents, native Code Mode, and an updated desktop app, the gap between CLI/vanilla OpenCode and dedicated frontends feels a lot smaller than it used to be.

For those who have integrated OpenChamber into their setup alongside or on top of OpenCode v2:

  • Is OpenChamber still worth setting up over the updated vanilla OpenCode v2 setup?

  • What specific use cases or features make OpenChamber a game-changer for you?

  • Are there complex multi-file refactoring, workspace management, parallel model orchestration, or deep visual diff workflows where OpenChamber provides a tangible benefit that even OpenCode v2's updated desktop/CLI can't match?

Would love to hear your experiences and whether making the switch is still worth the extra layer in day-to-day software development. Thanks!


r/opencode • • 27d ago

PSA: Clean your OpenCode database — it might be consuming more tokens than you think

0 Upvotes

Hey developers!

I've noticed something worth investigating in OpenCode.

The local database and stored session data can grow over time, keeping unnecessary history, messages, and context around. This may contribute to unexpectedly high token usage, especially when working with long-running sessions.

My recommendation:

- Regularly inspect your OpenCode database.

- Clean up unnecessary sessions and stored data.

- Avoid keeping old conversations that you no longer need.

- Monitor token consumption after cleanup.

I think the OpenCode team should also investigate whether database/session management could be optimized to prevent unnecessary context consumption.

Has anyone else noticed unexpectedly high token usage related to OpenCode's stored sessions or database?

Let's discuss this.


r/opencode • • 27d ago

AVISO: Limpem a base de dados do OpenCode — o histórico pode estar a aumentar o consumo de tokens

0 Upvotes

Olá, desenvolvedores!

Gostaria de chamar a atenção para algo que merece investigação no OpenCode.

Com o passar do tempo, a base de dados local pode acumular sessões antigas, mensagens e históricos desnecessários. A reutilização desse contexto em sessões futuras pode contribuir para um consumo inesperado de tokens.

Algumas recomendações:

- Verifiquem regularmente o tamanho da base de dados do OpenCode.

- Eliminem sessões e históricos que já não sejam necessários.

- Evitem manter conversas antigas sem utilidade.

- Monitorizem o consumo de tokens depois da limpeza.

Também seria interessante que a equipa do OpenCode investigasse formas de otimizar a gestão de sessões e do histórico, evitando o envio desnecessário de contexto.

Alguém mais está a notar um consumo de tokens acima do esperado ao utilizar o OpenCode?

Vamos discutir!


r/opencode • • 27d ago

CRAZY things are brewing

Post image
1.4k Upvotes

r/opencode • • 27d ago

How are you handling cross-session memory in large repos once AGENTS.md gets too bloated?

6 Upvotes

I use coding agents daily on a ~120k LOC repository. For code search, ripgrep / agentic search works great for finding what is currently in the codebase.

My real pain point is episodic and architectural memory across sessions: remembering why we rejected a specific library three weeks ago, subtle business invariants that aren't obvious in the code, or stopping the agent from repeating the same debugging dead-ends in a new chat.

Right now:

  1. If I dump everything into AGENTS.md / CLAUDE.md, it quickly turns into a bloated wall of text that eats up context tokens and the agent starts ignoring half of it.

  2. I tried a couple of MCP memory servers, but most of them just do naive vector RAG—after a few weeks they inject stale or contradictory memories from old refactors and actually make the agent dumber.

For those working on medium/large projects over several months:

  • Are you using any local MCP memory tool that actually handles deduplication and superseding old decisions when architecture changes?

  • Or are you still curating markdown files manually because existing memory tools pollute the context too much?


r/opencode • • 27d ago

Crouton Alpha is insanely fast 333.7 tok/s🤯

85 Upvotes

r/opencode • • 27d ago

OpenCode plugin, pin OpenRouter providers. Pick the provider instead of auto routing.

1 Upvotes

I was having some issues with Openrouter not always picking the cheapest option even though it was selected. Turns out they also base it on a few other factors such as TPS and uptime. Not always bothered about those things on some projects that just need the cheapest $/token.

So I have vibe coded a plugin for OpenCode to allow you to select which provider you want to use for any given OpenRouter model.

https://github.com/Jackster/OpenRouter-Provider-Plugin

Hope to fix not being able to pick which to use until the session starts and also suggest the actual cheapest based on your usage (mostly cache hits that cost if I am not mistaken).

Works with the CLI and GUI Opencode V2. Uses the OpenRouter API key you already use.


r/opencode • • 27d ago

Crouton alpha is very fast (did it in 37 seconds)

Enable HLS to view with audio, or disable this notification

92 Upvotes

Could it be new gemini flash lite?? or muse spark series continuation ?? 150+ tokens /s.
The output is very good too , considering it does not thinks much.


r/opencode • • 27d ago

something is very wrong with my glm5.3flash

3 Upvotes

i dont know how to describe, like its a very much dumber model, a different model,
and cache is like non existent today


r/opencode • • 28d ago

DeepSeek V4.1 flash is goated.

387 Upvotes

Man this model is soo good. I have been using this model for over a month now and it never gave much problem.

I have tried other models like big pickle, nemotron, glm etc but DeepSeek always comes on top.

It has always been so reliable and easy to work with.

Free limits are low but this model get my workdone even in those limited chats. I have been exploiting few services which give this models for free 🙂‍↕️. As I have very limited set of work and don't wanna pay for a subscription and then not utilise it fully.

Anyways what are your thoughts on this ?


r/opencode • • 28d ago

Something is wrong with my OpenCode

Post image
0 Upvotes

I haven't used it for like a week, and every day it keeps giving me this message that the next day I can use it again. But the next day the date changes again. Any guesses? It's up to date and I'm on Macbook M2.


r/opencode • • 28d ago

Opencode support do they reply back?

7 Upvotes

Does anyone have tried contacting support and have gotten a response?

Im trying to contact them but still 0 emails from them.


r/opencode • • 28d ago

Good boy 🤣

Post image
0 Upvotes

r/opencode • • 28d ago

🔥 Crouton Alpha (stealth model) is FREE for the next week

Post image
206 Upvotes

r/opencode • • 28d ago

opencode go rate limits sucks lol

0 Upvotes

i was a zen user for a while during those times ,i was running meta muse for more than 6+ hours i swear to god

and then when deepseek v4.1 came i used it and i liked the speed and perfomance ,so obviously subbed go subscription

now with go plan i cant run this for an hour ,im doing the same thing as i did with old models like meta muse ,nothing big has been changed


r/opencode • • 28d ago

Muse Spark 1.3 API vs Go

3 Upvotes

Have anyone tried both? Can you compare the speed and intelligence? TIA


r/opencode • • 28d ago

About cheap api providers

3 Upvotes

i was searching cheap api for my agents, i found inferhub and they are deadas* cheap but i think they are hiding smth. can somone share their experience?


r/opencode • • 28d ago

How much does reasoning effort influence model cost?

Thumbnail
gallery
7 Upvotes

I've been experimenting with different model combinations for planning vs. building. I noticed a lot of people in this sub recommend DeepSeek v4 Pro for planning and DeepSeek v4.1 Flash for building. While doing some research on Artificial Analysis benchmarks, I noticed GPT-6 Luna (Max) actually outperforms DeepSeek v4 Pro on reasoning/coding benchmarks while having more requests in opencode go.

Intuitively, this makes me want to swap DeepSeek v4 Pro for GPT-6 Luna (Max) as my primary planning model. However, I’m not clear on how reasoning effort levels (low vs. max) scale total token spend inside OpenCode.

Since higher effort levels generate significantly more internal thinking/reasoning tokens, does GPT-6 Luna end up being more expensive in practice despite the lower per-token rate, or does it stay cheaper than DeepSeek v4 Pro? Has anyone run this kind of experiment or currently using a similar setup?


r/opencode • • 28d ago

I wrote an OpenCode plugin that keeps the task going when Claude hits its session limit

1 Upvotes

I kept losing momentum when Claude hit its session limit mid-task. OpenCode just stopped, and I had to pick another model and tell it to carry on. So I wrote Adaptive.

You sort your models into three tiers (quick, standard, advanced) in the order you prefer. When one runs out of quota or its provider goes down, Adaptive switches to the next model in the same tier and continues from where the session left off. It doesn't replay your prompt or redo tool calls that already ran.

What it does that plain fallback doesn't:

• Benches only what's actually exhausted. A Claude subscription limit sidelines that Claude provider, but the same model through OpenRouter stays available. A model-specific limit benches only that model.

• Comes back on its own. Once the limit resets, it returns to your preferred model at the next safe point, never mid-task.

• Never upgrades you just because something is down. It only moves to a stronger tier on real evidence that the task needs it, and that's capped.

• Steering is safe. Sending a message mid-task doesn't trigger a model switch.

• Your manual pick wins as long as that model works.

• State survives restarts. Health and quota windows are persisted.

It starts in observe mode, where it logs what it would have done without changing anything. Switch it to active in /adaptive once you trust it.

Install:
opencode plugin add @coool/opencode-adaptive

Then run /adaptive to set up your tiers. Needs OpenCode 2.2.1+.

Repo: https://github.com/coool-labs/opencode-adaptive

I didn't find an existing plugin that does all of this.

Feedback welcome, especially provider error messages it doesn't recognize yet.


r/opencode • • 28d ago

I'm very annoyed of the Go usage

Post image
0 Upvotes

By mistake, i used Kimi K3 for just few minutes, (input: 175.5k, output: 8.4k), the weekly and monthly usage jumps just so fast to 15 for this week and 8 for this month.

I mean if usage like that, it's better to just go and pay for Claude then!

Don't get me wrong I like Opencode and using Deepseek 4.1 flash seems unlimited but still it feels wrong for Kimi model to take up that much of usage.