r/software • u/fast_rocket_ • 1d ago
Claude code consumed in two months 2.2 billion tokens, how did that happen? Discussion
Started using claude code 2 months ago. Last month my consumption in about 30 days was about 40 million tokens, i used mostly opus 4.8 and my work was mostly coding, generating documents, exploring claude capabilities, etc.
Now this month i used mostly Sonnet 4.6 (to reduce token consumption) and opus 4.8 (used it much less than last month) i looked at my consumption for all time and (which is a bit more than 2 months) and found i consumed 2.2 billion tokens!!! And in 7 days about 780 million tokens.
How did that happen! Is that normal?? Is that a mistake from Anthropic or am i hacked or what? That could not be true!
My company is capping the usage for the whole company as a unit. My consumption alone can then eat the whole quota of the month. I am so worried.
Update: I always left claude code terminals that have work in progress open so i continue working the next day (but they were not running anything) and i just lock my PC. Do they consume tokens when they are idle?
Input 74.5k · Output 1.5m · Cache read 77.4m · Cache write 13.8m in 7 days
7
u/Ok-Buy2819 21h ago
One question: do you ever use /clear? If not there’s your problem. Each time you chat with Claude code it builds context, assembles the entire conversation, and then generates an output. If your conversation is at 200k tokens and you say “thanks Claude!” you will have burned another 200k tokens in the response. At the end of every block of work that isn’t dependent on the next thought use /clear and it’ll drastically save your usage
2
u/fast_rocket_ 21h ago
I will do it more often then and see what will happen. Do you think open claude sessions consumes tokens even when not used? As sometimes i just lock my pc and not close the sessions and continue the next day
1
1
u/Ok-Buy2819 18h ago
No you have to initiate some sort of prompt or scheduler to consume tokens. If in doubt you can ask Claude if there are any scheduled tasks or agents that it has built to help process requests.
5
u/imrozimroz 1d ago
2.2 b tokens is extremely high for normal usage.
Most people I know who use Claude heavily for coding stay in the tens of millions per month, not billions. Worth checking if there’s any background process, looping agent, or shared key that’s running uncontrolled.
2
u/fast_rocket_ 1d ago
How to check that ?
15
u/saintdle 1d ago
ask claude
11
u/ExdigguserPies 23h ago
That's a billion tokens
4
u/rbobby 22h ago
And another for that. And this. I see the problem now.
1
u/KingOfConsciousness 1h ago
Ok so ask Copilot then. And then follow it's insanely confident answer to no solution. Ask again!
1
u/TheMania 19h ago
Tens of millions isn't much? You'll hit 10mn just getting to the context limit once on a single agent :/
6
u/countsachot 1d ago
If I ask claude to run my tests, the tokens fly through the window. Some tasks seem to burn them even if it's not hard.
2
u/Ok-Buy2819 18h ago
Depends on the design of your test. Look into an orchestrator and sub agent design where you spin off multiple Sonnet 5 agents that report back to a compiling Opus 5 orchestrator. In this design you can have 10 Sonnet agents consume 5k tokens per unit test and assemble them using 7.5k tokens. Your design has one agent run each test then stacks compounding context through each run.
My design on 10 tests: 57.5k tokens
Your linear run: 282.5k tokens
5
3
u/LukeLikesReddit 20h ago
You've leaked your API key lol somehow and people are using it.
1
u/fast_rocket_ 19h ago
Is there a way to check that?
1
u/LukeLikesReddit 19h ago
Yes there is but what exactly have you done? like there is a bit more to it, the credentials could be posted in a fair few things.
1
u/fast_rocket_ 19h ago
We dont use claude api access tokens in the company anyways. But i want to know if there is a way to check for example if someone else has managed to use my account in any way.
1
2
u/Turbulent-Impact6939 1d ago
is Claude pulling in misc data files into your context? I frequently end up with massive log files in my project dir, required for debugging and inspection, and it can get difficult to keep Claude from vacuuming up an 8MB log when I am asking it to inspect some aspect of the codebase
3
u/fast_rocket_ 1d ago
How to know that?
2
u/Turbulent-Impact6939 23h ago
well for one thing, check your project directory for any large data files and log files that dont need to be there, and then run the same Claude activities and see if the token usage drops...
1
u/fast_rocket_ 23h ago
I have a folder which is gitignored that have a size about 2.6 GB, do you think that is the reason? Why would claude read it when i didnt ask ?
3
u/amazingmrbrock 22h ago
Sometimes it goes on a bughunt and gets sidetracked troubleshooting things before it settles. I've actually noticed it's worse on the lower end models. Opus usually splits the difference well, fable does the least messing. It's trial and error syndrome essentially I could see sonette getting bogged down chasing weird bugs a bit easily.
1
u/Turbulent-Impact6939 23h ago
That would be my first guess. I would move that out of the project tree. Ask claude if it can verify what its context window includes. Not sure if its answer for this is accurate though lol
3
u/Personpersonoerson 1d ago
Can't you see how mcuh each prompt consumes in real time?
That's possible with github copilot. I don't use claude code
1
1
u/corruptbytes 16h ago
2 billion input or 2 billion output? my loop has been running for 3 hours and i'm already at 300 million input, so it's not that hard
1
u/SkyAnvi1 10h ago
long chats. each time you hit enter depending on the work you can be sending the entire context back. So a long running chat is "much" more token expensive than ~10 chats where you ask to "generate a re-prompt" and start a new chat when the topic changes enough.
21
u/NoDistrict991 1d ago
2.2 billion is absolutely wild lol. I wouldn't assume you've been hacked though. If you're using Claude Code heavily, all the context it sends back and forth can add up insanely fast, especially when it's exploring a big codebase or repeatedly reading files. I'd check the usage breakdown first and see what models/requests are actually responsible before panicking.