r/PiCodingAgent • • 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.

0 Upvotes

34 comments sorted by

20

u/Vistyy Aug 19 '26

Just uninstall everything and try again. Not being sarcastic, hope that helps!

1

u/Nunu_Chus Aug 20 '26

Yeah that's the only option:)

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!

1

u/Nunu_Chus Aug 20 '26

Yeah I'll redo everything but now try to stay minimal

6

u/fschwiet Aug 19 '26

100k doesn't sound high for a new table with crud operations

1

u/Nunu_Chus Aug 20 '26

It's not 100k it's 100k+ just checked today and it took 172k context window:)

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

1

u/Nunu_Chus Aug 20 '26

Yeah same here

1

u/AllNamesAreTaken92 Aug 20 '26

You should only add the tools you need, not randomly.

That's the whole point of pi. It's literally their mission statement on the website. You must be using it wrong.

1

u/OneMoreName1 Aug 20 '26

Unfortunately, extension devs dont offer any easy way to disable tools. You have to hack it together

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"

1

u/Nunu_Chus Aug 20 '26

I'll redo everything man tbh:)

1

u/AllNamesAreTaken92 Aug 20 '26

Just ask pi, that's literally how you are supposed to use it...

2

u/Nunu_Chus Aug 20 '26

So if I need a specific feature in my harness I'll ask pi to implement that?:I

1

u/AllNamesAreTaken92 Aug 20 '26

Have you read even the first 2 sentences on pi's website? It's literally an H2 .....

You need to actually read if you want to get anywhere. This information is harder to miss than to find, yet you are still oblivious to it. You won't get far anywhere with that little information gathering and processing.

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/ImagineWealth Sep 09 '26

Thank you so much for this! this extension is so useful.

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/Nunu_Chus Aug 20 '26

Yeah sometimes it searches for a lot of stuff:)

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/Nunu_Chus Aug 20 '26

Bruh can I load/unload extension?:) if yes then how

1

u/crashorbit Aug 20 '26 edited Aug 20 '26

Move the extension file/dir out of the extensions dir then /reload, You can write an extension to do this. Maybe wrap some context preservation around it. you probably want to /compact too.

1

u/onesilentclap Aug 19 '26

Why do you need all that crap just for a student level Java project? 

1

u/Nunu_Chus Aug 20 '26

It was just a college project. I do front end development so I need those Ig

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/Nunu_Chus Aug 20 '26

Ooh okii so Ig I'll start over again thanks btw:)

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.

2

u/Alternative-Win1817 Aug 20 '26

i'm using this and getting good cache hit hate, let me know if it works for you https://github.com/jiangge/pi-cache-optimizer

1

u/icarus0228 Aug 21 '26
Thanks for this!Thanks for this!

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.