How to generate AI art with API

Start generating AI art in 5 minutes or less

First, make sure you've read Getting Started guide and you have your API token ready.

AI Art generation

To generate art you need to send generation request. You can find more examples in API Reference section.

Easiest way to do that is using curl:

curl --request POST \
     --url \
     --header 'Authorization: Bearer <TOKEN>' \
     --header 'Accept: application/json' \
     --header 'Content-Type: application/json' \
     --data '{
     "prompt": "a cat",
     "style": "painting",
     "layout": "square",
     "amount": 1,
     "isHd": false,
     "isPublic": true

In this example we request a generation of a cat in painting style. layout is responsible for aspect ratio of the resulting image. You can specify amount (4 is default for square generations and 2 is default for everything else).

isHd generates bigger and more detailed pictures.

isPublic is responsible for whether this generation will be publicly available or not. By default all generations are public.

You can also generate art with image input (image2image) and with custom model id (dreambooth).

Cost estimation

You can use the very same parameters to estimate cost of generation request beforehand. Use /ai-art/estimate endpoint to get generation cost in credits. Cost could be zero.

Getting results

After some time (usually 1 minute) you can start checking the order status. We recommend doing that in increasing intervals, e.g. after 30, 45, 60, 90, 150 seconds etc.

Use order's id to get information about it. You can use status.isReady field to check if the processing is over.

curl --request GET \
     --url \
     --header 'Authorization: Bearer <TOKEN>' \
     --header 'Accept: application/json'

After the processing is over you'll have all requested images in output section. Detailed documentation is available here.

What’s Next