Image generation API

How to generate and edit images through /images/generations: sizes, formats, input images, the response, and how images are billed.

Images

Image models answer POST /images/generations, the same request as OpenAI. size is pixels ("1024x1024") or a resolution the model offers ("1K", "1.5K", "2K", "3K", "4K"; not every model has every one) with an optional aspect_ratio ("16:9"). Leave size out for the standard size of the model. output_format is "jpeg" (default) or "png" on models that offer it. n is 1 to 4. Send image (a URL or data URL, or a list) to edit or restyle a picture. response_format "b64_json" returns the picture inline; "url" returns a link that works for one hour. You pay per image produced. Some models have a second, higher price for large images (above the pixel count shown for the model) and a price per input image, sometimes after a number of free ones; usage.input_images says how many were billed. The sizes, formats, input-image limit and prices of each model are in the Model reference below and in GET /models (pricing.image, pricing.image_large, pricing.image_input, and the image object).

// response
{
  "id": "img_0123456789abcdef0123456789abcdef",
  "created": 1793984023,
  "model": "MODEL_NAME",
  "data": [{ "url": "https://api.apistore.cloud/v1/files/images/..." }],
  "usage": { "images": 1, "input_images": 1, "cost_usd": 0.04 }  // input_images: only when some were billed
}