---
schema_version: "1"
id: 2a7aedd8e875c3b961a31cedaf9ba636189a4dd88936cc69f5f8bb66847216ef
title: Configuring Image Generation Operations
collection: mulesoft
version: current
locale: en-us
portal_url: https://docs.salesforce.com/mulesoft/current/en-us/mulesoft-ai-chain-connector/1.0/configuring-image-generation-operations.md
canonical_url: https://docs.mulesoft.com/mulesoft-ai-chain-connector/1.0/configuring-image-generation-operations
source_site: docs.mulesoft.com
content_type: documentation
content_hash: c754aae7726176ab2f93db3441621d84dade56338b462fa889dbea148c801a10
description: MuleSoft Documentation Site
release: "1.0"
latest: false
---
---
product: MuleSoft AI Chain Connector
version: 1.0
---

# Configuring Image Generation Operations

> For the full documentation index, see: https://docs.mulesoft.com/llms.txt

Support for MuleSoft AI Chain Connector 1.0 ends on October 30, 2026. Use one of the other available
[MuleSoft AI connectors](https://docs.mulesoft.com/general/learning-map-mulesoft-ai) based on your requirements.

## Configure the Image Read Operation

The **Image read** operation reads and interprets an image based on a prompt. Currently, MuleSoft AI
Chain Connector supports only OpenAI Image Models.

To configure the **Image read** operation:

1.  Select the operation on the Anypoint Code Builder or Studio canvas.

2.  In the **General** properties tab for the operation, enter these values:

    - **Data**

      Contains the prompt for the operation.

    - **ContextUrl**

      Contains the URL to the image file to read.

This is the XML configuration for this operation:

```xml
<ms-aichain:image-read
  doc:name="Image read"
  doc:id="16cac2ce-def9-41e2-aaff-0f9c33d622f1"
  config-ref="MuleSoft_AI_Chain_Config"
  contextURL="#[payload.imageUrl]">
  <ms-aichain:data><![CDATA[#[payload.prompt]]]></ms-aichain:data>
</ms-aichain:image-read>
```

### Output Configuration

This operation responds with a JSON payload containing the main LLM response. Additionally,
attributes such as token usage are included as part of the metadata (attributes), but not within the
main payload.

This is an example response of the JSON payload:

```json
{
  "response": "The image depicts a group of men in what appears to be a stadium or arena setting. They are standing in the stands, with some looking agitated or engaged in a discussion."
}
```

Along with the JSON payload, the operation also returns attributes, which include information about
token usage, for example:

```json
{
  "attributes": {
    "tokenUsage": {
      "outputCount": 87,
      "totalCount": 187,
      "inputCount": 100
    },
    "additionalAttributes": {}
  }
}
```

## Configure the Image Generate Operation

The **Image generate** operation generates an image based on a prompt sent to the LLM. Currently,
MuleSoft AI Chain Connector supports only OpenAI Image Models.

To configure the **Image generate** operation:

1.  Select the operation on the Studio canvas.

2.  In the **General** properties section, configure the **Data** field with the prompt for
    generating the image, for example, `payload.prompt`.

This is the XML configuration for this operation:

```xml
<ms-aichain:image-generate
  doc:name="Image generate"
  doc:id="a057ad09-533f-42e9-bfd6-00014db6cec8"
  config-ref="MuleSoft_AI_Chain_Config">
  <ms-aichain:data><![CDATA[#[payload.prompt]]]></ms-aichain:data>
</ms-aichain:image-generate>
```

### Output Configuration

This operation responds with a JSON payload containing the URL of the generated image, for example:

```json
{
  "response": "https://oaidalleapiprodscus.blob.core.windows.net/private/org-dP8odnP25FlwTi1fOMr1X7vO/user-Jyi0vNlYu4mjEBZl9Mu1lXBW/img-bEO12CWIRI7CkGUjfz5ajAlS.png"
}
```

## See Also

- [Using Anypoint Code Builder to Configure a Connector](https://docs.mulesoft.com/connectors/introduction/intro-config-use-acb)

- [Using Studio to Configure a Connector](https://docs.mulesoft.com/connectors/introduction/intro-config-use-studio)

- [MuleSoft AI Chain Connector Overview](https://docs.mulesoft.com/mulesoft-ai-chain-connector/1.0/)

- [MuleSoft AI Chain Connector Reference](https://docs.mulesoft.com/mulesoft-ai-chain-connector/1.0/mulesoft-ai-chain-connector-reference)

- [Salesforce Help](https://help.salesforce.com)
