aider
aider copied to clipboard
Show accumulated tokens / cost for the entire session
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.
Or provide the option as a configuration or command line switch.
FYI, this is currently available if you run with --no-stream.
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...
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.
Btw, litellm implements and maintain a table as attribute with the cost of each and every llm. It could be used for that.
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.
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?
Session is for the current invocation of aider. Lifetime cost of the project as an interesting idea, but not currently implemented.
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.