Anthropic API error - too many large screenshots by agent?

Hi Replit team,

I keep hitting this Anthropic API error when using the AI agent after a long conversation:

“messages.1.content.100.image.source.base64.data: At least one of the image dimensions exceed max allowed size for many-image requests: 2000 pixels”

From what I can tell, there are two issues:

  1. The AI agent appears to be re-sending a screenshot for every previous message in the conversation history. After 50+ exchanges, that’s 100+ images in a single API request, which triggers stricter image size limits on all of them.

  2. Screenshots from the preview pane are being sent at full resolution without being resized, so they often exceed Anthropic’s 2000px limit for many-image requests.

The only workaround right now is to start a fresh chat each time the conversation gets long, which breaks the flow of development.

Two fixes that would solve this:

  • Resize/compress screenshots to under 2000px before sending them to the API
  • Stop including screenshots from old messages when constructing the API request — only the most recent screenshot(s) are needed

Happy to provide more details if helpful. Thanks!