cURL
curl --request POST \
--url https://api.ttapi.io/sd/api/v3/images/generations/tasks \
--header 'Content-Type: application/json' \
--header 'TT-API-KEY: <api-key>' \
--data '
{
"model": "doubao-seedream-5-0-pro-260628",
"prompt": "将人物从背景中分离出来 <bbox>(0.1, 0.2, 0.8, 0.9)",
"image": "https://example.com/photo.jpg",
"layer_decomposition": true,
"watermark": false
}
'import requests
url = "https://api.ttapi.io/sd/api/v3/images/generations/tasks"
payload = {
"model": "doubao-seedream-5-0-pro-260628",
"prompt": "将人物从背景中分离出来 <bbox>(0.1, 0.2, 0.8, 0.9)",
"image": "https://example.com/photo.jpg",
"layer_decomposition": True,
"watermark": False
}
headers = {
"TT-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'TT-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'doubao-seedream-5-0-pro-260628',
prompt: '将人物从背景中分离出来 <bbox>(0.1, 0.2, 0.8, 0.9)',
image: 'https://example.com/photo.jpg',
layer_decomposition: true,
watermark: false
})
};
fetch('https://api.ttapi.io/sd/api/v3/images/generations/tasks', 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.ttapi.io/sd/api/v3/images/generations/tasks",
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' => 'doubao-seedream-5-0-pro-260628',
'prompt' => '将人物从背景中分离出来 <bbox>(0.1, 0.2, 0.8, 0.9)',
'image' => 'https://example.com/photo.jpg',
'layer_decomposition' => true,
'watermark' => false
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"TT-API-KEY: <api-key>"
],
]);
$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.ttapi.io/sd/api/v3/images/generations/tasks"
payload := strings.NewReader("{\n \"model\": \"doubao-seedream-5-0-pro-260628\",\n \"prompt\": \"将人物从背景中分离出来 <bbox>(0.1, 0.2, 0.8, 0.9)\",\n \"image\": \"https://example.com/photo.jpg\",\n \"layer_decomposition\": true,\n \"watermark\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("TT-API-KEY", "<api-key>")
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.ttapi.io/sd/api/v3/images/generations/tasks")
.header("TT-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"doubao-seedream-5-0-pro-260628\",\n \"prompt\": \"将人物从背景中分离出来 <bbox>(0.1, 0.2, 0.8, 0.9)\",\n \"image\": \"https://example.com/photo.jpg\",\n \"layer_decomposition\": true,\n \"watermark\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ttapi.io/sd/api/v3/images/generations/tasks")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["TT-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"doubao-seedream-5-0-pro-260628\",\n \"prompt\": \"将人物从背景中分离出来 <bbox>(0.1, 0.2, 0.8, 0.9)\",\n \"image\": \"https://example.com/photo.jpg\",\n \"layer_decomposition\": true,\n \"watermark\": false\n}"
response = http.request(request)
puts response.read_body{
"status": "PENDING_QUEUE",
"message": "success",
"id": "30d9b07d-7349-4cbc-8e11-9ba302c6d165"
}Seedream
图层拆分
图层拆分 - 提交异步图片生成任务,返回 id
POST
/
sd
/
api
/
v3
/
images
/
generations
/
tasks
cURL
curl --request POST \
--url https://api.ttapi.io/sd/api/v3/images/generations/tasks \
--header 'Content-Type: application/json' \
--header 'TT-API-KEY: <api-key>' \
--data '
{
"model": "doubao-seedream-5-0-pro-260628",
"prompt": "将人物从背景中分离出来 <bbox>(0.1, 0.2, 0.8, 0.9)",
"image": "https://example.com/photo.jpg",
"layer_decomposition": true,
"watermark": false
}
'import requests
url = "https://api.ttapi.io/sd/api/v3/images/generations/tasks"
payload = {
"model": "doubao-seedream-5-0-pro-260628",
"prompt": "将人物从背景中分离出来 <bbox>(0.1, 0.2, 0.8, 0.9)",
"image": "https://example.com/photo.jpg",
"layer_decomposition": True,
"watermark": False
}
headers = {
"TT-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'TT-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
model: 'doubao-seedream-5-0-pro-260628',
prompt: '将人物从背景中分离出来 <bbox>(0.1, 0.2, 0.8, 0.9)',
image: 'https://example.com/photo.jpg',
layer_decomposition: true,
watermark: false
})
};
fetch('https://api.ttapi.io/sd/api/v3/images/generations/tasks', 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.ttapi.io/sd/api/v3/images/generations/tasks",
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' => 'doubao-seedream-5-0-pro-260628',
'prompt' => '将人物从背景中分离出来 <bbox>(0.1, 0.2, 0.8, 0.9)',
'image' => 'https://example.com/photo.jpg',
'layer_decomposition' => true,
'watermark' => false
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"TT-API-KEY: <api-key>"
],
]);
$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.ttapi.io/sd/api/v3/images/generations/tasks"
payload := strings.NewReader("{\n \"model\": \"doubao-seedream-5-0-pro-260628\",\n \"prompt\": \"将人物从背景中分离出来 <bbox>(0.1, 0.2, 0.8, 0.9)\",\n \"image\": \"https://example.com/photo.jpg\",\n \"layer_decomposition\": true,\n \"watermark\": false\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("TT-API-KEY", "<api-key>")
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.ttapi.io/sd/api/v3/images/generations/tasks")
.header("TT-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"doubao-seedream-5-0-pro-260628\",\n \"prompt\": \"将人物从背景中分离出来 <bbox>(0.1, 0.2, 0.8, 0.9)\",\n \"image\": \"https://example.com/photo.jpg\",\n \"layer_decomposition\": true,\n \"watermark\": false\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.ttapi.io/sd/api/v3/images/generations/tasks")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["TT-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"model\": \"doubao-seedream-5-0-pro-260628\",\n \"prompt\": \"将人物从背景中分离出来 <bbox>(0.1, 0.2, 0.8, 0.9)\",\n \"image\": \"https://example.com/photo.jpg\",\n \"layer_decomposition\": true,\n \"watermark\": false\n}"
response = http.request(request)
puts response.read_body{
"status": "PENDING_QUEUE",
"message": "success",
"id": "30d9b07d-7349-4cbc-8e11-9ba302c6d165"
}这是 Seedream 图片生成 API 的图层拆分接口。将单张图片拆解为底图(1 张)+ 多个图层输出(最多 16 个图层)。仅 Seedream 5.0 pro / flash 支持。提交异步任务后返回
id,需通过查询接口获取结果。
使用方式:在
prompt 中使用 <bbox> 坐标标注需要拆分的区域,设置 layer_decomposition: true 开启图层拆分模式。请求体
application/json
图层拆分请求参数
模型名称。
可用选项:
doubao-seedream-5-0-pro-260628, doubao-seedream-5-0-flash-260915 文本提示词,使用 坐标标注需要拆分的区域。
待拆分的图片 URL。
是否开启图层拆分模式。true=图层拆分,将输入图拆解为底图和多个图层(最多 16 个);false=图片生成模式。仅 Seedream 5.0 pro/flash 支持。
可用选项:
true, false 图像尺寸。图层拆分场景可选:1K、1.5K、2K、auto(默认 auto,自动保持与输入图一致)。不支持指定像素值。
可用选项:
1K, 1.5K, 2K, auto 输出图像格式。图层拆分场景下仅控制底图格式,图层始终以 png 输出。
可用选项:
png, jpeg 返回格式。
可用选项:
url, b64_json 是否添加水印。true=右下角显示「AI 生成」,false=不添加。
可用选项:
true, false 示例:
false
提示词优化配置
Show child attributes
Show child attributes
任务超时阈值(秒)。范围 [3600, 259200](1~72 小时),默认 172800(48 小时)
执行优先级。范围 [0, 9],数值越大优先级越高,默认 0(FIFO)
终端用户唯一标识符,不超过 64 字符。建议传入哈希处理后的字符串
最后修改于 2026年10月23日