> 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

## Setting up image generation model

To use AI image generation, you need to configure an OpenAI API key in the instance and enable this feature. In the settings, you can choose the model and the resolution of the generated image.

<figure><img src="/files/6957ddad0649d59b1ac82d07da9e987edd4a13f3" alt=""><figcaption><p><em>Agent abilities.</em></p></figcaption></figure>

<figure><img src="/files/9ee2a35096b45152bff85d7c713993a708282044" alt=""><figcaption><p><em>Settings.</em></p></figcaption></figure>

## Configuring Long Processing Fallback

In the tab **"Additional Settings"**, you can customize the message 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 normally take longer to complete.

In the example below, I set the timeout to 20 seconds. That way, 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 froze or stopped working.

<figure><img src="/files/bc04b595fb021c28797157723a574aa59b00d91f" alt=""><figcaption><p><em>Additional Settings.</em></p></figcaption></figure>

## Testing the functionality

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

<figure><img src="/files/73f3926298c1d238a021fa464cd5623d894dcb8e" alt=""><figcaption><p><em>Image generation example</em>.</p></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.sprinthub.com/en/topics/artificial-intelligence/ai-agents/ai-agents-generate-images.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
