curl --request POST \
--url https://api.apiyi.com/v1/images/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "seedream-5-0-260128",
"prompt": "Replace the clothing in image 1 with the outfit from image 2."
}
'import requests
url = "https://api.apiyi.com/v1/images/generations"
payload = {
"model": "seedream-5-0-260128",
"prompt": "Replace the clothing in image 1 with the outfit from image 2."
}
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: 'seedream-5-0-260128',
prompt: 'Replace the clothing in image 1 with the outfit from image 2.'
})
};
fetch('https://api.apiyi.com/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://api.apiyi.com/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' => 'seedream-5-0-260128',
'prompt' => 'Replace the clothing in image 1 with the outfit from image 2.'
]),
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://api.apiyi.com/v1/images/generations"
payload := strings.NewReader("{\n \"model\": \"seedream-5-0-260128\",\n \"prompt\": \"Replace the clothing in image 1 with the outfit from image 2.\"\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://api.apiyi.com/v1/images/generations")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"seedream-5-0-260128\",\n \"prompt\": \"Replace the clothing in image 1 with the outfit from image 2.\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.apiyi.com/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\": \"seedream-5-0-260128\",\n \"prompt\": \"Replace the clothing in image 1 with the outfit from image 2.\"\n}"
response = http.request(request)
puts response.read_body{
"model": "seedream-5-0-260128",
"created": 1768518000,
"data": [
{
"url": "https://ark-content-generation-v2-ap-southeast-1.tos-ap-southeast-1.bytepluses.com/.../image.png",
"b64_json": "<string>",
"size": "2048x2048"
}
],
"usage": {
"generated_images": 1,
"output_tokens": 6240,
"total_tokens": 6240
}
}이미지 편집 API 레퍼런스
Seedream 이미지 편집, 다중 이미지 융합, 배치 시퀀스 생성 API 레퍼런스 및 라이브 플레이그라운드 — image 배열과 sequential_image_generation 파라미터로 전환되는 동일한 generations 엔드포인트
curl --request POST \
--url https://api.apiyi.com/v1/images/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "seedream-5-0-260128",
"prompt": "Replace the clothing in image 1 with the outfit from image 2."
}
'import requests
url = "https://api.apiyi.com/v1/images/generations"
payload = {
"model": "seedream-5-0-260128",
"prompt": "Replace the clothing in image 1 with the outfit from image 2."
}
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: 'seedream-5-0-260128',
prompt: 'Replace the clothing in image 1 with the outfit from image 2.'
})
};
fetch('https://api.apiyi.com/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://api.apiyi.com/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' => 'seedream-5-0-260128',
'prompt' => 'Replace the clothing in image 1 with the outfit from image 2.'
]),
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://api.apiyi.com/v1/images/generations"
payload := strings.NewReader("{\n \"model\": \"seedream-5-0-260128\",\n \"prompt\": \"Replace the clothing in image 1 with the outfit from image 2.\"\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://api.apiyi.com/v1/images/generations")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"seedream-5-0-260128\",\n \"prompt\": \"Replace the clothing in image 1 with the outfit from image 2.\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.apiyi.com/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\": \"seedream-5-0-260128\",\n \"prompt\": \"Replace the clothing in image 1 with the outfit from image 2.\"\n}"
response = http.request(request)
puts response.read_body{
"model": "seedream-5-0-260128",
"created": 1768518000,
"data": [
{
"url": "https://ark-content-generation-v2-ap-southeast-1.tos-ap-southeast-1.bytepluses.com/.../image.png",
"b64_json": "<string>",
"size": "2048x2048"
}
],
"usage": {
"generated_images": 1,
"output_tokens": 6240,
"total_tokens": 6240
}
}/v1/images/edits 엔드포인트가 없습니다. 편집, 다중 이미지 융합, 배치 시퀀스는 모두 POST /v1/images/generations를 통해 실행됩니다. 이 페이지의 Playground는 Text-to-Image와 동일한 엔드포인트를 사용하며, 차이는 본문에 있는 image 및 sequential_image_generation 파라미터뿐입니다.- 단일 이미지 편집 —
image: ["url"]+sequential_image_generation: "disabled" - 다중 이미지 융합 —
image: ["url1", "url2", ...]+disabled - 배치 시퀀스 —
sequential_image_generation: "auto"+sequential_image_generation_options.max_images: N - 이미지-시퀀스 — 두 가지를 결합합니다:
image배열 +auto+max_images
response_format: "url" 모드에서는 Playground가 정상적으로 작동합니다(응답은 임시 BytePlus TOS 링크일 뿐입니다). response_format: "b64_json"로 전환하면 응답에 수 MB의 base64 문자열이 포함되어 브라우저 Playground에 请求时发生错误: unable to complete request가 표시될 수 있습니다 — 실제로 요청은 성공한 것입니다; 브라우저가 이렇게 긴 base64 문자열을 렌더링하지 못할 뿐입니다.권장 작업 흐름:- 이미지만 보고 싶으신가요? 기본
url모드를 유지하십시오 — Playground가 링크를 직접 반환합니다(24시간 이내에 자체 저장소로 다운로드해야 합니다). - b64_json이 필요하신가요? 아래 코드 샘플을 복사하여 로컬에서 실행하십시오 — 코드는 이미지를 자동으로 디코딩하여 파일로 저장합니다.
- multipart/form-data 업로드는 없습니다 — 먼저 이미지를 OSS 또는 공개 이미지 호스트에 업로드한 다음,
image배열에 URL을 전달하십시오 image는 URL 배열이며, 반복되는image[]필드가 아닙니다(OpenAI의multipart/form-data형식과는 다릅니다)mask필드가 없습니다 — Seedream은 알파 채널 마스크 인페인팅을 지원하지 않으며, 전체 이미지는 프롬프트에 의해 다시 작성됩니다- 총 개수의 하드 제한: 입력 참조 + 출력 ≤ 15개 이미지
image 배열에 있는 URL의 순서가 프롬프트에서 참조하는 「이미지 1 / 이미지 2 / 이미지 3」이 됩니다. 순서를 명시적으로 지정하십시오:이미지 1의 의상을 이미지 2의 복장으로 바꾸고, 이미지 3의 조명을 유지하십시오.영어 프롬프트가 가장 잘 작동합니다(모델은 주로 영어로 학습되었습니다). 다만 표현이 모호하지 않다면 중국어도 지원됩니다.
코드 예시
extra_body에 대하여(중요 — 추가 중첩 계층이라고 오해하지 마십시오)image, sequential_image_generation, watermark는 OpenAI SDK의 images.generate()에 대한 표준 매개변수가 아니므로, Python SDK에서는 전송하려면 반드시 extra_body 안에 넣어야 합니다.하지만 extra_body는 단지 SDK의 매개변수 컨테이너일 뿐입니다. 그 필드들은 요청 본문의 최상위로 평탄화되어 병합되며, model 및 prompt와 동일한 수준에 있습니다. 실제로 전송되는 JSON은 아래 cURL 예시와 동일하며(image가 최상위에 있음), 요청에는 실제 "extra_body": {...} 중첩이 없습니다.OpenAI SDK를 사용하지 않고 JSON을 직접 구성하는 경우(requests / fetch / 등), extra_body를 작성하지 마십시오. image와 다른 필드들을 model와 같은 수준에 두기만 하면 됩니다.Python (OpenAI SDK · 단일 이미지 편집)
from openai import OpenAI
client = OpenAI(
api_key="sk-your-api-key",
base_url="https://api.apiyi.com/v1"
)
resp = client.images.generate(
model="seedream-5-0-260128",
prompt="Generate a close-up image of a dog lying on lush grass.",
size="2K",
response_format="url",
# Fields in extra_body are flattened to the top level of the request body
# (same level as model) by the SDK — not an extra nesting layer
extra_body={
"image": ["https://your-oss.example.com/source-photo.png"],
"sequential_image_generation": "disabled",
"watermark": False,
}
)
print(resp.data[0].url)
Python (OpenAI SDK · 다중 이미지 융합)
resp = client.images.generate(
model="seedream-4-5-251128",
prompt="Replace the clothing in image 1 with the outfit from image 2, keeping the lighting style of image 3.",
size="4K",
response_format="url",
extra_body={
"image": [
"https://your-oss.example.com/person.png",
"https://your-oss.example.com/outfit.png",
"https://your-oss.example.com/lighting-ref.png",
],
"sequential_image_generation": "disabled",
"watermark": False,
}
)
print(resp.data[0].url)
Python (OpenAI SDK · 배치 순서)
resp = client.images.generate(
model="seedream-5-0-260128",
prompt=(
"Generate four cinematic sci-fi storyboard scenes:"
"Scene 1 — astronaut repairing a spacecraft;"
"Scene 2 — meteor strike in deep space;"
"Scene 3 — emergency dodge in zero gravity;"
"Scene 4 — astronaut returning to ship."
),
size="2K",
response_format="url",
extra_body={
"sequential_image_generation": "auto",
"sequential_image_generation_options": {"max_images": 4},
"watermark": False,
}
)
for item in resp.data:
print(item.url)
cURL (다중 이미지 융합)
curl -X POST "https://api.apiyi.com/v1/images/generations" \
-H "Authorization: Bearer sk-your-api-key" \
-H "Content-Type: application/json" \
-d '{
"model": "seedream-5-0-260128",
"prompt": "Replace the clothing in image 1 with the outfit from image 2.",
"image": [
"https://your-oss.example.com/person.png",
"https://your-oss.example.com/outfit.png"
],
"sequential_image_generation": "disabled",
"size": "2K",
"response_format": "url",
"watermark": false
}'
Node.js (fetch · 배치 순서)
const resp = await fetch('https://api.apiyi.com/v1/images/generations', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer sk-your-api-key'
},
body: JSON.stringify({
model: 'seedream-5-0-260128',
prompt: 'A four-panel comic about a cat astronaut: launch, space walk, alien encounter, return home.',
size: '2K',
sequential_image_generation: 'auto',
sequential_image_generation_options: { max_images: 4 },
response_format: 'url',
watermark: false
})
});
const { data } = await resp.json();
data.forEach((item, i) => console.log(`#${i + 1}:`, item.url));
매개변수 참조
| 매개변수 | 유형 | 필수 | 기본값 | 설명 |
|---|---|---|---|---|
model | string | 예 | — | seedream-5-0-260128 / seedream-4-5-251128 / seedream-4-0-250828 / seedream-5-0-pro-260628 (Pro 티어, $0.12/요청) |
prompt | string | 예 | — | 편집 / 융합 / 시퀀스 지시문 |
image | string 배열 | 편집에 필요함 | — | URL 또는 base64 데이터 URI 형식의 참조 이미지(data:image/jpeg;base64,..., 검증됨), 최대 10개(공식 4.5 / 5.0-pro 문서 기준) |
sequential_image_generation | string | 아니요 | disabled | 단일 출력용 disabled; 배치 시퀀스용 auto. 5.0-pro에서는 지원되지 않습니다: 어떤 값이든(disabled 포함) 400을 반환하므로 — Pro에서는 매개변수를 완전히 생략하십시오 |
sequential_image_generation_options.max_images | 정수 | 아니요 | — | auto와 함께 사용할 때만 유효합니다. 입력 + 출력 ≤ 15의 제한을 받습니다. 또한 5.0-pro에서는 지원되지 않습니다 |
size | string | 아니요 | 2K | 사전 설정된 티어 또는 정확한 픽셀 — 티어 지원은 버전에 따라 다릅니다(개요 참조) |
response_format | string | 아니요 | url | url / b64_json |
output_format | string | 아니요 | jpeg | 5.0 / 5.0-pro는 png / jpeg를 지원하며; 4.5 / 4.0에서는 jpeg만 지원합니다 |
watermark | 불리언 | 아니요 | 달라짐 | 상업적 사용을 위해 false로 설정합니다 |
stream | 불리언 | 아니요 | false | 스트리밍 출력이며, 긴 prompt에 권장됩니다. 5.0-pro에서는 지원되지 않습니다 — 400을 반환합니다 |
다중 이미지 및 시퀀스 모드의 개수 제약
| Scenario | Input image count | max_images | 실제 출력 | 총 제약 |
|---|---|---|---|---|
| 단일 이미지 편집 | 1 | — | 1 | 2 ≤ 15 ✅ |
| 다중 이미지 융합 | 3 | — | 1 | 4 ≤ 15 ✅ |
| 다중 이미지 융합 + 시퀀스 | 3 | 4 | 4 | 7 ≤ 15 ✅ |
| 다중 이미지 융합 + 시퀀스 | 10 | 6 | 6 | 16 > 15 ❌ 거부됨 |
응답 형식
{
"model": "seedream-5-0-260128",
"created": 1768518000,
"data": [
{
"url": "https://ark-content-generation-v2-ap-southeast-1.tos-ap-southeast-1.bytepluses.com/seedream-5-0/.../scene-1.png",
"size": "2048x2048"
},
{
"url": "https://...scene-2.png",
"size": "2048x2048"
}
],
"usage": {
"generated_images": 2,
"output_tokens": 12480,
"total_tokens": 12480
}
}
data 배열 길이는 실제 출력 개수를 반영합니다sequential_image_generation: "disabled"→ 단일 요소datasequential_image_generation: "auto"+max_images: N→ 일반적으로 N개 요소입니다(프롬프트가 더 적은 결과를 생성하면 경우에 따라 더 적을 수 있습니다)- 과금은
usage.generated_images기준이며,max_images기준이 아닙니다
인증
API Key obtained from APIYI Console
본문
Model ID
seedream-5-0-260128, seedream-5-0-lite-260128, seedream-4-5-251128, seedream-4-0-250828, seedream-5-0-pro-260628 Editing / fusion / sequence instruction. For multi-image scenarios, refer to images explicitly as 'image 1 / image 2'
"Replace the clothing in image 1 with the outfit from image 2."
Reference image URL array. Up to 10 images (per official 4.5 docs). Note: input + output count ≤ 15
10[
"https://your-oss.example.com/person.png",
"https://your-oss.example.com/outfit.png"
]
Generation mode switch. disabled = single output (default); auto = batch sequence, paired with max_images
disabled, auto Batch sequence options. Effective only when sequential_image_generation=auto
Show child attributes
Show child attributes
Output size. Preset tiers (vary by version):
1K(4.0 only) /2K(all) /3K(5.0 only) /4K(4.5, 4.0)
Or exact pixel size WxH, total pixels ∈ [1280×720, 4096×4096], aspect ratio ∈ [1/16, 16]
"2K"
url, b64_json Output format. 5.0 supports png/jpeg; 4.5/4.0 only jpeg
png, jpeg Streaming output. Recommended for long prompts and multi-image sequence scenarios
응답
Edited image generated successfully
이 페이지가 도움이 되었나요?