Skip to main content
POST
/
image_editing
/
qwen_edit
Qwen Edit
curl --request POST \
  --url https://modelslab.com/api/v6/image_editing/qwen_edit \
  --header 'Content-Type: application/json' \
  --data '
{
  "key": "<string>",
  "prompt": "<string>",
  "init_image": [
    "<string>"
  ],
  "safety_checker": true,
  "base64": false,
  "webhook": "<string>",
  "track_id": 123,
  "model_id": "qwen-edit-2509"
}
'
import requests

url = "https://modelslab.com/api/v6/image_editing/qwen_edit"

payload = {
    "key": "<string>",
    "prompt": "<string>",
    "init_image": ["<string>"],
    "safety_checker": True,
    "base64": False,
    "webhook": "<string>",
    "track_id": 123,
    "model_id": "qwen-edit-2509"
}
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: JSON.stringify({
    key: '<string>',
    prompt: '<string>',
    init_image: ['<string>'],
    safety_checker: true,
    base64: false,
    webhook: '<string>',
    track_id: 123,
    model_id: 'qwen-edit-2509'
  })
};

fetch('https://modelslab.com/api/v6/image_editing/qwen_edit', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://modelslab.com/api/v6/image_editing/qwen_edit",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => json_encode([
    'key' => '<string>',
    'prompt' => '<string>',
    'init_image' => [
        '<string>'
    ],
    'safety_checker' => true,
    'base64' => false,
    'webhook' => '<string>',
    'track_id' => 123,
    'model_id' => 'qwen-edit-2509'
  ]),
  CURLOPT_HTTPHEADER => [
    "Content-Type: application/json"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://modelslab.com/api/v6/image_editing/qwen_edit"

	payload := strings.NewReader("{\n  \"key\": \"<string>\",\n  \"prompt\": \"<string>\",\n  \"init_image\": [\n    \"<string>\"\n  ],\n  \"safety_checker\": true,\n  \"base64\": false,\n  \"webhook\": \"<string>\",\n  \"track_id\": 123,\n  \"model_id\": \"qwen-edit-2509\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://modelslab.com/api/v6/image_editing/qwen_edit")
  .header("Content-Type", "application/json")
  .body("{\n  \"key\": \"<string>\",\n  \"prompt\": \"<string>\",\n  \"init_image\": [\n    \"<string>\"\n  ],\n  \"safety_checker\": true,\n  \"base64\": false,\n  \"webhook\": \"<string>\",\n  \"track_id\": 123,\n  \"model_id\": \"qwen-edit-2509\"\n}")
  .asString();
require 'uri'
require 'net/http'

url = URI("https://modelslab.com/api/v6/image_editing/qwen_edit")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n  \"key\": \"<string>\",\n  \"prompt\": \"<string>\",\n  \"init_image\": [\n    \"<string>\"\n  ],\n  \"safety_checker\": true,\n  \"base64\": false,\n  \"webhook\": \"<string>\",\n  \"track_id\": 123,\n  \"model_id\": \"qwen-edit-2509\"\n}"

response = http.request(request)
puts response.read_body
{
  "status": "success",
  "generationTime": 123,
  "id": 123,
  "output": [
    "<string>"
  ],
  "proxy_links": [
    "<string>"
  ],
  "meta": {}
}
Qwen Edit endpoint result

Request

Make a POST request to below endpoint and pass the required parameters as a request body to the endpoint.
curl
--request POST 'https://modelslab.com/api/v6/image_editing/qwen_edit' \
The init_image parameter can accept a string if editing a single image or an array of strings if editing multiple images. Maximum number of images to be passed is 4.

Body

json
{
  "key":"",
  "prompt": "The girl holding a Pepsi can from image 2 in her left hand.",
  "init_image": [
    "https://assets.modelslab.ai/generations/9398f98f-8b37-4d2b-98b8-04e0d22167e3.jpg",
    "https://assets.modelslab.ai/generations/57df2bbf-512a-4a9a-bf99-35cde14113e7.jpg"
  ],
  "safety_checker": true,
  "model_id": "qwen-edit-2509",
  "base64": false,
  "webhook": null,
  "track_id": null
}

Body

application/json
key
string
required

Your API Key used for request authorization

prompt
string
required

The text prompt describing the content you want in the generated image

init_image
string[]
required

Link the image you want your generations to edit and manipulate

safety_checker
boolean

Whether to run the safety checker

base64
boolean
default:false

Set to true for base64 response

webhook
string<uri>

URL to receive POST API call when complete

track_id
integer

ID for webhook identification

model_id
enum<string>
default:qwen-edit-2509

The model version to use for image editing

Available options:
qwen-edit-2509,
qwen-edit-2511

Response

200 - application/json

Qwen Edit response

status
enum<string>
Available options:
success
generationTime
number

Time taken to generate the image in seconds

id
integer

Unique identifier for the generation request

output
string<uri>[]

Array of generated image URLs

Array of proxy image URLs

meta
object

Metadata about the generation process