black-forest-labs/flux-kontext-max/multi API
This document introduces the input and output parameters for calling the black-forest-labs/flux-kontext-max/multi model API. Please refer to this reference when using the interface.
Request Parameters
Request Body
| Field Name | Type | Required | Default | Description |
|---|---|---|---|---|
| prompt | string | Conditionally Required | - | Prompt words |
| model | string | Required | - | The model name used for this request, which in this case is black-forest-labs/flux-kontext-max/multi. |
| images | array(string) | Required | - | Multiple image edits, base64 data or image link http://xxx |
| n | int | Optional | 1 | The number of images to generate, ranging from 1 to 4 |
| aspect_ratio | string | Optional | ”1:1” | The aspect ratio of the image, formatted as “width:height”, such as “16:9” or “1:1” |
| seed | int | Optional | -1 | Random seed used to control the randomness of the model’s generated content. To keep content consistent, use the same seed value. |
| steps | int | Optional | 20 | Number of inferences, ranging from 1 to 50 |
| guidance_scale | float | Optional | 2.5 | The consistency between the model’s output and the prompt, i.e., the freedom of the generated image; the greater the value, the less freedom the model has, and the stronger the correlation with the user’s input prompts. Value range [1, 10]. |
| negative_prompt | string | Optional | - | Negative prompts used to specify content that should not appear in the generated image |
| response_format | string | Optional | ”url” | Specify the format for returning the generated image, default is url, or can be b64_json |
Response Parameters
| Field Name | Type | Description |
|---|---|---|
| created | integer | Unix timestamp (in seconds) of the request creation time. |
| data | array | Information about the output image, including the download URL or Base64. • When the format is specified as URL, the subfield is URL; • When the format is specified as b64_json, the subfield is b64_json. Note: The link expires within 7 days after it is generated, please 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.umodelverse.ai/v1/images/generations
Synchronous Request
curl --location 'https://api.umodelverse.ai/v1/images/generations' \
--header "Authorization: Bearer $MODELVERSE_API_KEY" \
--header 'Content-Type: application/json' \
--data '{
"model": "black-forest-labs/flux-kontext-max/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}"
]
}'import os
from openai import OpenAI
client = OpenAI(
base_url=os.getenv("BASE_URL", "https://api.umodelverse.ai/v1"),
api_key=os.getenv("API_KEY", "$MODELVERSE_API_KEY")
)
response = client.images.generate(
model="black-forest-labs/flux-kontext-max/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
{
"created": 1750667997,
"data": [
{
"url": "https://xxxxx/xxxx.png",
"b64_json": "data:image/png;base64,{image_base64_string}"
}
],
"usage": {
"input_tokens_details": {}
}
}{
"error": {
"message": "error_message",
"type": "error_type",
"param": "request_id",
"code": "error_code"
}
}