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}/" 
}Specifies:
- text prompt for image generation ( - input)
- image generation options ( - options)
- where results will be stored ( - output)
Text prompt that will be used to generate image(s). Should be from 3 to 1024 characters.
A delicious ceviche cheesecake sliceCustomize the image generation process so that the output images meet your requirements.
{"number_of_images":4,"guidance_scale":5}URL of the output folder. If output is not defined, we store the output image on our bucket and return the temporary URL, in this case images are stored for one day.
storage://storage_1/output_folder/Successful Response
Authorization is required.
No API calls left.
Not enough permissions.
Unprocessable Entity.
Too many requests.
POST /v1/image/generate HTTP/1.1
Host: 
Authorization: Bearer YOUR_OAUTH2_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 146
{
  "input": "A delicious ceviche cheesecake slice",
  "options": {
    "number_of_images": 4,
    "guidance_scale": 5
  },
  "output": "storage://storage_1/output_folder/"
}{
  "data": {
    "input": {
      "text": "text"
    },
    "output": [
      {
        "ext": "text",
        "mps": 1,
        "mime": "text",
        "format": "text",
        "width": 1,
        "height": 1,
        "tmp_url": "text",
        "object_key": "text",
        "object_bucket": "text",
        "object_uri": "text",
        "claid_storage_uri": "text"
      }
    ],
    "profiling": {}
  }
}Request
POST /v1/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
    }
}curl -X POST --location "https://api.claid.ai/v1/image/generate" --http1.1 \
    -H "Host: api.claid.ai" \
    -H "Authorization: Bearer {YOUR_API_KEY}" \
    -H "Content-Type: application/json" \
    -d "{
            \"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/image/generate you will get a response with information about input text and output images.
Image information is shown in the response:
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: 34Request 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-ff031475affaLast updated
