kettei-fat and kettei-chub read images as well as text, so you can send photos, screenshots and scanned documents with a decision. kettei-core reads text only.
Put each picture in the request’s images. Mark where it belongs in the context with an anchor: <image:1>, <image:2> and so on. The decisions are then answered with the pictures in view.
usage says how many images were read.
The model reads each picture at no more than 2,097,152 pixels, about 2 megapixels. Shrink a larger picture to fit and send a photo as JPEG, and the request uploads several times faster (Send images fast).
To send images to the Jev-compatible /v1/systemone, put them inside state or a question’s instructions or criteria, as Move from Jev shows.
Send images fast
Much of the time a request with images takes is its upload, and the upload grows with the bytes you send. The model never reads more than 2,097,152 pixels of a picture. A larger file costs upload time and changes nothing the model reads.
A 3840 × 2160 photo of 5.6 MB comes to 1,980 image tokens. So does the same picture at 1920 × 1056 as a 0.37 MB JPEG, which sends a fifteenth of the bytes. A 640 × 480 photo saved as a 0.42 MB PNG is 0.07 MB as a JPEG.
- The size the model reads keeps the picture’s shape within 2,097,152 pixels. That is 1664 × 1248 for a 4:3 photo, 1920 × 1056 for 16:9 and 1440 × 1440 for a square. A smaller picture is read at about its own size. The example’s
-resize '2097152@>'caps the pixels but doesn’t round the sides the way the model does, so the model rounds them. A 3840 × 2160 photo is then read at 2,040 tokens rather than 1,980. - Ask the related questions about a picture in one request. It uploads once.
- Resize a picture once. Keep the file you made, and send it each time you ask about that picture.
- Compress the body with
Content-Encoding: zstdorgzip, as Compression describes. It wins back what base64 adds, about a quarter of the body. JPEG and PNG are compressed already, so it saves no more. - Fewer pixels read faster. A picture under 2 megapixels has fewer image tokens. The model scores them sooner, and they count less towards your tokens a minute. Such a picture also shows the model less, so check the answers on your own labelled rows first.
-auto-orient does that.
Anchors and the context
contextmust be a string.- Each image’s
idis the number in its anchor, from 1 to 64. Eachidappears once inimages. - Every image needs an anchor in the context or a decision’s question or outcomes. Every anchor in the context needs its image; an unmatched anchor in a question is ordinary text.
- An image is shown where its anchor first appears in the context. A later mention of the same anchor is read as text. So you can refer back to a picture, as in “the damage in
<image:2>”, without sending it twice. - Text around the anchors works as in any context. Say what each picture is, such as “Photo of the item as received:” or “Screenshot of the error:”.
Image for question 2: <image:1>. The question keeps its anchor. If several questions refer to the same image, its caption names each question and the image is shown once per read. The numbers refer to the full request’s question order, including when it needs several engine calls. Long outcome descriptions are shown separately; also put their image’s anchor in the question or context.
For example, a picture may belong to one decision while the context describes the whole case:
Limits
Each image is resized to between 65,536 and 2,097,152 pixels. It becomes between 64 and 2,048 image tokens, by its size. Anything of about 2 megapixels or more comes to just under 2,048:
The image tokens count towards the request’s input limit of 65,536 tokens, counted as they are billed. That limit is the same for every model. Nothing is ever cut to fit. A request over that limit is refused with
context_too_long. Rarely, a shorter request gets the same error too. If you see it, send fewer or smaller images.
A request with images can ask as many decisions as one without. The public playground takes no images.
Fallback
With images, the models that fallback tries on/v1/decide are only the ones that read images. So an answer always comes from a model that saw your pictures. kettei-chub may fall back to kettei-fat, and kettei-fat to kettei-chub, but never to a size that reads text only.
/v1/systemone never falls back: the model you name answers, or the request fails with an error that says why. A fine-tuned model reads text only.
Billing
Each image is billed at the image tokens the model reads for it, 64 to 2,048 by its size, as in the table above. The price is that of the model that answers, as for any input token, but a fallback never costs more than the model you asked for.usage.input_tokens counts your text as usual, the anchors included. It adds the image tokens of each image, and nothing else per image. A native image is billed once, however many times the context or questions mention its anchor. The server’s captions add no billed text. Jev’s image forms describe how repeated images are counted there.
usage.images is the number of images, and usage.image_tokens is the image tokens billed for them. They also count towards the model’s input limit.
About 2,000 image tokens for each image means the model read each at its most. If your files are larger than that, they were shrunk after their upload, so send them smaller. POST /v1/decide/estimate takes the same body and quotes it before you send it.
Errors
None of these is retryable. Change the request first.
