跳转到主要内容
POST
/
v3
/
seedream-4.0
Seedream 图片生成 4.0
curl --request POST \
  --url https://api.highwayapi.ai/v3/seedream-4.0 \
  --header 'Authorization: <authorization>' \
  --header 'Content-Type: <content-type>' \
  --data '
{
  "prompt": "<string>",
  "images": [
    "<string>"
  ],
  "size": "<string>",
  "sequential_image_generation": "<string>",
  "max_images": 123,
  "watermark": true
}
'
import requests

url = "https://api.highwayapi.ai/v3/seedream-4.0"

payload = {
"prompt": "<string>",
"images": ["<string>"],
"size": "<string>",
"sequential_image_generation": "<string>",
"max_images": 123,
"watermark": True
}
headers = {
"Content-Type": "<content-type>",
"Authorization": "<authorization>"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {'Content-Type': '<content-type>', Authorization: '<authorization>'},
body: JSON.stringify({
prompt: '<string>',
images: ['<string>'],
size: '<string>',
sequential_image_generation: '<string>',
max_images: 123,
watermark: true
})
};

fetch('https://api.highwayapi.ai/v3/seedream-4.0', 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.highwayapi.ai/v3/seedream-4.0",
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([
'prompt' => '<string>',
'images' => [
'<string>'
],
'size' => '<string>',
'sequential_image_generation' => '<string>',
'max_images' => 123,
'watermark' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: <authorization>",
"Content-Type: <content-type>"
],
]);

$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.highwayapi.ai/v3/seedream-4.0"

payload := strings.NewReader("{\n \"prompt\": \"<string>\",\n \"images\": [\n \"<string>\"\n ],\n \"size\": \"<string>\",\n \"sequential_image_generation\": \"<string>\",\n \"max_images\": 123,\n \"watermark\": true\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Content-Type", "<content-type>")
req.Header.Add("Authorization", "<authorization>")

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.highwayapi.ai/v3/seedream-4.0")
.header("Content-Type", "<content-type>")
.header("Authorization", "<authorization>")
.body("{\n \"prompt\": \"<string>\",\n \"images\": [\n \"<string>\"\n ],\n \"size\": \"<string>\",\n \"sequential_image_generation\": \"<string>\",\n \"max_images\": 123,\n \"watermark\": true\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.highwayapi.ai/v3/seedream-4.0")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Content-Type"] = '<content-type>'
request["Authorization"] = '<authorization>'
request.body = "{\n \"prompt\": \"<string>\",\n \"images\": [\n \"<string>\"\n ],\n \"size\": \"<string>\",\n \"sequential_image_generation\": \"<string>\",\n \"max_images\": 123,\n \"watermark\": true\n}"

response = http.request(request)
puts response.read_body
{
  "images": [
    "<string>"
  ]
}
Seedream 4.0 是一款先进的图像生成模型,提供灵活的图像创建功能,包括支持 4K 分辨率,可以从文本和其他图像生成图像。

请求头

Content-Type
string
必填
枚举值: application/json
Authorization
string
必填
Bearer 身份验证格式: Bearer {{API 秘钥}}。

请求体

prompt
string
必填
用于生成图像的提示词,支持中英文。建议不超过 300 个汉字或 600 个英文单词。字数过多信息容易分散,模型可能因此忽略细节,只关注重点,造成视图片缺失部分元素。
images
string[]
输入要编辑的图像的 Base64 编码或可访问的 URL。支持输入单张或多张图像。
  • 图像 URL:确保图像 URL 可访问。
  • Base64 编码:格式必须为data:image/<图像格式>;base64,<Base64 编码>
    输入图像必须满足以下要求:
    • 图像格式:jpeg, png
    • 宽高比(宽度/高度):范围为[1/3, 3]
    • 宽度和高度(像素):> 14
    • 大小:不超过 10 MB
    • 总像素值:不超过 6000×6000 PX
    • 支持上传最多 10 张参考图像。
size
string
设置生成图像的规格。有两种方法可用,但不能同时使用。
  • 方法 1,指定分辨率。
    • 可选值:1K, 2K, 4K
  • 方法 2,指定生成图像的宽度和高度(像素)。
    • 默认值:2048x2048
    • 总像素值范围:[1024x1024, 4096x4096]
    • 宽高比值范围:[1/16, 16]
推荐的宽度和高度:
宽高比宽度和高度像素值
1:12048x2048
4:32304x1728
3:41728x2304
16:92560x1440
9:161440x2560
3:22496x1664
2:31664x2496
21:93024x1296
sequential_image_generation
string
默认值:"disabled"
控制是否禁用批量生成功能。
  • auto:在自动模式下,模型会根据用户的提示词自动决定是否返回多张图像以及包含多少张图像。
  • disabled:禁用批量生成功能。模型将只生成一张图像。
max_images
integer
默认值:15
指定此请求中要生成的最大图像数量。此参数仅在sequential_image_generation设置为auto时有效。取值范围:[1, 15]
说明实际生成的图像数量受max_images和输入参考图像数量的影响。输入参考图像数量 + 生成图像数量 ≤ 15。
watermark
boolean
默认值:true
为生成的图像添加水印。
  • false:不添加水印。
  • true:在图像的右下角添加带有 “AI 生成” 文字的水印。

响应信息

images
string[]
包含生成图像下载链接的数组。