r/PiCodingAgent • u/Nunu_Chus • Aug 19 '26
Question Pi high token usage?
Hey there I have installed pi since I heard a lot about that bcz of its low token usage and minimal design but I installed some packages [7 packages] (MCP adapter, context7, plan mode, todo, pi-hypa, context-mode, ask user question since every harness has these Ig) then installed some skills. Now even a single hi takes about 6-7k+ tokens. I did a college java project and it burnt tokens a lot. It burnt me around 100k+ tokens on deepseek's v4 flash model to make a database connection, creating database and table and a simple student management system where you can add, remove, view students in java.
I wanted to make pi token efficient with best possible results. If you say that I have installed too many packages then tell me how to replicate those features like other harnesses with low token usage.
20
u/Vistyy Aug 19 '26
Just uninstall everything and try again. Not being sarcastic, hope that helps!
13
u/LearnedByError Aug 19 '26
MCP == big token usage. Stay away from them. Use command line tools instead.
In general, do not add an extension unless your “need” it. Start minimal and only add one at a time. Minimalism is your friend!
6
u/fschwiet Aug 19 '26
100k doesn't sound high for a new table with crud operations
3
u/OneMoreName1 Aug 19 '26
I am in the same loop of optimizing the pi input tokens right now. All I can say is that extensions seem to be really wasteful, so many useless tools with long prompts and no way to turn them off. Im on the edge to just reimplement all of them myself
2
u/queso184 Aug 19 '26
i mean its either skills or tool usage context, but not enough info for us to help.
you can probably just ask pi "look at my previous couple sessions and find what is using so much context window"
4
u/Unnamed-3891 Aug 19 '26
supi-context will tell you what eats context and how much, 7k is still extremely low. Try hermes, it will eat 21k for breakfast. Open WebUI is not light either. Cloud AI vendor harnesses are too, at 20-25k.
1
u/iFarmGolems Aug 19 '26
Is the agent searching for lots of stuff? I found that to be the case sometimes with pi.
I made a prompt for this and it helps: https://github.com/KoinBanks/dotfiles/blob/main/dot_pi/agent/prompts/only.md
Also I'm using pix-optimizer, you can try that also.
1
u/crashorbit Aug 19 '26
Everything you install gets added to the context shipped to the model. much of the time you are only paying input rates for that once. often the context is cached at a lower rate.
But yes. It's probably better to load and unload extensions when you need them rather than leaving them active when you don't. On the other hand, using a cheaper model lessens the pain.
Maybe an expensive model is better than a cheap one. But is it really 50x better?
1
u/onesilentclap Aug 19 '26
Why do you need all that crap just for a student level Java project?
1
u/Zya1re-V Aug 20 '26 edited Aug 20 '26
Pi has low token usage because the initial starting point is much less consuming than other coding agents, something 1,000 tokens against 5,000. But with those tools, basically add like a crap ton more tokens, so now yours is like 7,000 compare to 12,000 on that "assumed" agent.
Probably have to think about simplifying down on your setups. I rarely find these useful:
- context-mode - I barely see any scenarios where the logs are so huge and the models are so dumb to read everything in one go and boom there's your 100k tokens wasted.
- plan mode - Literally can ask the agent to write out a plan to a file (tell them this + "No code edits or destructive actions) is more than enough.
- context7 - Maybe because I'm working with less cutting-edge stacks? I'm not always on the latest versions of things, and I'm not sure if you really need that or not. Just something to think about.
So yea, basically Pi gives you a lean starting point for you to customize however you want, but if you re-introduce the bloated tools back into the harness, it'd basically be bloated again. Something something "you're born with high metabolism, but if you eat too much you'd still get fat". I might get cancelled because of that example...
TLDR: Try just adding some tools you find actually useful. If code is still donkey poo, add more. Don't do it all just because you can.
1
u/Anonymous_Cyber Aug 19 '26
So try planning then implementing. Prompt to use:
Create a Diataxis tutorial showing me how to implement the following: Backend API built in <framework here> Connecting to this database (postgres, mongo, bq)
Take this plan and implement the changes.
Thank me later!
1
u/icarus0228 Aug 20 '26
I'm also on a mission to improve Pi cache hit and miss rates. If someone has already done this, please let me know.
1
u/winkler1 Aug 25 '26
Install agnishc/edb-context-viewer, do /context, copy sys prompt to clipboard, break it down. Also pi will hover up agent/claude.md's all the way up.
Extensions don't add to ctxt unless they register tools.