# black-forest-labs/flux-kontext-pro/multi API

This document describes the input and output parameters for the `black-forest-labs/flux-kontext-pro/multi` model API, for you to refer to when using the interface.

---

## Request Parameters

### Request Body

| Field Name      | Type          | Required | Default | Description                                                                                                                  |
| --------------- | ------------- | -------- | ------- | ---------------------------------------------------------------------------------------------------------------------------- |
| prompt          | string        | Conditionally Required | -      | Prompt                                                                                                                        |
| model           | string        | Required  | -      | The model name used for this request, which is `black-forest-labs/flux-kontext-pro/multi`.                                      |
| images          | array(string) | Required  | -      | Multi-image editing, base64 data or image link http://xxx                                                                     |
| n               | int           | Optional  | 1      | Number of images to generate, range is 1~4                                                                                    |
| aspect_ratio    | string        | Optional  | "1:1"  | Aspect ratio of the image, in the format "width:height", such as "16:9" or "1:1"                                               |
| seed            | int           | Optional  | -1     | Random seed, used to control the randomness of the content generated by the model. If you want the generated content to remain consistent, you can use the same seed parameter value. |
| steps           | int           | Optional  | 20     | Number of inferences, range 1~50                                                                                              |
| guidance_scale  | float         | Optional  | 2.5    | The degree of consistency between the model output and the prompt, i.e., the freedom of the generated image; the larger the value, the smaller the freedom of the model, and the stronger the correlation with the user's input prompt. <br>Range [1, 10]. |
| negative_prompt | string        | Optional  | -      | Negative prompt, used to specify content that you do not want to appear in the generated image                                |
| response_format | string        | Optional  | "url"  | Specifies the format of the generated image returned, default is `url`, can be `b64_json`                                     |

## Response Parameters

| Field Name      | Type      | Description                                                                                                                                                                                                                                                  |
| --------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| created         | `integer` | Unix timestamp (in seconds) of when the request was created.                                                                                                                                                                                                  |
| data            | `array`   | Information about the output images, including URLs or Base64 for image download. <br>• When the format of the generated image is specified as url, the subfield of the corresponding parameter is url; <br>• When the format of the generated image is specified as b64_json, the subfield of the corresponding parameter is b64_json. <br>Note: The link will expire 7 days after generation, please be sure to save the image in time. |
| error           | `Object`  | Error information object                                                                                                                                                                                                                                      |
| error.code      | `string`  | Error code                                                                                                                                                                                                                                                    |
| error.message   | `string`  | Error message                                                                                                                                                                                                                                                 |
| error.param     | `string`  | Request id                                                                                                                                                                                                                                                    |

## Example

### OPENAI Compatible Interface

`POST https://api-us-ca.umodelverse.ai/v1/images/generations`

#### Synchronous Request

```bash
curl --location 'https://api-us-ca.umodelverse.ai/v1/images/generations' \
--header "Authorization: Bearer $MODELVERSE_API_KEY" \
--header 'Content-Type: application/json' \
--data '{
    "model": "black-forest-labs/flux-kontext-pro/multi",
    "prompt": "Convert to quick pencil sketch",
    "images": [
        "https://umodelverse-inference.cn-wlcb.ufileos.com/ucloud-maxcot.jpg",
        "data:image/png;base64,{image_base64_string}"
    ]
}'
```

```python
import os
from openai import OpenAI

client = OpenAI(
    base_url=os.getenv("BASE_URL", "https://api-us-ca.umodelverse.ai/v1"),
    api_key=os.getenv("API_KEY", "$MODELVERSE_API_KEY")
)

response = client.images.generate(
    model="black-forest-labs/flux-kontext-pro/multi",
    prompt="Convert to quick pencil sketch",
    extra_body={
        "images": [
            "https://umodelverse-inference.cn-wlcb.ufileos.com/ucloud-maxcot.jpg",
            "data:image/png;base64,{image_base64_string}"
        ]
    }
)

print(response.data[0].url)
```

### Response

```json
{
  "created": 1750667997,
  "data": [
    {
      "url": "https://xxxxx/xxxx.png",
      "b64_json": "data:image/png;base64,{image_base64_string}"
    }
  ],
  "usage": {
    "input_tokens_details": {}
  }
}
```

```json
{
  "error": {
    "message": "error_message",
    "type": "error_type",
    "param": "request_id",
    "code": "error_code"
  }
}
```