> For the complete documentation index, see [llms.txt](https://docs.sprinthub.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sprinthub.com/en/topics/artificial-intelligence/ai-agents/ai-agents-generate-images.md).

# AI Agents - Generate Images

## Configuring the image generation model

To use AI image generation, it is necessary to configure an OpenAI API key in the instance and enable this feature. In the settings, it is possible to choose the model and the resolution of the generated image.

<figure><img src="https://684109703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9FzUKkagBNy5uQ7AtGNa%2Fuploads%2F1mcM27tV4uirP3nGIkqy%2FScreenshot_2.png?alt=media&amp;token=9d513a8b-7792-4fae-a97e-0e50fb671018" alt=""><figcaption><p><em>Agent skills.</em></p></figcaption></figure>

<figure><img src="https://684109703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9FzUKkagBNy5uQ7AtGNa%2Fuploads%2FruqXYDdFl9EvPTATMyAD%2Fimage.png?alt=media&amp;token=d29fb342-6e3c-4298-b7cc-3e72b587cefa" alt=""><figcaption><p><em>Settings.</em></p></figcaption></figure>

## Configuring Long Processing Fallback

In the **"Additional Settings"**, it is possible to customize the message that the lead will receive if the AI response time exceeds the stipulated limit, using the field **"Long Processing Fallback"**. This is especially useful in image generation situations, which usually take longer to complete.

In the example below, I set the timeout to 20 seconds. Thus, if the AI takes longer than that, the lead will be informed that the response is still being generated — avoiding the impression that the system has frozen or stopped working.

<figure><img src="https://684109703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9FzUKkagBNy5uQ7AtGNa%2Fuploads%2FpwZ9uhZN5j1ggSxkxwRQ%2Fimage.png?alt=media&amp;token=3b7a8de9-5e81-483d-90af-bcb8df950486" alt=""><figcaption><p><em>Additional Settings.</em></p></figcaption></figure>

## Testing the feature

In the test below, the lead was talking to the AI Agent when they requested an image generation. During the process, the system sent the message configured in the **Processing Fallback**, informing that the request was in progress. Then, the image was sent normally, as requested.

<figure><img src="https://684109703-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F9FzUKkagBNy5uQ7AtGNa%2Fuploads%2FvMmw8ffrE5a99oB418TU%2FGroup%2020.png?alt=media&amp;token=6b3fe4c5-3927-49fa-8dc2-dd0562e3a523" alt=""><figcaption><p><em>Image generation example</em>.</p></figcaption></figure>
