Skip to content

Images

POST https://api.katara.com/v1/images/generations takes the OpenAI image generation request and returns one image. POST https://api.katara.com/v1/images/edits changes pictures you send. Every image request goes to Katara Cortex, whatever model it names, and Cortex makes the picture with one of two models:

  • The main image model, which generates and edits. It is sized by tier (1K, 2K or 4K) and aspect ratio. Cortex uses it while it is available.
  • A lower-cost image model, which generates only and handles posters, diagrams and text inside the picture. It makes a generation when the main model cannot, at its own lower price.
Terminal window
curl https://api.katara.com/v1/images/generations \
-H "Authorization: Bearer $KATARA_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"katara/cortex","prompt":"A watercolor koi pond at dawn","aspect_ratio":"16:9"}'

With the OpenAI client, client.images.generate(model="katara/cortex", prompt="...") works unchanged.

Field
modelAny name. katara/cortex is the usual one; every name is served by Cortex.
promptWhat to draw, up to 4,000 characters.
aspect_ratio1:1 (the default), 2:3, 3:2, 3:4, 4:3, 4:5, 5:4, 9:16, 16:9 or 21:9.
image_size1K (the default), 2K or 4K.
sizeWIDTHxHEIGHT, in place of image_size and aspect_ratio: it picks the nearest aspect ratio and the smallest tier with that many pixels.
qualityRead when the lower-cost model makes the picture: hd (the default, about 20 seconds) or standard (5 to 10 seconds). high and auto mean hd; medium and low mean standard.
nOnly 1. Send one request per image.
response_formatOnly b64_json.
userAccepted and not passed on.

Any other field is refused with 400 and code unsupported_parameter, so you never pay for a picture made differently from what you asked.

Send the pictures to POST https://api.katara.com/v1/images/edits with a prompt saying what to change, as multipart/form-data (one or more image files, as the OpenAI client sends them) or as JSON, with image as base64 or a data URL, or a list of them, or images as a list of {"image_url": "data:..."}. The main image model makes every edit.

  • Up to 11 pictures, PNG, JPEG or WebP, each up to 7 MB, and 19 MB for the whole request. Katara does not fetch links or read stored files here.
  • aspect_ratio and image_size work as for a generation; without an aspect ratio the edit keeps the shape of the picture.
  • mask is refused.
  • The reply carries katara.edit_id. Send it as previous_edit_id with the next edit to keep changing the same picture without sending it again; an edit id is kept for seven days.
{
"created": 1792252800,
"data": [{ "b64_json": "iVBORw0KGgo..." }],
"output_format": "png",
"usage": { "images": 1 },
"katara": { "cost_usdc": "0.05112", "provider": "managed", "fallback": true }
}

data[0].b64_json is the image itself, base64-encoded; output_format says whether it is png, jpeg or webp. Katara stores nothing you need to fetch afterwards, so save the image from the reply.

A prompt the model refuses to draw is 400 image_refused, and an expired previous_edit_id is 400 edit_expired. Neither is charged.

Every image has one price, known before it is made, the same in USDC and in Account Credits:

USDC or credits
Main model, 1K0.05112
Main model, 2K0.07128
Main model, 4K0.1464
Each picture sent to an edit0.002016 more
Lower-cost model0.018
  • A key that pays with USDC is charged in USDC; katara.cost_usdc carries the charge.
  • A key that pays with Account Credits is charged in credits; katara.cost_usd carries the charge.
  • Without a key, the request is paid with x402. The quote is exactly the image price, with the same schemes and settlement as a chat completion.

Images are made by Katara’s own model providers only, never by Katara Community, whatever pays. A request that fails before the image comes back is not charged.

In the chat app, ask Katara Cortex for a picture, or to change one you attached, and it draws it, charged the same way.