通义万相 Wan2 图生图
curl --request POST \
--url https://api.sinancode.com/v1/generate/bailian/wan2-image-to-image \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"images": [
"<string>"
],
"prompt": "<string>",
"negative_prompt": "<string>",
"seed": 1073741823,
"size": "<string>"
}
'import requests
url = "https://api.sinancode.com/v1/generate/bailian/wan2-image-to-image"
payload = {
"images": ["<string>"],
"prompt": "<string>",
"negative_prompt": "<string>",
"seed": 1073741823,
"size": "<string>"
}
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({
images: ['<string>'],
prompt: '<string>',
negative_prompt: '<string>',
seed: 1073741823,
size: '<string>'
})
};
fetch('https://api.sinancode.com/v1/generate/bailian/wan2-image-to-image', 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.sinancode.com/v1/generate/bailian/wan2-image-to-image",
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([
'images' => [
'<string>'
],
'prompt' => '<string>',
'negative_prompt' => '<string>',
'seed' => 1073741823,
'size' => '<string>'
]),
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.sinancode.com/v1/generate/bailian/wan2-image-to-image"
payload := strings.NewReader("{\n \"images\": [\n \"<string>\"\n ],\n \"prompt\": \"<string>\",\n \"negative_prompt\": \"<string>\",\n \"seed\": 1073741823,\n \"size\": \"<string>\"\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.sinancode.com/v1/generate/bailian/wan2-image-to-image")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"images\": [\n \"<string>\"\n ],\n \"prompt\": \"<string>\",\n \"negative_prompt\": \"<string>\",\n \"seed\": 1073741823,\n \"size\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sinancode.com/v1/generate/bailian/wan2-image-to-image")
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 \"images\": [\n \"<string>\"\n ],\n \"prompt\": \"<string>\",\n \"negative_prompt\": \"<string>\",\n \"seed\": 1073741823,\n \"size\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"task_id": "01234567-89ab-cdef-0123-456789abcdef"
}{
"error_code": "<string>",
"message": "<string>"
}{
"error_code": "<string>",
"message": "<string>"
}{
"error_code": "<string>",
"message": "<string>"
}{
"error_code": "<string>",
"message": "<string>"
}图片生成 - Wan2
Wan2 图生图
使用通义万相 Wan2 图生图模型(wan2.5-i2i-preview)进行图像编辑和多图融合
POST
/
generate
/
bailian
/
wan2-image-to-image
通义万相 Wan2 图生图
curl --request POST \
--url https://api.sinancode.com/v1/generate/bailian/wan2-image-to-image \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"images": [
"<string>"
],
"prompt": "<string>",
"negative_prompt": "<string>",
"seed": 1073741823,
"size": "<string>"
}
'import requests
url = "https://api.sinancode.com/v1/generate/bailian/wan2-image-to-image"
payload = {
"images": ["<string>"],
"prompt": "<string>",
"negative_prompt": "<string>",
"seed": 1073741823,
"size": "<string>"
}
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({
images: ['<string>'],
prompt: '<string>',
negative_prompt: '<string>',
seed: 1073741823,
size: '<string>'
})
};
fetch('https://api.sinancode.com/v1/generate/bailian/wan2-image-to-image', 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.sinancode.com/v1/generate/bailian/wan2-image-to-image",
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([
'images' => [
'<string>'
],
'prompt' => '<string>',
'negative_prompt' => '<string>',
'seed' => 1073741823,
'size' => '<string>'
]),
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.sinancode.com/v1/generate/bailian/wan2-image-to-image"
payload := strings.NewReader("{\n \"images\": [\n \"<string>\"\n ],\n \"prompt\": \"<string>\",\n \"negative_prompt\": \"<string>\",\n \"seed\": 1073741823,\n \"size\": \"<string>\"\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.sinancode.com/v1/generate/bailian/wan2-image-to-image")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"images\": [\n \"<string>\"\n ],\n \"prompt\": \"<string>\",\n \"negative_prompt\": \"<string>\",\n \"seed\": 1073741823,\n \"size\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.sinancode.com/v1/generate/bailian/wan2-image-to-image")
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 \"images\": [\n \"<string>\"\n ],\n \"prompt\": \"<string>\",\n \"negative_prompt\": \"<string>\",\n \"seed\": 1073741823,\n \"size\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"task_id": "01234567-89ab-cdef-0123-456789abcdef"
}{
"error_code": "<string>",
"message": "<string>"
}{
"error_code": "<string>",
"message": "<string>"
}{
"error_code": "<string>",
"message": "<string>"
}{
"error_code": "<string>",
"message": "<string>"
}使用阿里云通义万相 Wan2.5 模型进行图像编辑和多图融合。
模型特点:
- 主体一致性 - 基于主体一致性的图像编辑能力
- 多图融合 - 支持多图输入实现创意融合
- 一句话P图 - 通过简单文本指令完成复杂编辑
- 中文原生 - 直接使用中文描述编辑需求
授权
请使用您的 API Token 进行认证
请求体
application/json
任务参数
输入图片 URL 列表(必填,1-3张) 支持公网 URL(HTTP/HTTPS)或 Base64 编码
Required array length:
1 - 3 elements正向提示词(必填,最大 2000 字符)
Required string length:
1 - 2000负向提示词(可选,最大 500 字符)
Maximum string length:
500随机种子(可选,范围 0-2147483647)
必填范围:
0 <= x <= 2147483647输出分辨率(可选,默认 12801280) 总像素 [768768, 1280*1280],宽高比 [1:4, 4:1]
响应
OK
Task ID
示例:
"01234567-89ab-cdef-0123-456789abcdef"
⌘I