aider icon indicating copy to clipboard operation
aider copied to clipboard

Show accumulated tokens / cost for the entire session

Open mikehearn opened this issue 2 years ago • 8 comments

After using aider for a while, I'd like to know how much I've spent in total, not just for the next message prompt.

mikehearn avatar Sep 21 '23 20:09 mikehearn

Or provide the option as a configuration or command line switch.

harleypig avatar Sep 24 '23 13:09 harleypig

FYI, this is currently available if you run with --no-stream.

paul-gauthier avatar Apr 15 '24 20:04 paul-gauthier

Are there any failsafe to avoid very high costs? I think it would be nice to be able to use "--max-budget=10" to make sure the total cost will never go above $10. I can't be the only one too anxious to try aider on various project because I'm afraid I'm somehow adding a wrong and very large file or codebase etc.

An issue I can envision is the cost being model dependant, adding a way to specify the prompt and completion price would solve it. But I can understand how asking to add 3 arguments can appear scope-creepy...

thiswillbeyourgithub avatar Apr 17 '24 15:04 thiswillbeyourgithub

I think it's desirable to be able to show accumulated cost as you use aider, but probably wouldn't go as far as adding a max budget limit.

paul-gauthier avatar Apr 17 '24 16:04 paul-gauthier

Btw, litellm implements and maintain a table as attribute with the cost of each and every llm. It could be used for that.

thiswillbeyourgithub avatar May 27 '24 07:05 thiswillbeyourgithub

After each LLM response, aider now shows tokens and costs including total cost for the session:

11,491 prompt tokens, 360 completion tokens, $0.039873 cost, session cost: $0.078021

The change is available in the main branch. You can get it by installing the latest version from github:

python -m pip install --upgrade git+https://github.com/paul-gauthier/aider.git

If you have a chance to try it, let me know if it works for you.

paul-gauthier avatar Jul 28 '24 23:07 paul-gauthier

Wow so nice! Does session refer to a time where I launched aider or total for the project overall? I think the notion of price is all the more relevant to multi sessions project. Is there a reason you want to avoid storing the total dollar cost somewhere to keep track over time?

thiswillbeyourgithub avatar Jul 29 '24 06:07 thiswillbeyourgithub

Session is for the current invocation of aider. Lifetime cost of the project as an interesting idea, but not currently implemented.

paul-gauthier avatar Jul 29 '24 16:07 paul-gauthier

I'm going to close this issue for now, but feel free to add a comment here and I will re-open or file a new issue any time.

paul-gauthier avatar Jul 30 '24 17:07 paul-gauthier