# AI Background  I/O

### Intro

The AI Background Endpoint allows you to turn simple product photos into beautiful visual assets. In just a few seconds, you can get up to 4 options and select the images that work best for you.

The generated images have a size of 1024×1024 pixels. You can further improve their resolution and quality using our Image Editing API, see the [Resizing](/image-editing-api/image-operations/resizing.md) and [Upscale](/image-editing-api/image-operations/restorations.md#upscale) sections for more info.

#### Limitations

Only one product image can be processed per request.

### Output

Configuring output is optional. By default, you may omit the output option from the request payload. In this case, our system stores the result in a temporary bucket with a lifespan of 24 hours and provides a public URL to the image.

Alternatively, you can use a connected [Cloud Storage](/storage-connectors/overview.md): just configure the path to the folder where you want to store results.

#### Output image file types

The following image formats are supported for the output: JPEG, PNG, WEBP, and AVIF.

#### Basic and advanced output options

You may also specify advanced output, like number of images to generate, image format, and format-specific options like PNG compression level, JPEG quality, or using JPEG progressive display type.

{% tabs %}
{% tab title="Basic Usage" %}

```json
{
    "output": "storage://storage-name/result-path/image-name.jpg"
}
```

{% endtab %}

{% tab title="Advanced Usage" %}

```json
"output": {
    "destination": "storage://storage-name/result-path/image-name.jpg",
    "format": "jpeg",
    "number_of_images": 1
}
```

{% endtab %}

{% tab title="Advanced Format Usage" %}

```json
"output": {
    "destination": "storage://storage-name/result-path/image-name.jpg",
    "format": {
        "type": "jpeg",
        "quality": 85,
        "progressive": true
    },
    "number_of_images": 1
}

```

{% endtab %}
{% endtabs %}

&#x20;See the full list of the advanced format-specific options at [Image I/O](/image-editing-api/image-i-o.md#basic-and-advanced-output-options) for more info.

#### Number of images

With AI Background API, you can generate up to 4 images with one request.

{% hint style="danger" %}
Every generated image charges 2 credit.&#x20;

Setting <mark style="color:purple;">`number_of_images`</mark> to <mark style="color:purple;">4</mark> will charge 8 credits per request.

The <mark style="color:purple;">`number_of_images`</mark> option **defaults** to <mark style="color:purple;">4</mark>.
{% endhint %}

```json
{
    "output": {
        "number_of_images": 2
    }
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.claid.ai/ai-background-api/ai-background-i-o.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
