-
Notifications
You must be signed in to change notification settings - Fork 10k
Open
Description
Bug
When pasting or reading images that exceed 2000 pixels in either dimension, Anthropic's API rejects the request with:
At least one of the image dimensions exceed max allowed size for many-image requests: 2000 pixels
This happens in two paths:
- Clipboard paste (
clipboard.ts) — images pasted from clipboard are sent raw without any size check - File read tool (
read.ts) — images read via theReadtool are base64-encoded and sent as-is
Reproduction
- Copy a large screenshot (e.g. 2560x1440) to clipboard
- Paste it into OpenCode while using an Anthropic model
- API returns dimension error
Expected Behavior
Images should be automatically resized to fit within Anthropic's limits before being sent to the API. A progressive resize strategy works well: attempt compression first, then resize to fit within 2000px, then reduce JPEG quality, and finally aggressive downscale to 1000px as a last resort.
Environment
- OpenCode latest on
dev - Any Anthropic model (Claude Sonnet, Opus, etc.)
- Any OS (macOS, Linux, Windows)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels