qwen-image-edit-plus接口
curl --request POST \
--url https://api.evolink.ai/v1/images/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "qwen-image-edit-plus",
"prompt": "替换这张图像的背景"
}
'import requests
url = "https://api.evolink.ai/v1/images/generations"
payload = {
"model": "qwen-image-edit-plus",
"prompt": "替换这张图像的背景"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({model: 'qwen-image-edit-plus', prompt: '替换这张图像的背景'})
};
fetch('https://api.evolink.ai/v1/images/generations', 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://api.evolink.ai/v1/images/generations",
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([
'model' => 'qwen-image-edit-plus',
'prompt' => '替换这张图像的背景'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://api.evolink.ai/v1/images/generations"
payload := strings.NewReader("{\n \"model\": \"qwen-image-edit-plus\",\n \"prompt\": \"替换这张图像的背景\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://api.evolink.ai/v1/images/generations")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"qwen-image-edit-plus\",\n \"prompt\": \"替换这张图像的背景\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.evolink.ai/v1/images/generations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"qwen-image-edit-plus\",\n \"prompt\": \"替换这张图像的背景\"\n}"
response = http.request(request)
puts response.read_body{
"created": 1757156493,
"id": "task-unified-1757156493-imcg5zqt",
"model": "qwen-image-edit-plus",
"object": "image.generation.task",
"progress": 0,
"status": "pending",
"task_info": {
"can_cancel": true,
"estimated_time": 30
},
"type": "image",
"usage": {
"billing_rule": "per_call",
"credits_reserved": 1,
"user_group": "default"
}
}{
"error": {
"code": "invalid_request",
"message": "Invalid request parameters",
"type": "invalid_request_error"
}
}{
"error": {
"code": "unauthorized",
"message": "Invalid or expired token",
"type": "authentication_error"
}
}{
"error": {
"code": "insufficient_quota",
"message": "Insufficient quota. Please top up your account.",
"type": "insufficient_quota"
}
}{
"error": {
"code": "model_access_denied",
"message": "Token does not have access to model: qwen-image-edit-plus",
"type": "invalid_request_error"
}
}{
"error": {
"code": "rate_limit_exceeded",
"message": "Too many requests, please try again later",
"type": "rate_limit_error"
}
}{
"error": {
"code": "internal_error",
"message": "Internal server error",
"type": "api_error"
}
}Qwen-Image
Qwen 图像编辑 Plus
- Qwen (qwen-image-edit-plus) 模型支持图像编辑、图生图等多种模式
- 异步处理模式,使用返回的任务ID 进行查询
- 生成的图像链接,有效期为24小时,请尽快保存
POST
/
v1
/
images
/
generations
qwen-image-edit-plus接口
curl --request POST \
--url https://api.evolink.ai/v1/images/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "qwen-image-edit-plus",
"prompt": "替换这张图像的背景"
}
'import requests
url = "https://api.evolink.ai/v1/images/generations"
payload = {
"model": "qwen-image-edit-plus",
"prompt": "替换这张图像的背景"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({model: 'qwen-image-edit-plus', prompt: '替换这张图像的背景'})
};
fetch('https://api.evolink.ai/v1/images/generations', 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://api.evolink.ai/v1/images/generations",
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([
'model' => 'qwen-image-edit-plus',
'prompt' => '替换这张图像的背景'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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://api.evolink.ai/v1/images/generations"
payload := strings.NewReader("{\n \"model\": \"qwen-image-edit-plus\",\n \"prompt\": \"替换这张图像的背景\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://api.evolink.ai/v1/images/generations")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"qwen-image-edit-plus\",\n \"prompt\": \"替换这张图像的背景\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.evolink.ai/v1/images/generations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"qwen-image-edit-plus\",\n \"prompt\": \"替换这张图像的背景\"\n}"
response = http.request(request)
puts response.read_body{
"created": 1757156493,
"id": "task-unified-1757156493-imcg5zqt",
"model": "qwen-image-edit-plus",
"object": "image.generation.task",
"progress": 0,
"status": "pending",
"task_info": {
"can_cancel": true,
"estimated_time": 30
},
"type": "image",
"usage": {
"billing_rule": "per_call",
"credits_reserved": 1,
"user_group": "default"
}
}{
"error": {
"code": "invalid_request",
"message": "Invalid request parameters",
"type": "invalid_request_error"
}
}{
"error": {
"code": "unauthorized",
"message": "Invalid or expired token",
"type": "authentication_error"
}
}{
"error": {
"code": "insufficient_quota",
"message": "Insufficient quota. Please top up your account.",
"type": "insufficient_quota"
}
}{
"error": {
"code": "model_access_denied",
"message": "Token does not have access to model: qwen-image-edit-plus",
"type": "invalid_request_error"
}
}{
"error": {
"code": "rate_limit_exceeded",
"message": "Too many requests, please try again later",
"type": "rate_limit_error"
}
}{
"error": {
"code": "internal_error",
"message": "Internal server error",
"type": "api_error"
}
}授权
##所有接口均需要使用Bearer Token进行认证##
获取 API Key :
访问 API Key 管理页面 获取您的 API Key
使用时在请求头中添加:
Authorization: Bearer YOUR_API_KEY
请求体
application/json
模型名称
可用选项:
qwen-image-edit-plus 示例:
"qwen-image-edit-plus"
提示词,描述想要生成的图像,或描述如何编辑已输入的图像,限制为2000token
Maximum string length:
2000示例:
"替换这张图像的背景"
参考图像 URL列表
注意:
- 单次请求支持输入图像数量:
3张 - 图像的宽度和高度均需在
[384-3072]像素范围内。 - 支持的文件格式:
.jpg、.jpeg、.png、.bmp、.webp、.tiff - 图像 URL 需要服务器能直接查看,或者图像 URL 在访问时会直接进行下载(一般这种 URL 是以图像的扩展名作为结尾,例如
.png、.jpg)
示例:
[
"https://example.com/image1.png",
"https://example.com/image2.png"
]
规定生成图像的数量,支持[1,6]之间任意整数值
注意:
- 单次请求会根据
n的值进行预扣费,实际扣费以生成图像数量为准
必填范围:
1 <= x <= 6示例:
1
反向提示词,用来描述不希望在画面中看到的内容,可以对画面进行限制
注意:
- 支持中英文,长度上限
500个字符,每个汉字/字母占一个字符,超过部分会自动截断
Maximum string length:
500示例:
"低分辨率、错误、最差质量、低质量、残缺、多余的手指、比例不良"
生成图像的尺寸,支持像素格式:
- 宽度x高度,如:
1024x1024、1024x1536、1536x1024等在范围内的值 - 宽和高的取值范围均为
[512, 2048]像素 - 若不设置,输出图像将保持与原图相似的长宽比,接近
1024x1024分辨率
注意:
- 该参数仅在输出图像数量
n为1时可用,否则将报错
Pattern:
^[0-9]+x[0-9]+$示例:
"1024x1024"
是否开启prompt智能改写,开启后将使用大模型优化正向提示词,对描述性不足、较为简单的prompt提升效果较明显。默认值为true
示例:
true
是否在图像右下角添加 "Qwen-Image" 水印。默认值为false
示例:
false
随机数种子,取值范围[0, 2147483647],使用相同的seed参数值可使生成内容保持相对稳定
注意:
- 若不提供,算法将自动使用随机数种子
- 模型生成过程具有概率性,即使使用相同的seed,也不能保证每次生成结果完全一致
必填范围:
0 <= x <= 2147483647示例:
12345
任务完成后的HTTPS回调地址
回调时机:
- 任务完成(completed)、失败(failed)或取消(cancelled)时触发
- 在计费确认完成后发送
安全限制:
- 仅支持HTTPS协议
- 禁止回调到内网IP地址(127.0.0.1、10.x.x.x、172.16-31.x.x、192.168.x.x等)
- URL长度不超过
2048字符
回调机制:
- 超时时间:
10秒 - 失败后最多重试
3次(会分别在失败的1秒/2秒/4秒后进行重试) - 回调响应体格式与任务查询接口返回的格式一致
- 回调地址若返回2xx状态码视为成功,其他状态码会触发重试
示例:
"https://your-domain.com/webhooks/image-task-completed"
响应
图像任务创建成功
任务创建时间戳
示例:
1757156493
任务ID
示例:
"task-unified-1757156493-imcg5zqt"
实际使用的模型名称
示例:
"qwen-image-edit-plus"
任务的具体类型
可用选项:
image.generation.task 任务进度百分比 (0-100)
必填范围:
0 <= x <= 100示例:
0
任务状态
可用选项:
pending, processing, completed, failed 示例:
"pending"
异步任务信息
Show child attributes
Show child attributes
任务的输出类型
可用选项:
text, image, audio, video 示例:
"image"
使用量和计费信息
Show child attributes
Show child attributes