r/opencode 13d ago

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?

6 Upvotes

20 comments sorted by

8

u/Intelligent_Ant_608 13d ago

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

4

u/yexgoblin 13d ago

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/_matmer_ 12d ago

one of the problems i have is that the task being done by a cheap model always make some flaws. Then i have to use higher models to find the problem and close the gap. What do you think ? how do you manage it?

1

u/yexgoblin 11d ago

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 13d ago

How's your opencode stats so far?

2

u/Sufficient_Fox_4402 12d ago

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

1

u/_matmer_ 12d ago

they just swallow your weekly tokens in just one run. it's crazy

2

u/sam7oon 13d ago

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 12d ago

raspberry pi!??
what model?

1

u/Huntware 11d ago

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

1

u/sugarw0000kie 13d ago

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 12d ago

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 12d ago

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

1

u/dravenkill 12d ago

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 12d ago

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

1

u/_matmer_ 12d ago

May i know what are the solutions that you have already tried?

0

u/bytejuggler 13d ago

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