Skip to content

Cap oversized pictures on the OpenAI-compatible wire too (CLIProxyAPI) - #375

Open
default-cybe wants to merge 1 commit into
mainfrom
fix/oversized-images
Open

default-cybe wants to merge 1 commit into
mainfrom
fix/oversized-images

Conversation

@default-cybe

Copy link
Copy Markdown
Owner
  • Root cause: the many-image cap from Leave out oversized pictures once a Claude request holds more than 20 #325 ran only on the anthropic provider type. The hub's Claude models go through CLIProxyAPI (openai type), so nothing was capped there. Hub logs show image dimensions exceed max allowed size: 8000 pixels and ... for many-image requests: 3000 pixels, mostly from subagents that Read full-page screenshots.
  • providers/common.ts capImageSizes: one shared helper, used by anthropic.ts and openai.ts chatMessages. An image over 8000 px a side becomes a note. With more than 20 image + document blocks, an image over 3000 px becomes a note too (on the OpenAI wire, Claude models only). Wire only: stored history keeps the picture.
  • errors.ts: any image dimensions exceed max allowed size 400 is classified image_unreadable, so it goes to the bad-image retry and not to model fallback.
  • browser/manager.ts: a full-page screenshot is also clipped in width at 7900 px.
  • Tests in openai, anthropic and image test files.

The hub's Claude models go through CLIProxyAPI on the openai provider type,
which applied no image size rule, so a Read of a full-page screenshot (pages
13,000+ px tall) failed every later request: "At least one of the image
dimensions exceed max allowed size: 8000 pixels", and in long chats "... for
many-image requests: 3000 pixels" (hub logs 2026-11-02 to 11-11).

- common.ts: capImageSizes, moved from anthropic.ts capManyImages and shared.
  An image over 8000 px a side always goes as a note; with more than 20 image
  and document blocks (vision docs count both), one over 3000 px too. Wire
  only: stored history keeps the picture. The size is read from 4 KB of
  base64 first, 256 KB only for a JPEG with a large EXIF.
- anthropic.ts and openai.ts chatMessages use it; on the OpenAI wire the
  many-image rule applies to Claude model ids only.
- errors.ts: any "image dimensions exceed max allowed size" 400 is
  image_unreadable, so the runner's bad-image retry drops a picture instead
  of falling back across models.
- browser manager: a full-page shot of a page wider than 7900 px is clipped
  in width as well as height.
- Tests: the OpenAI wire for Claude and GPT, a PDF counting toward 20, a
  single 13000 px image, and the 8000 px error in both cliproxy shapes.

Committed-by: Conclave (cliproxy/personal-claude/claude-opus-5-5)

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant