fix: reduce image resize limit to 2000px for many-image requests (#615)

Co-authored-by: Letta <noreply@letta.com>
This commit is contained in:
Charles Packer
2026-01-21 10:50:27 -08:00
committed by GitHub
parent 5635156b51
commit 8c118f0540
2 changed files with 5 additions and 5 deletions

View File

@@ -236,7 +236,7 @@ const UTI_TO_MEDIA_TYPE: Record<string, string> = {
/**
* Import image from macOS clipboard, resize if needed, return placeholder.
* Uses temp file approach to avoid stdout buffer limits.
* Resizes large images to fit within API limits (2048x2048).
* Resizes large images to fit within API limits (2000x2000).
*/
export async function tryImportClipboardImageMac(): Promise<ClipboardImageResult> {
if (process.platform !== "darwin") return null;

View File

@@ -2,10 +2,10 @@
// Follows Codex CLI's approach (codex-rs/utils/image/src/lib.rs)
import sharp from "sharp";
// Conservative limits that work with Anthropic's API (max 8000x8000)
// Codex uses 2048x768, we use 2048x2048 for more flexibility with tall screenshots
export const MAX_IMAGE_WIDTH = 2048;
export const MAX_IMAGE_HEIGHT = 2048;
// Anthropic limits: 8000x8000 for single images, but 2000x2000 for many-image requests
// We use 2000 to stay safe when conversation history accumulates multiple images
export const MAX_IMAGE_WIDTH = 2000;
export const MAX_IMAGE_HEIGHT = 2000;
export interface ResizeResult {
data: string; // base64 encoded