Aider-AI / aider

aider is AI pair programming in your terminal
https://aider.chat/
Apache License 2.0
20.95k stars 1.94k forks source link

Repeated Cost Addition on Interrupt (Ctrl-C) in Aider-Chat Sessions #1784

Closed tommypowerz closed 2 weeks ago

tommypowerz commented 4 weeks ago

Issue

When using Aider-Chat, I noticed a bug related to session cost calculation. If I interrupt the AI processing by pressing Ctrl-C before it finishes its response, the cost of the last message is repeatedly added to the total session cost. This occurs each time I attempt to interrupt and restart the process, leading to inflated and inaccurate session costs.

Steps to Reproduce:

Start a session in Aider-Chat. Send a message and let the AI start processing. Interrupt the processing by pressing Ctrl-C before it finishes. Repeat the process of interrupting and sending new messages.

Thank you for looking into this issue!

Version and model info

Aider v0.57.1 with model o1-preview

fry69 commented 4 weeks ago

Thank you for filing this issue.

Just to clarify:

The costs for the request happened the second you pressed return and send the request to the LLM. If you interrupt the processing, you only signal that you are not interested in receiving the reply, but the costs for the request and the reply will be billed. That is how LLMs work.

Due to that cost calculation might be inaccurate the second you interrupt the request, as you will not receive the reply with the actual cost. There may be a bug where aider will take the cost of the last reply instead, I will look into this.

But consider all session cost data bogus the second you press Ctrl-C.

paul-gauthier commented 2 weeks ago

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