Clef image limits: 4 images, 4 MiB, 16 MP before an image-to-video job

Clef accepts up to 4 PNG, JPEG or WebP images, 4 MiB and 16 megapixels each. Pre-check a reference frame against those limits before you pay for a render.

4 min readSume
All posts

Clef takes up to 4 images per request, each at most 4 MiB and 16 megapixels, 8 MiB total decoded, in PNG, JPEG or WebP. Those are the numbers on Cloudflare's model page, and they are the reason a reference-image gate fails: a large phone photo can exceed the limit before the model reads a pixel. Resize or reject first, then ask your question.

Limits table

Each image is also capped at 1,024 tokens, which bounds what an image can add to the 65,536-token context.

Clef image input limits, Cloudflare Workers AI read 2026-10-13
LimitValue
Images per request4
Per image4 MiB and 16 megapixels
All images, decoded8 MiB total
FormatsPNG, JPEG or WebP
Tokens per imageCapped at 1,024

A pre-check

Test size and type locally, so the failure is yours and cheap. This function returns a reason or None.

import struct

def reject_reason(data: bytes) -> str | None:
    if len(data) > 4 * 1024 * 1024:
        return "over 4 MiB"
    if data[:8] == b"\x89PNG\r\n\x1a\n":
        w, h = struct.unpack(">II", data[16:24])
    elif data[:3] == b"\xff\xd8\xff" or data[8:12] == b"WEBP":
        return None  # decode with your image library to count pixels
    else:
        return "not PNG, JPEG or WebP"
    return "over 16 megapixels" if w * h > 16_000_000 else None

if __name__ == "__main__":
    print(reject_reason(b"\x89PNG\r\n\x1a\n" + bytes(8) + (5000).to_bytes(4, "big") * 2))

Then Sume

The 16-megapixel figure is Cloudflare's, not Sume's. For what Sume accepts as an input image, read the page for the route you will call; Sume's own errors for unreachable media are documented as image_not_fetchable and input_media_unreachable on the errors page.

Sizing images instead of rejecting them

Rejecting is simplest, but a downscale is friendlier: resize the longest side until the file is below 4 MiB and the area is below 16 megapixels, convert to PNG, JPEG or WebP, and send the smaller copy to Clef. Keep the original for Sume, since the gate only needs enough detail to judge the frame.

If you send four images, remember the 8 MiB total decoded limit as well as the per-image limit.

  • Send Clef a small copy.
  • Send Sume the original.
  • Count the total across images.

Sources

Related posts

More in Developers

All Developers posts

Written by Sume