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.
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.
| Limit | Value |
|---|---|
| Images per request | 4 |
| Per image | 4 MiB and 16 megapixels |
| All images, decoded | 8 MiB total |
| Formats | PNG, JPEG or WebP |
| Tokens per image | Capped 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
- Detect a new video model on Sume: a Python diff of /v1/videos/models
Grok Imagine 1.5 Lite is on xAI's price table, not Sume's. A short Python script diffs GET /v1/videos/models against a saved list to flag new ids.
- Edit a video with a prompt API: Python script for Omni Flash 1.1
Send a clip and a sentence to POST /v1/video-router/generate with gemini-omni-flash-1.1 and video_url, poll the job, read the result. Stdlib Python.
- Effect 4.0.4 retryTransient honors Retry-After: key your Sume submit
Effect 4.0.4 makes HttpClient.retryTransient honor Retry-After, so a Sume 429 waits as told. It also retries POST on 5xx, so send an Idempotency-Key.
- Which fps to set: TikTok 23-60, YouTube list, Sume's 24/25/30/60
Sume Timeline fps can be 24, 25, 30 or 60, and every one is in TikTok's 23 to 60 window and on YouTube's list. Leave fps unset to match your sources.
Written by Sume