Images
Send images to any model that reads them, and make images with every image model.
Images work both ways on the same router key and credit: models read the images you send, and image models make new ones.
Send images to a model
Most models read images. Send one as part of a message, in each format's own shape:
{ "type": "image_url", "image_url": { "url": "https://example.com/chart.png" } }- Links or inline. An
httpslink, or the image itself as adata:image/png;base64,...URL. A request body is at most 4 MB, and base64 makes a file a third bigger, so send anything large by link. - Types. PNG, JPEG, WebP and GIF. Any other inline type, such as HEIC, SVG or TIFF, answers
400 image_type_not_served. - Which models. Those with
imageinarchitecture.input_modalitiesinGET /models. Images sent to a model that can't read them answer400 model_no_image_inputbefore anything is reserved. - Cost. Images are read as input tokens at the model's price, plus its per-image price (
pricing.image) where it has one.
Make images
POST /images makes images from a prompt with any image model: GPT Image, Gemini, FLUX, Recraft, Seedream and more. GET /images/models lists them, the fields each one takes and its price.
curl https://relayfor.si/api/v1/images \
-H "Authorization: Bearer $RELAYFOR_ROUTER_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "recraft/recraft-v4.1-flash",
"prompt": "A green sun over a calm sea, flat illustration"
}'Each image comes back as base64 in data[].b64_json, with its media_type, and usage.cost says what the call was charged.
- More than one.
nmakes several in one call, as many as the model allows (parameters.n). - Edit or follow an image. Send it in
input_references, as a link or inline, on models withreads_images: true. - Stream.
stream: truesends partial images as they form, then the finished one, on models withstreaming: true. A streamed call makes one image. - Checked first.
n,resolution,qualityand the other listed fields are checked against the model before anything is reserved, so a value it doesn't take answers400for free.
What it costs
Each image model lists its price lines: per image, per megapixel or per token, some for one tier (2k) or quality (low_1k). You pay the model's price plus 20%, as on every call, and usage.cost shows it. A generation that fails costs nothing.
The call reserves its worst case: every image it asks for, at the dearest host's price, at the resolution and quality it names. Leave them out and it reserves the largest tier and the highest quality the model offers, so set them to hold less.
Through chat
A few chat models draw too, such as the Gemini image models. Add modalities on Chat Completions and the images come back in message.images, as data: URLs:
{
"model": "google/gemini-3.1-flash-image",
"modalities": ["image", "text"],
"max_tokens": 4096,
"messages": [{ "role": "user", "content": "Draw a small green sun, flat icon." }]
}They're priced per image token (pricing.image_output in GET /models), and max_tokens bounds the reserve as on any call.