---
schema_version: "1"
id: d371ffb0cb61f5bd368e7f85c48295707d8cd3fb2b1651eeb184c2b418f02df8
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/latest/configuring-image-generation-operations.md
canonical_url: https://docs.mulesoft.com/mulesoft-ai-chain-connector/latest/configuring-image-generation-operations
source_site: docs.mulesoft.com
content_type: documentation
content_hash: c389426dd2875bb244eee111d18264f2eff8cc0fdd91afd06b558586c1a828e3
description: MuleSoft Documentation Site
release: "2.0"
latest: true
---
---
product: MuleSoft AI Chain Connector
version: 2.0
is-latest-version: true
---

# Configuring Image Generation Operations

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

## 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.

    - **Context URL**

      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/latest/)

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

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