跳转到主要内容
POST
/
v1
/
images
/
generations
图像生成 / 编辑
curl --request POST \
  --url https://www.anyfast.ai/v1/images/generations \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "model": "wan2.7-image-pro",
  "prompt": "一间有着精致窗户的花店,漂亮的木质门,摆放着花朵",
  "image": "https://example.com/input.jpg",
  "n": 1,
  "size": "2K",
  "enable_sequential": false,
  "thinking_mode": true,
  "watermark": false,
  "seed": 1073741823,
  "response_format": "url"
}
'
import requests

url = "https://www.anyfast.ai/v1/images/generations"

payload = {
"model": "wan2.7-image-pro",
"prompt": "一间有着精致窗户的花店,漂亮的木质门,摆放着花朵",
"image": "https://example.com/input.jpg",
"n": 1,
"size": "2K",
"enable_sequential": False,
"thinking_mode": True,
"watermark": False,
"seed": 1073741823,
"response_format": "url"
}
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: 'wan2.7-image-pro',
prompt: '一间有着精致窗户的花店,漂亮的木质门,摆放着花朵',
image: 'https://example.com/input.jpg',
n: 1,
size: '2K',
enable_sequential: false,
thinking_mode: true,
watermark: false,
seed: 1073741823,
response_format: 'url'
})
};

fetch('https://www.anyfast.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://www.anyfast.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' => 'wan2.7-image-pro',
'prompt' => '一间有着精致窗户的花店,漂亮的木质门,摆放着花朵',
'image' => 'https://example.com/input.jpg',
'n' => 1,
'size' => '2K',
'enable_sequential' => false,
'thinking_mode' => true,
'watermark' => false,
'seed' => 1073741823,
'response_format' => 'url'
]),
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://www.anyfast.ai/v1/images/generations"

payload := strings.NewReader("{\n \"model\": \"wan2.7-image-pro\",\n \"prompt\": \"一间有着精致窗户的花店,漂亮的木质门,摆放着花朵\",\n \"image\": \"https://example.com/input.jpg\",\n \"n\": 1,\n \"size\": \"2K\",\n \"enable_sequential\": false,\n \"thinking_mode\": true,\n \"watermark\": false,\n \"seed\": 1073741823,\n \"response_format\": \"url\"\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://www.anyfast.ai/v1/images/generations")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"wan2.7-image-pro\",\n \"prompt\": \"一间有着精致窗户的花店,漂亮的木质门,摆放着花朵\",\n \"image\": \"https://example.com/input.jpg\",\n \"n\": 1,\n \"size\": \"2K\",\n \"enable_sequential\": false,\n \"thinking_mode\": true,\n \"watermark\": false,\n \"seed\": 1073741823,\n \"response_format\": \"url\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://www.anyfast.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\": \"wan2.7-image-pro\",\n \"prompt\": \"一间有着精致窗户的花店,漂亮的木质门,摆放着花朵\",\n \"image\": \"https://example.com/input.jpg\",\n \"n\": 1,\n \"size\": \"2K\",\n \"enable_sequential\": false,\n \"thinking_mode\": true,\n \"watermark\": false,\n \"seed\": 1073741823,\n \"response_format\": \"url\"\n}"

response = http.request(request)
puts response.read_body
{
  "created": 1773803391,
  "data": [
    {
      "url": "https://example.com/generated.png",
      "b64_json": "<string>",
      "revised_prompt": "<string>"
    }
  ]
}

授权

Authorization
string
header
必填

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

请求体

application/json
model
enum<string>
必填

模型 ID。wan2.7-image-pro 文生图支持 4K 输出;wan2.7-image 生成速度更快。

可用选项:
wan2.7-image-pro,
wan2.7-image
示例:

"wan2.7-image-pro"

prompt
string
必填

图片描述文字,支持中英文,最多 5000 个字符。

示例:

"一间有着精致窗户的花店,漂亮的木质门,摆放着花朵"

image
string

编辑用输入图片 — URL(HTTP/HTTPS)或 Base64 数据 URI(data:{MIME};base64,{data})。 支持格式:JPEG、JPG、PNG(不支持透明通道)、BMP、WEBP。最大 20 MB,宽高 240–8000 px,宽高比 1:8–8:1。最多 9 张图片。

示例:

"https://example.com/input.jpg"

n
integer
默认值:1

生成图片张数。

  • 关闭组图模式(enable_sequential: false):1–4,默认 1
  • 开启组图模式(enable_sequential: true):1–12,默认 12,实际张数由模型决定。
必填范围: 1 <= x <= 12
示例:

1

size
string

输出分辨率,支持两种方式(不可混用):

  • 预设规格:1K(1024×1024)、2K(2048×2048,默认)、4K(4096×4096,仅 wan2.7-image-pro 文生图)。
  • 自定义像素:{宽}x{高} — 文生图总像素 768×768–4096×4096,其他场景最高 2048×2048,宽高比 1:8–8:1。
示例:

"2K"

enable_sequential
boolean
默认值:false

启用组图输出模式。为 true 时,n 表示最大生成张数,实际数量由模型决定。

thinking_mode
boolean
默认值:true

开启思考模式以增强推理能力、提升出图质量。仅在无图片输入且关闭组图模式时生效。

watermark
boolean
默认值:false

是否在生成图片右下角添加水印。

seed
integer

随机数种子,范围 [0, 2147483647]。相同种子可获得相近结果,但不保证完全一致。

必填范围: 0 <= x <= 2147483647
response_format
enum<string>
默认值:url

返回图片 URL 或 Base64 编码。

可用选项:
url,
b64_json
示例:

"url"

响应

图像生成成功

created
integer

创建时间戳

示例:

1773803391

data
object[]