- 万相 2.7 图像系列,支持文生图、图生图(编辑)、交互式编辑、组图生成与多图参考
- 异步处理模式,提交后返回 task_id,需轮询查询接口获取结果
- 支持 1K / 2K / 4K 分辨率,
wan2.7-image-pro文生图最高支持 4K- 计费按成功生成的图片张数计算,与分辨率和宽高比无关
请求示例
bash
curl --request POST \
--url https://api.openveer.com/v1/images/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "wan2.7-image-pro",
"prompt": "一间有着精致窗户的花店,漂亮的木质门,摆放着花朵"
}'
```python
import requests
url = "https://api.openveer.com/v1/images/generations"
payload = {
"model": "wan2.7-image-pro",
"prompt": "一间有着精致窗户的花店,漂亮的木质门,摆放着花朵"
}
headers = {
"Authorization": "Bearer
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.json())
```
```javascript
const url = "https://api.openveer.com/v1/images/generations";
const payload = {
model: "wan2.7-image-pro",
prompt: "一间有着精致窗户的花店,漂亮的木质门,摆放着花朵"
};
const headers = {
"Authorization": "Bearer
"Content-Type": "application/json"
};
fetch(url, {
method: "POST",
headers: headers,
body: JSON.stringify(payload)
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));
```
```go
package main
import (
"bytes"
"encoding/json"
"fmt"
"io/ioutil"
"net/http"
)
func main() {
url := "https://api.openveer.com/v1/images/generations"
payload := map[string]interface{}{
"model": "wan2.7-image-pro",
"prompt": "一间有着精致窗户的花店,漂亮的木质门,摆放着花朵",
}
jsonData, _ := json.Marshal(payload)
req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
req.Header.Set("Authorization", "Bearer <token>")
req.Header.Set("Content-Type", "application/json")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := ioutil.ReadAll(resp.Body)
fmt.Println(string(body))
}
```
```java
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.URI;
public class Main {
public static void main(String[] args) throws Exception {
String url = "https://api.openveer.com/v1/images/generations";
String payload = """
{
"model": "wan2.7-image-pro",
"prompt": "一间有着精致窗户的花店,漂亮的木质门,摆放着花朵"
}
""";
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(url))
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.POST(HttpRequest.BodyPublishers.ofString(payload))
.build();
HttpResponse<String> response = client.send(request,
HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}
```
```php
"wan2.7-image-pro",
"prompt" => "一间有着精致窗户的花店,漂亮的木质门,摆放着花朵"
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
"Authorization: Bearer
```
```ruby
require 'net/http'
require 'json'
require 'uri'
url = URI("https://api.openveer.com/v1/images/generations")
payload = {
model: "wan2.7-image-pro",
prompt: "一间有着精致窗户的花店,漂亮的木质门,摆放着花朵"
}
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = "Bearer
request["Content-Type"] = "application/json"
request.body = payload.to_json
response = http.request(request)
puts response.body
```
```swift
import Foundation
let url = URL(string: "https://api.openveer.com/v1/images/generations")!
let payload: [String: Any] = [
"model": "wan2.7-image-pro",
"prompt": "一间有着精致窗户的花店,漂亮的木质门,摆放着花朵"
]
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.setValue("Bearer
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
request.httpBody = try? JSONSerialization.data(withJSONObject: payload)
let task = URLSession.shared.dataTask(with: request) { data, response, error in
if let error = error { print("Error: (error)"); return }
if let data = data, let str = String(data: data, encoding: .utf8) { print(str) }
}
task.resume()
```
```csharp
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
class Program
{
static async Task Main(string[] args)
{
var payload = @"{
""model"": ""wan2.7-image-pro"",
""prompt"": ""一间有着精致窗户的花店,漂亮的木质门,摆放着花朵""
}";
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization", "Bearer <token>");
var content = new StringContent(payload, Encoding.UTF8, "application/json");
var response = await client.PostAsync(
"https://api.openveer.com/v1/images/generations", content);
Console.WriteLine(await response.Content.ReadAsStringAsync());
}
}
```
响应示例
json
{
"code": "success",
"data": [
{
"task_id": "task_01HX...",
"status": "processing"
}
]
}
json
{
"error": {
"code": 400,
"message": "请求参数无效",
"type": "invalid_request_error"
}
}
json
{
"error": {
"code": 401,
"message": "身份验证失败,请检查您的API密钥",
"type": "authentication_error"
}
}
json
{
"error": {
"code": 402,
"message": "账户余额不足,请充值后再试",
"type": "payment_required"
}
}
json
{
"error": {
"code": 429,
"message": "请求过于频繁,请稍后再试",
"type": "rate_limit_error"
}
}
json
{
"error": {
"code": 500,
"message": "服务器内部错误,请稍后重试",
"type": "server_error"
}
}
Authorizations
Authorization string可用模型
| 模型名称 | 简介 | 文生图最高分辨率 | 图像编辑/组图最高分辨率 | 单价 |
|---|---|---|---|---|
wan2.7-image-pro |
专业版,细节更好,支持 4K | 4K | 2K | ¥0.50 / 张 |
wan2.7-image |
标准版,速度更快 | 2K | 2K | ¥0.20 / 张 |
Body
model stringprompt stringimage_urls stringn integersize stringresolution stringnegative_prompt stringwatermark booleanseed integerthinking_mode booleanenable_sequential booleanbbox_list arraycolor_palette stringResponse
code stringdata arraystatus string示例
文生图(最简请求)
{
"model": "wan2.7-image-pro",
"prompt": "一间有着精致窗户的花店,漂亮的木质门,摆放着花朵"
}
文生图(指定分辨率)
{
"model": "wan2.7-image-pro",
"prompt": "夏日海滩,蓝天白云,4K 高清",
"size": "4K",
"thinking_mode": true
}
文生图(自定义颜色主题)
{
"model": "wan2.7-image-pro",
"prompt": "极简风格的现代客厅",
"size": "2K",
"color_palette": [
{ "hex": "#C2D1E6", "ratio": "23.51%" },
{ "hex": "#CDD8E9", "ratio": "20.13%" },
{ "hex": "#B5C8DB", "ratio": "15.88%" },
{ "hex": "#C0B5B4", "ratio": "13.27%" },
{ "hex": "#DAE0EC", "ratio": "10.11%" },
{ "hex": "#636574", "ratio": "8.93%" },
{ "hex": "#CACAD2", "ratio": "5.55%" },
{ "hex": "#CBD4E4", "ratio": "2.62%" }
]
}
组图生成
{
"model": "wan2.7-image-pro",
"prompt": "电影感组图:同一只流浪橘猫,前后特征必须一致。第一张春天樱花树下,第二张夏天老街树荫,第三张秋天落叶满地,第四张冬天雪地脚印。",
"enable_sequential": true,
"n": 4,
"size": "2K"
}
单图编辑
{
"model": "wan2.7-image",
"prompt": "把背景换成日落场景,整体偏暖色调",
"image_urls": ["https://example.com/portrait.jpg"],
"size": "2K"
}
多图参考 / 元素融合
{
"model": "wan2.7-image-pro",
"prompt": "把图2的涂鸦喷绘在图1的汽车上",
"image_urls": [
"https://example.com/car.webp",
"https://example.com/paint.webp"
],
"size": "2K"
}
交互式编辑(框选区域)
通过 bbox_list 精确指定编辑位置,与 image_urls 一一对应,无需框选的图片传 []。
{
"model": "wan2.7-image-pro",
"prompt": "把图1的闹钟放在图2的框选位置,保持场景和光线融合自然",
"image_urls": [
"https://example.com/clock.webp",
"https://example.com/desk.webp"
],
"bbox_list": [
[],
[[989, 515, 1138, 681]]
],
"size": "2K"
}