Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Costly message caused by tokens exhausted limits breach for large messages. #1919

Open
guywald opened this issue Oct 4, 2024 · 1 comment
Labels
question Further information is requested

Comments

@guywald
Copy link

guywald commented Oct 4, 2024

Issue

Sent: a costly message with a big file.
Response:

Tokens: 1663k sent, 0 received. Cost: $4.99 message, $9.68 session.

Model claude-3-5-sonnet-20240620 has hit a token limit!
Token counts below are approximate.

Input tokens: ~1,663,395 of 200,000 -- possibly exhausted context window!
Output tokens: ~0 of 8,192
Total tokens: ~1,663,395 of 200,000 -- possibly exhausted context window!

A previously sent message with a larger file resulted in the following error:

BadRequestError: litellm.BadRequestError: AnthropicException - b'{"type":"error","error":{"type":"invalid_request_error","message":"too 
many total text bytes: 9256098 > 9000000"}}'

The different api limits should be considered before sending a message, preventing limits breaching.
Maybe a pre-send validation hook could solve such a scenario.

Version and model info

Aider v0.58.1
Main model: claude-3-5-sonnet-20240620 with architect edit format, infinite output
Editor model: claude-3-5-sonnet-20240620 with editor-diff edit format
Weak model: claude-3-haiku-20240307

@fry69
Copy link
Collaborator

fry69 commented Oct 4, 2024

Thank you for filing this issue.

Please check if those costly messages really got billed. If the API returns an error, those requests should not get billed. Do not trust aider's cost estimation, it is (as stated) not reliable.

Also note that you can (and should) check your token usage before you send a prompt/request with /tokens

@fry69 fry69 added the question Further information is requested label Oct 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants