API Reference

request and response description

Image generation contract

Below you can see all possible options for the request body. See the Image Generation Options and Image Generation I/O sections to learn more about image operations.

{
    "input": "A delicious ceviche cheesecake slice",
    "options": {
        "number_of_images": 1,
        "guidance_scale": 5.0
    },
    "output": "storage://{storage_name}/{image_folder}/" 
}

Request

POST /v1-beta1/image/generate HTTP/1.1
Host: api.claid.ai
Authorization: Bearer {YOUR_API_KEY}
Content-Type: application/json

{
    "input": "A delicious ceviche cheesecake slice",
    "options": {
        "number_of_images": 2,
        "guidance_scale": 5
    }
}

Request headers:

In order to send a request, you should set Content-Type header to let our system know that you provide a valid JSON payload and Authorization header with a generated API key to identify yourself as a Claid user.

Content-Type: application/json
Authorization: Bearer {YOUR_API_KEY}

Read a response

Once you have made the request to https://api.claid.ai/v1-beta1/image/generate you will get a response with information about input text and output images.

Image information is shown in the response:

ParameterTypeDescription

ext

string

File extension. Will have png value

mps

integer

Megapixel count

mime

string

MIME type (also known as ‘media type’)

width

integer

Image width in pixels

height

integer

Image height in pixels

format

string

File format. Will have png value

tmp_url

string

Temporary URL of a processed image. Will be empty if output is specified

Response body

{
    "data": {
        "input": {
            "text": "A delicious ceviche cheesecake slice"
            }  
        },
        "output": [
            {
                "ext": "png",
                "mps": 1.048576,
                "mime": "image/png",
                "format": "PNG",
                "width": 1024,
                "height": 1024,
                "tmp_url": "https://storage.googleapis.com/production-leapi-tmp-public/733a7c8f-1fea-4097-8fd4-17f54c94d998/eyXNp9_1.png"
            },
            {
               "ext": "png",
                "mps": 1.048576,
                "mime": "image/png",
                "format": "PNG",
                "width": 1024,
                "height": 1024,
                "tmp_url": "https://storage.googleapis.com/production-leapi-tmp-public/733a7c8f-1fea-4097-8fd4-17f54c94d998/eyXNp9_2.png"
            },
        ]
    }
}

Response headers:

Rate limit headers will help you understand what number of requests you are able to send according to the current limits on your account:

ratelimit-limit: 120, 120;w=60, 4;w=1
ratelimit-remaining: 119
ratelimit-reset: 34

Request ID header allows to identify your request during image processing, so we are able to help you with troubleshooting and profiling your request if needed.

x-request-id: 9b321763-1d09-4072-932b-ff031475affa

Last updated