state. Some of them also read media parts in state: images, and on some models audio and video. Text-only Decisions requests work the same as before.
Supported models
The catalog records which media each Decisions model accepts, so browse the Models page or query the Models API withoutput_modalities=decisions and the input_modalities you need:
architecture.input_modalities in the response lists what it accepts. Passing several input_modalities values as a comma-separated list (for example input_modalities=image,audio) returns only models that accept all of them.
Quickstart
Encode an image as base64 and put it in thestate array as an image_url part, next to any text:
Image part format
An image is an item of thestate array with this shape, the same image part Chat Completions uses in message content:
urlmust be a base64 data URL with the typeimage/png,image/jpeg, orimage/webp. Jev accepts onlyimage/pngandimage/jpeg. Remotehttp(s)URLs are not fetched.detail(auto,low, orhigh) is accepted, but Clef, Clef Flash, Clef Omni, and Mercury Decide ignore it.- Put image parts directly in the top-level
statearray. Only Jev reads image parts in other places (see Image positions on Jev); on every other Decisions model, an image part nested inside astateobject or placed in a question’sinstructionsorcriteriafails with a400rather than being sent to the model as text. - Send at most 4 images per request to Clef, Clef Flash, and Clef Omni, at most 16 to Mercury Decide, and at most 128 to GPT-6 Luna Decisions.
- Text items in the array are plain strings, not
{ "type": "text" }parts. - Jev 1.14 and
~typesafe/jev-latestalso answer Box questions about images.
- A top-level
imagesfield. The API rejects it with a400. - The Responses API
input_imagepart ({ "type": "input_image", "image_url": "data:..." }). - A raw base64 string without the
data:image/...;base64,prefix.
assets map with reference strings, is also accepted; see Asset references.
Asset references
Instead of placing image parts inline, list each image once in a top-levelassets map and write its key, the reference, wherever the image belongs. This is the shape TypeSafe’s own API and SDKs produce, so a request written for api.typesafe.ai works on OpenRouter as-is:
- Each asset is
{ "type": "image", "format": "png" | "jpg" | "jpeg", "data_base64": "..." }.typeis optional;data_base64is the file in standard base64 with nodata:prefix. The multipartpartfield is not accepted. - Every asset must be referenced somewhere in
state,instructions, orcriteria, or the request fails with a400naming the unused reference. Object keys (astatefield name, a Choice option, a question ID) are never read as references. - On Jev,
assetsand references are sent to TypeSafe as written: a reference matches as a whole string value or inside longer text, and each occurrence adds the image again. A Scorelegendthat echoes a criterion written as a reference returns the reference. Pick references that cannot occur in your text by accident, such as a UUID per image. - On every other Decisions model, a string that is exactly a reference is read as the
image_urlpart for that asset, with the same limits as an inline image part, and only as a top-levelstateitem: those models read images nowhere else. A reference nested inside astateobject, placed ininstructionsorcriteria, or written inside longer text fails with a400instead of sending the image to the model as text.
image_url parts and assets can be mixed in one request.
Image positions on Jev
Jev (typesafe/jev-1.14, typesafe/jev-1.13, and ~typesafe/jev-latest) reads an image part in any of these places:
- The top-level
statearray, orstateitself when it is one image part. - Any depth inside objects and arrays in
state, such as{ "door": { "frames": [<image part>] } }. Object keys are never read as images. - A question’s
instructions, wheninstructionsis an array or object that holds the image part. - Criteria: a Noul question’s
trueandfalsecriteria, the value of a Choice option, and a Score level.
image_url part cannot sit inside a string. To name an image mid-sentence, use an asset reference instead: "compare a3f1c2e8-badge with the badge" with a3f1c2e8-badge listed in assets.
Each image part counts as its own image, so repeating the same part sends the image again and counts toward the size limits again. A Score answer whose legend names an image returns your original image part.
TypeSafe marks image input as an early feature whose request format, answers, and limits can change between Jev releases. The positions above are what OpenRouter sends to Jev today, for inline image parts and for asset references alike; other Decisions models read images only in the top-level state array.
Audio and video parts (Clef Omni)
cloudflare/clef-omni also takes audio and video items in the top-level state array, using the same part shapes Chat Completions uses in message content:
input_audio.datais raw base64 (nodata:prefix).formatmust be one ofwav,mp3,mpeg,m4a,mp4,aac,aiff,aif,flac,ogg,opus, orwebm.video_url.urlmust be a base64data:video/...URL. Remotehttp(s)URLs are not fetched.processingis accepted but ignored. Clef Omni samples every video at 2 frames per second regardless.- Send at most 4 audio clips and 2 videos per request. Each audio clip can be up to 8 MiB or 300 seconds, each video up to 16 MiB or 60 seconds, and all audio and video together up to 16 MiB decoded.
- Audio costs about 780 input tokens per minute; audio, video, and image tokens all count toward the 65,536-token context window.
- Only Clef Omni reads audio and video. Clef and Clef Flash reject requests that contain them; other Decisions models see these parts as plain JSON text.
Limits
- Image size on Clef and Clef Flash. Workers AI estimates a request’s tokens from the base64 length before it processes the image, at about 4 base64 characters per token, and rejects the request with a
413once that estimate passes its 65,536-token window. Keep each image under about 300 KB before encoding, and resize or recompress larger images. Billing uses the tokens the model actually processes. - Text length on Clef and Clef Flash. Workers AI reads roughly the first 2,000 tokens of text in
stateand drops the rest without an error. Images are counted separately. - Image size on Mercury Decide. A 7 MB JPEG (a 10 MB request body) is accepted and billed as about 1,000 input tokens. A 12 MB image fails with a
422, and a 16 MB image with a413, so keep each image under a few MB. - Provider errors on Mercury Decide. Image parts pass through to Inception as sent, so an image it can’t read (a remote URL, a raw base64 string) or more than 16 images fails with a
422from the provider rather than a400from OpenRouter. - Images on Liquid d1 and d1-ultra. Send at most 8 images per request, in a request body of at most 4.5 MB and at most 10,000 image patches in total. Each 32x32-pixel patch counts as 1.5 input tokens, rounded up, for every question in the request.
- Image size on Jev. Each image must be 256 to 1,568 pixels on each side and 78,400 to 2,458,624 pixels in total, with inclusive limits. Images below the minimum dimensions return a
400; images above the maximum dimensions or other size limits return a413. Each decoded PNG or JPEG file can be at most 16 MiB. TypeSafe also limits the request body (including base64), all processed images together, and the expanded request (text, questions, structure, and image occurrences) to 32 MiB each. Processing can make images larger than the uploaded files, so fitting the upload-body limit alone is not enough. See TypeSafe’s image limits for details. Animated PNGs are rejected, and EXIF orientation is not applied, so rotate photos before encoding them. Images count as input tokens at the normal price, and every request with an image runs in TypeSafe’s long-context mode. - See each model page for the current context length and pricing.
Related
- Jev Documentation covers the Decisions primitives (Choice, Noul, Score) in depth.
- Decisions API reference has the full request and response schema.