qwen-image-edit
Model Overview
The image editing variant of our 20B Qwen-Image model. It expands the model’s distinctive text rendering abilities to editing tasks, making accurate text modifications within images possible.
Setup your API Key
If you don’t have an API key for the AI/ML API yet, feel free to use our Quickstart guide.
API Schema
A positive prompt that describes the desired elements and visual features in the edited image. Maximum 800 characters.
The image to be edited. Enter the Base64 encoding of the picture or an accessible URL. Image URL: Make sure that the image URL is accessible. Base64-encoded content: The format must be in lowercase.
The description of elements to avoid in the generated image.
Add an invisible watermark to the generated images.
false
Successfully generated image
async function main() {
const response = await fetch('https://api.aimlapi.com/v1/images/generations', {
method: 'POST',
headers: {
'Authorization': 'Bearer <YOUR_AIMLAPI_KEY>',
'Content-Type': 'application/json',
},
body: JSON.stringify({
model: 'alibaba/qwen-image-edit',
prompt: 'A T-Rex relaxing on a beach, lying on a sun lounger and wearing sunglasses.',
}),
});
const data = await response.json();
console.log(JSON.stringify(data, null, 2));
}
main();
Successfully generated image
{
"status": "text",
"prompt": [
"text"
],
"model": "text",
"model_owner": "text",
"tags": {
"ANY_ADDITIONAL_PROPERTY": null
},
"num_returns": 1,
"args": {
"model": "text",
"prompt": "text",
"n": 1,
"steps": 1,
"size": "text"
},
"subjobs": [],
"output": {
"choices": [
{
"image_base64": "text"
}
]
}
}
Quick Example
Let's generate an image of the specified size using a simple prompt.
import requests
import json
def main():
response = requests.post(
"https://api.aimlapi.com/v1/images/generations",
headers={
# Insert your AIML API Key instead of <YOUR_AIMLAPI_KEY>:
"Authorization": "Bearer <YOUR_AIMLAPI_KEY>",
"Content-Type": "application/json",
},
json={
"model": "alibaba/qwen-image-edit",
"prompt": "Make the dinosaur sit on a lounge chair with its back to the camera, looking toward the water. The setting sun has almost disappeared below the horizon.",
"image": "https://raw.githubusercontent.com/aimlapi/api-docs/main/reference-files/t-rex.png"
}
)
data = response.json()
print(json.dumps(data, indent=2, ensure_ascii=False))
if __name__ == "__main__":
main()
We obtained the following 1184x896 image by running this code example:

'Make the dinosaur sit on a lounge chair with its back to the camera, looking toward the water.
The setting sun has almost disappeared below the horizon.'
Last updated
Was this helpful?