Skip to content

Wan 2.7 Image

Wan 2.7 Image 是阿里巴巴在 Pixapi 上的 Wan 图片系列。从 wan2.7-image 切换到 wan2.7-image-pro 通常只需修改 model

API 形式

操作Endpoint模式
图片生成POST /v1/images/generations同步
图片生成任务POST /v1/async/images/generations异步
图片编辑POST /v1/images/edits同步
图片编辑任务POST /v1/async/images/edits异步

模型 id

模型 id适合
wan2.7-image标准 Wan 图片生成与编辑
wan2.7-image-pro更高规格的 Wan 图片输出

价格

模型 id每张积分
wan2.7-image3
wan2.7-image-pro7

请求字段

字段类型必填说明
modelstring使用 wan2.7-imagewan2.7-image-pro。模型 ID 区分大小写。
promptstring提示词,最长 2,000 字符。
imagestring | string[]编辑时必填公网图片 URL,或 URL 数组。
ninteger输出数量,默认 1,最大 9
sizestring上游支持的输出尺寸,将按原值透传。
qualitystring可选的上游质量参数。
output_formatstring上游支持时可传 png 等输出格式。
providerOptionsobject其他供应商扩展字段。

示例

bash
curl https://api.pixapi.ai/v1/images/generations \
  -H "Authorization: Bearer $PIXAPI_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"wan2.7-image","prompt":"暖灰背景上的简洁杂志风产品照片","n":1,"size":"1024x1024"}'
py
import os
import requests

response = requests.post(
    "https://api.pixapi.ai/v1/images/generations",
    headers={
        "Authorization": f"Bearer {os.environ['PIXAPI_KEY']}",
        "Content-Type": "application/json",
    },
    json={
  "model": "wan2.7-image",
  "prompt": "暖灰背景上的简洁杂志风产品照片",
  "n": 1,
  "size": "1024x1024"
},
)
response.raise_for_status()
print(response.json())
js
const response = await fetch('https://api.pixapi.ai/v1/images/generations', {
  method: 'POST',
  headers: {
    Authorization: `Bearer ${process.env.PIXAPI_KEY}`,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
  "model": "wan2.7-image",
  "prompt": "暖灰背景上的简洁杂志风产品照片",
  "n": 1,
  "size": "1024x1024"
}),
});

if (!response.ok) {
  throw new Error(await response.text());
}

console.log(await response.json());
go
package main

import (
  "bytes"
  "fmt"
  "io"
  "net/http"
  "os"
)

func main() {
  body := []byte(`{
  "model": "wan2.7-image",
  "prompt": "暖灰背景上的简洁杂志风产品照片",
  "n": 1,
  "size": "1024x1024"
}`)

  req, err := http.NewRequest(
    "POST",
    "https://api.pixapi.ai/v1/images/generations",
    bytes.NewBuffer(body),
  )
  if err != nil {
    panic(err)
  }
  req.Header.Set("Authorization", "Bearer "+os.Getenv("PIXAPI_KEY"))
  req.Header.Set("Content-Type", "application/json")

  resp, err := http.DefaultClient.Do(req)
  if err != nil {
    panic(err)
  }
  defer resp.Body.Close()

  result, _ := io.ReadAll(resp.Body)
  fmt.Println(string(result))
}

编辑图片

json
{
  "model": "wan2.7-image",
  "prompt": "把背景替换为极简摄影棚",
  "image": "https://example.com/input.png",
  "n": 1
}

异步请求与任务轮询请参阅异步媒体任务

统一响应结构见 API 参考