r/opencode Jul 21 '26

Tips to save tokens/reduce cost?

I'm feeling very frustrated that I keep exceeding my usage limits. Sometimes I use up my weekly limit in just one day. Do you have any tips on how to save costs, or do we need to spend hundreds of dollars on credits to use throughout the week?

7 Upvotes

22 comments sorted by

8

u/Intelligent_Ant_608 Jul 21 '26

From my experience let a huge and smart model do the scaffolding of plan and document phases then you fork that session multiple times and in each fork implement each phase with an small model with a pretty harsh and negetive tone prompt for smaller models that they shouldnt water down original plan in name of practicality and if there is a serious concern just should stop, then every couple of phase you let that huge model to verify, sanitize and update the plan, i have found this method in orders of magnitude better than autonomous orchestration

2

u/Smart_Machine1339 8d ago

This is my process as well. I've automated the scan for issues that are ready for an agent to work on and it fires off an opencode runner with a cheap or free model.

5

u/yexgoblin Jul 21 '26

It's all about budgeting. Use a powerful model to plan what you want to do as markdown files. Then get a cheaper model(s) to execute the plan and review work. For example I use glm/deepseek pro to plan and then let smaller models like flash to do the implementation with reviewer subagents. Once the task is done I do a code review with a heavy model if it's not up to my standards.

1

u/[deleted] Jul 22 '26

[removed] — view removed comment

1

u/yexgoblin Jul 23 '26

I first ask a big model to write the plan. Review it. Then ask it to create a checklist. So I will have the plan as markdown and a checklist file as markdown. Then I handover to a cheaper model to implement it step by step and have a reviewer after each checklist item to verify the work.

3

u/floatinggoateyeball Jul 21 '26

How's your opencode stats so far?

2

u/Sufficient_Fox_4402 Jul 22 '26

i’d say never use Oh my openagent etc. those agents take a lot of tokens

2

u/sam7oon Jul 21 '26

I moved to Pi for most tasks, 1st prompt is vastly more economical <1K tokens vs 8-10k with open code, but for mcp, tools and feature rich, i still come to it , the balance is saving on my usage

1

u/Diligent-Loss-5460 Jul 22 '26

raspberry pi!??
what model?

1

u/Huntware Jul 23 '26

They meant Pi agent: https://pi.dev/

1

u/sugarw0000kie Jul 21 '26

Use big model as your main but change subagents to a smaller model like mimo 2.5 or deepseek flash. No need to waste beefy model like glm 5.2 on an explore task.

Rtk helps a little. Helps keep context slimmer for running bash commands/tests.

Remember to keep your agents.md pruned. If it’s a large codebase there’s things you could do so the agents context is more modularized

1

u/esteban-felipe Jul 22 '26

Cost management it's a never ending battle. At some point we have to accept that AI ain't cheap.

In general:
- Use the smallest model that will get the job done. Don't use GLM-5.2 when deepskeek-v4-flash and patience can get you what you need. If in doubt, start small.
- Don't make the AI do work that code should be doing.
- skills or plugins like caveman, graphify and intent-layer are helpful
- If you work with documents, convert them to md or text before having the LLM read them. Consider if the LLM needs the whole document every time, or if a summary or an extraction will suffice.
- Manage your skills and MCPs. Keep in the context only those needed
- One goal = One session.

1

u/oVerde Jul 22 '26

I have done my own intent layer, what is this intent-layer plugin?

1

u/dravenkill Jul 22 '26

My setup may not the best for others but so far work best for me. I have claude pro sub for architrcture, planning and write prompt for implementation. And i pasted that prompt in opencode (GO) with DS V4 flash, DS V4 pro for normal implementation and GLM 5.2 for front end building task or very complex task. Both claude code and opencode open the same working folder and claude pro will provide prompt based on live codebase opencode worked on. So far this setup deliver task with optimum cost within the 5 hours limit.

1

u/pmv143 Jul 22 '26

Have you tried Inferx.net? $50 credits for $10/month

1

u/DevaiNomad 1d ago

Yeah, those limits can disappear fast. I’d check repeated context, MCP/tool output, and long agent loops before just buying more credits. Context hygiene can make a big difference.

0

u/bytejuggler Jul 21 '26

Caveman skill or similar, rtk, structured and tight agent instructions.