Skip to Content
API CallImage GenerationQwen/Qwen-Image-Edit

Qwen/Qwen-Image-Edit API

This document describes the input and output parameters of the Qwen/Qwen-Image-Edit model API, providing you the reference to understand these fields when using the interface.


Request Parameters

Request Body

Field NameTypeRequiredDefault ValueDescription
promptstringRequired-The prompt
modelstringRequired-The model name used for this request, which should be Qwen/Qwen-Image-Edit.
imagestringRequired-Base64 data or image link http://xxx
seedintOptional-1Random seed used to control the randomness of the model’s output. To keep the result consistent, use the same seed value.
sizestringOptional-The size of the generated image (width x height), with each dimension ranging from 256 to 1536. Example: 1024x1024.

Response Parameters

Field NameTypeDescription
createdintegerThe Unix timestamp (in seconds) when this request was created.
dataarrayInformation about the output image, including the download URL or Base64 data.
• If the specified format for returning the generated image is URL, then the sub-field is URL;
• If it is b64_json, then the sub-field is b64_json.
Note: the link will expire in 7 days, so please save the image promptly.
errorObjectError information object
error.codestringError code
error.messagestringError message
error.paramstringRequest 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": "Qwen/Qwen-Image-Edit", "prompt": "Convert to quick pencil sketch", "image": "data:image/png;base64,{image_base64_string}", "size": "1024x1024" }'
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="Qwen/Qwen-Image-Edit", prompt="Convert to quick pencil sketch", extra_body={ "image": "data:image/png;base64,{image_base64_string}", "size": "1024x1024" } ) 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" } }