curl --request POST \
--url https://api.apiyi.com/v1/images/edits \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form model=gpt-image-2.5-vip \
--form 'prompt=Place the person from image1 into the scene of image2, in the style of image3' \
--form 'image=@example-file;type=image/png'import requests
url = "https://api.apiyi.com/v1/images/edits"
files = { "image": ("example-file", open("example-file", "rb"), "image/png") }
payload = {
"model": "gpt-image-2.5-vip",
"prompt": "Place the person from image1 into the scene of image2, in the style of image3"
}
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('model', 'gpt-image-2.5-vip');
form.append('prompt', 'Place the person from image1 into the scene of image2, in the style of image3');
form.append('image', '<string>');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://api.apiyi.com/v1/images/edits', 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/edits",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"model\"\r\n\r\ngpt-image-2.5-vip\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"prompt\"\r\n\r\nPlace the person from image1 into the scene of image2, in the style of image3\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image\"; filename=\"example-file\"\r\nContent-Type: image/png\r\n\r\n<string>\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: multipart/form-data"
],
]);
$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/edits"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"model\"\r\n\r\ngpt-image-2.5-vip\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"prompt\"\r\n\r\nPlace the person from image1 into the scene of image2, in the style of image3\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image\"; filename=\"example-file\"\r\nContent-Type: image/png\r\n\r\n<string>\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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/edits")
.header("Authorization", "Bearer <token>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"model\"\r\n\r\ngpt-image-2.5-vip\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"prompt\"\r\n\r\nPlace the person from image1 into the scene of image2, in the style of image3\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image\"; filename=\"example-file\"\r\nContent-Type: image/png\r\n\r\n<string>\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.apiyi.com/v1/images/edits")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"model\"\r\n\r\ngpt-image-2.5-vip\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"prompt\"\r\n\r\nPlace the person from image1 into the scene of image2, in the style of image3\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image\"; filename=\"example-file\"\r\nContent-Type: image/png\r\n\r\n<string>\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"data": [
{
"b64_json": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA..."
}
],
"created": 1778037127,
"usage": {
"input_tokens": 98,
"output_tokens": 1185,
"total_tokens": 1283
}
}이미지 편집 API 레퍼런스
gpt-image-2-vip 이미지 편집 API 레퍼런스 및 인터랙티브 플레이그라운드 — 참고 이미지를 업로드하고 단일 이미지 편집 또는 다중 이미지 융합을 위한 지시사항을 제공합니다. size를 사용해 출력 치수를 고정합니다.
curl --request POST \
--url https://api.apiyi.com/v1/images/edits \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: multipart/form-data' \
--form model=gpt-image-2.5-vip \
--form 'prompt=Place the person from image1 into the scene of image2, in the style of image3' \
--form 'image=@example-file;type=image/png'import requests
url = "https://api.apiyi.com/v1/images/edits"
files = { "image": ("example-file", open("example-file", "rb"), "image/png") }
payload = {
"model": "gpt-image-2.5-vip",
"prompt": "Place the person from image1 into the scene of image2, in the style of image3"
}
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, data=payload, files=files, headers=headers)
print(response.text)const form = new FormData();
form.append('model', 'gpt-image-2.5-vip');
form.append('prompt', 'Place the person from image1 into the scene of image2, in the style of image3');
form.append('image', '<string>');
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
options.body = form;
fetch('https://api.apiyi.com/v1/images/edits', 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/edits",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"model\"\r\n\r\ngpt-image-2.5-vip\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"prompt\"\r\n\r\nPlace the person from image1 into the scene of image2, in the style of image3\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image\"; filename=\"example-file\"\r\nContent-Type: image/png\r\n\r\n<string>\r\n-----011000010111000001101001--",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: multipart/form-data"
],
]);
$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/edits"
payload := strings.NewReader("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"model\"\r\n\r\ngpt-image-2.5-vip\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"prompt\"\r\n\r\nPlace the person from image1 into the scene of image2, in the style of image3\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image\"; filename=\"example-file\"\r\nContent-Type: image/png\r\n\r\n<string>\r\n-----011000010111000001101001--")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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/edits")
.header("Authorization", "Bearer <token>")
.body("-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"model\"\r\n\r\ngpt-image-2.5-vip\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"prompt\"\r\n\r\nPlace the person from image1 into the scene of image2, in the style of image3\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image\"; filename=\"example-file\"\r\nContent-Type: image/png\r\n\r\n<string>\r\n-----011000010111000001101001--")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.apiyi.com/v1/images/edits")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"model\"\r\n\r\ngpt-image-2.5-vip\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"prompt\"\r\n\r\nPlace the person from image1 into the scene of image2, in the style of image3\r\n-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"image\"; filename=\"example-file\"\r\nContent-Type: image/png\r\n\r\n<string>\r\n-----011000010111000001101001--"
response = http.request(request)
puts response.read_body{
"data": [
{
"b64_json": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA..."
}
],
"created": 1778037127,
"usage": {
"input_tokens": 98,
"output_tokens": 1185,
"total_tokens": 1283
}
}Bearer sk-xxx), 이미지를 선택한 후 prompt / model / size을(를) 설정하고 전송을 클릭하십시오.multipart/form-data이(가) 사용됩니다. 순수 텍스트-이미지 생성에 대해서는 텍스트-이미지 생성 엔드포인트를 참조하십시오.gpt-image-2-all과의 차이점: 호출 구조는 동일하며, size 필드가 하나만 추가됩니다. 크기를 고정할 필요가 없고 가장 빠른 출력을 원하신다면 gpt-image-2-all을(를) 사용하십시오.b64_json)을 반환하며, 이는 수 MB에 달할 수 있으므로 브라우저 Playground에 请求时发生错误: unable to complete request이(가) 표시될 수 있습니다. 요청은 실제로 성공한 것이며, 브라우저가 매우 긴 base64 문자열을 렌더링하지 못하는 것뿐입니다.권장 워크플로: base64 형식을 원하거나 매우 큰 참조 이미지를 업로드해야 하는 경우, 아래 코드 예제를 복사하여 로컬에서 실행하십시오.image 필드는 여러 장의 참조 이미지를 허용합니다. 이 순서는 prompt 내에서 “image1 / image2 / image3”을 참조하는 기준이 됩니다. prompt에서 다음과 같이 명시적으로 참조하십시오. 예:image1의 인물을 image3의 화풍으로 image2의 장면에 배치권장 사양은 이미지당 ≤ 10MB이며, 형식은
png / jpg / webp입니다. 이미지가 너무 크면 게이트웨이 제한에 도달할 수 있습니다.size=auto을(를) 전달하거나(또는 size을(를) 생략할 경우), 출력은 다중 이미지 시나리오에서 반드시 첫 번째 이미지가 아니더라도 prompt에서 편집 대상으로 지정한 참조 이미지의 종횡비를 상속합니다.예를 들어 “image2를 수정하고, image2의 의상과 모자를 image1에 맞게 변경”과 같은 prompt에서 image2가 1:1 비율이면 (image1이 가로 16:9 비율이더라도) 출력은 1:1이 됩니다.의상 교체, 액세서리 추가, 리터칭 등 형태를 보존하는 편집에 유용합니다. prompt에서 대상을 지정하지 않으면 모델이 자체적으로 결정합니다. 종횡비를 변경해야 할 때만 지원되는 30가지 크기 중 명시적인 size을(를) 전달하십시오.size: 편집 시에는auto을(를) 권장하며(또는 해당 필드 생략) — 모델은 다중 이미지 시나리오에서 반드시 첫 번째 이미지가 아니더라도, prompt에서 편집 대상으로 지정한 참조 이미지의 종횡비를 보존합니다. 예를 들어 “image2를 수정하고, image2의 의상을 image1에 맞게 변경”과 같은 prompt의 경우 출력 비율은 image2와 일치하며, prompt에서 명확히 구분하지 않으면 모델이 자체적으로 결정합니다. 다른 크기를 강제 지정하려면 지원되는 30가지 크기 중 하나를 선택하십시오. 소문자 ASCIIx을(를) 사용하십시오(예:2048x1360,3840x2160). 전체 표: 개요 페이지.quality: 선택 사항이며 테스트 시 유효합니다(채널 동작 방식이며 확정된 약정은 아닙니다. 실제 응답을 기준으로 하십시오). 2.5 모델(gpt-image-2.5-vip=gpt-image-2.5-sunburst-vip,gpt-image-2.5-flare-vip)은auto/low/medium/high/xhigh/max의 6개 등급을 모두 허용하며,gpt-image-2-vip은(는)high까지만 지원하고xhigh/max은(는) 거부합니다. 동일한 이름의 등급이라도 같지 않습니다. 2.5high은(는)gpt-image-2-vipmedium에만 해당하며, 2.5max은(는) 해당 모델의high에 해당합니다. 이미지당 고정 $0.03의 요금은 등급에 따라 변경되지 않지만, 높은 등급일수록 시간이 더 오래 걸립니다.n: ❌ 거부됨 — 호출당 단일 이미지만 지원됩니다.response_format: 생략 시 base64(접두사 없는 raw 데이터, 2026년 7월 검증됨)를 반환하며, 이미지 URL을 받으려면"url"을(를) 전달하십시오. URL 출력에 의존하는 비즈니스는 base64 대체 없이 확정적인 URL 출력을 위해 token을image2_OSS그룹으로 전환해야 합니다.
코드 예시
Python
단일 이미지 편집:import requests
API_KEY = "sk-your-api-key"
with open("photo.png", "rb") as f:
response = requests.post(
"https://api.apiyi.com/v1/images/edits",
headers={"Authorization": f"Bearer {API_KEY}"},
data={
"model": "gpt-image-2.5-vip",
"prompt": "Replace the background with a sunset beach",
"size": "2048x1360" # 3:2 2K Recommended
},
files=[
("image", ("photo.png", f, "image/png"))
],
timeout=300 # conservative; absorbs upload + long-tail
).json()
print(response["data"][0]["url"])
import requests
with open("ref1.png", "rb") as f1, \
open("ref2.png", "rb") as f2, \
open("ref3.png", "rb") as f3:
response = requests.post(
"https://api.apiyi.com/v1/images/edits",
headers={"Authorization": "Bearer sk-your-api-key"},
data={
"model": "gpt-image-2.5-vip",
"prompt": "Place the person from image1 into the scene of image2, in the style of image3",
"size": "2048x2048" # 1:1 2K Recommended
},
files=[
("image", ("ref1.png", f1, "image/png")),
("image", ("ref2.png", f2, "image/png")),
("image", ("ref3.png", f3, "image/png"))
],
timeout=300
).json()
# Verified July 2026: b64_json is raw base64 (no data: prefix); earlier versions
# included the prefix, so a defensive check is safest
import base64
b64 = response["data"][0]["b64_json"]
if b64.startswith("data:"):
b64 = b64.split(",", 1)[1]
with open("edited.png", "wb") as f:
f.write(base64.b64decode(b64))
cURL
단일 이미지 편집:curl -X POST "https://api.apiyi.com/v1/images/edits" \
-H "Authorization: Bearer sk-your-api-key" \
-F "model=gpt-image-2.5-vip" \
-F "prompt=Replace the background with a sunset beach" \
-F "size=2048x1360" \
-F "image=@./photo.png"
curl -X POST "https://api.apiyi.com/v1/images/edits" \
-H "Authorization: Bearer sk-your-api-key" \
-F "model=gpt-image-2.5-vip" \
-F "prompt=Place the person from image1 into the scene of image2, in the style of image3" \
-F "size=2048x2048" \
-F "image=@./ref1.png" \
-F "image=@./ref2.png" \
-F "image=@./ref3.png"
Node.js (네이티브 fetch + FormData)
import fs from 'node:fs';
const form = new FormData();
form.append('model', 'gpt-image-2.5-vip');
form.append('prompt', 'Replace the background with outer space');
form.append('size', '2048x1360');
form.append(
'image',
new Blob([fs.readFileSync('./photo.png')]),
'photo.png'
);
const resp = await fetch('https://api.apiyi.com/v1/images/edits', {
method: 'POST',
headers: { 'Authorization': 'Bearer sk-your-api-key' },
body: form
});
const data = await resp.json();
console.log(data.data[0].url);
브라우저 JavaScript (File 객체)
// <input type="file" id="fileInput" multiple>
const files = document.getElementById('fileInput').files;
const form = new FormData();
form.append('model', 'gpt-image-2.5-vip');
form.append('prompt', 'Fuse these images into a single poster');
form.append('size', '2048x2048');
for (const f of files) form.append('image', f);
const resp = await fetch('https://api.apiyi.com/v1/images/edits', {
method: 'POST',
headers: { 'Authorization': 'Bearer sk-your-api-key' },
body: form
});
const { data } = await resp.json();
document.getElementById('result').src = data[0].url;
매개변수
| 필드 | 유형 | 필수 | 설명 |
|---|---|---|---|
model | 텍스트 | 예 | gpt-image-2.5-vip (= gpt-image-2.5-sunburst-vip) / gpt-image-2.5-flare-vip / 이전 세대 gpt-image-2-vip, 동일한 가격 및 호출 형식입니다. 세 가지 모두에서 mask은 전체 이미지 재생성입니다 |
prompt | 텍스트 | 예 | 자연어 편집/융합 설명 |
image | 파일 | 예 | 참조 이미지입니다. 반복해서 지정할 수 있습니다(배열 필드) |
size | 텍스트 | 아니요 | 출력 크기: auto(기본값 — 프롬프트에서 편집 대상으로 지정한 참조 이미지의 크기를 따르며, 반드시 첫 번째 이미지인 것은 아닙니다) 또는 30개 크기 중 하나입니다. 형식은 WIDTHxHEIGHT(소문자 x)입니다 |
image로 다시 입력하고, 새로운 편집 지침을 지정하여 점진적으로 개선합니다. 각 라운드에서 자체 size를 지정할 수 있습니다.응답 형식
텍스트-투-이미지 엔드포인트와 동일합니다: 기본적으로 base64를 반환합니다 (data[0].b64_json, 접두사가 없는 raw base64이며, 2026년 7월 검증됨). 이미지 URL이 필요하면 response_format: "url"를 명시적으로 전달하십시오. URL 출력에 의존하는 서비스는 base64 대체 없이 결정적인 URL 출력을 위해 토큰을 image2_OSS 그룹으로 전환해야 합니다. data[0]는 url 또는 b64_json 중 하나만 반환하며 — 둘 다는 아닙니다.
b64_json 모드 (기본값):
{
"data": [
{
"b64_json": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAA..."
}
],
"created": 1778037127,
"usage": {
"input_tokens": 98,
"output_tokens": 1185,
"total_tokens": 1283
}
}
url 모드 (response_format: "url"를 명시적으로 전달하십시오; URL에 의존하는 경우 image2_OSS 그룹을 사용하십시오):
{
"data": [
{
"url": "https://r2cdn.copilotbase.com/r2cdn2/0e82148a-bec0-4b42-bbca-117c6b42581b.png"
}
],
"created": 1778037331,
"usage": {
"input_tokens": 30,
"output_tokens": 2074,
"total_tokens": 2104
}
}
b64_json 필드는 data: 접두사가 없는 raw base64입니다 — 렌더링하기 전에 직접 디코딩하거나 접두사를 앞에 붙이십시오. 이전 버전에는 접두사가 포함되어 있었습니다, 따라서 두 형태를 모두 처리하려면 먼저 startsWith('data:')를 항상 확인하십시오.관련 자료
모델 개요(전체 크기 표)
텍스트-이미지 API
/v1/images/generations 호환되는 엔드포인트자매 모델 gpt-image-2-all
인증
API Key from the API易 Console
본문
Model name: gpt-image-2.5-vip (= sunburst-vip) / gpt-image-2.5-flare-vip / gpt-image-2-vip, same price and call format
gpt-image-2.5-vip, gpt-image-2.5-sunburst-vip, gpt-image-2.5-flare-vip, gpt-image-2-vip Edit/fusion instruction. For multi-image flows, reference upload order as image1/image2/image3
"Place the person from image1 into the scene of image2, in the style of image3"
Reference images. For a single image, send the field once; for multiple images, repeat the same image field (e.g., -F [email protected] -F [email protected]) — upload order maps to image1 / image2 / ... in the prompt. Recommended ≤ 10MB each, formats png / jpg / webp.
Quality tier (works in testing; channel behavior, not a commitment — go by the actual response). All six tiers on the 2.5 models (gpt-image-2.5-vip / gpt-image-2.5-sunburst-vip / gpt-image-2.5-flare-vip); gpt-image-2-vip stops at high and rejects xhigh / max.
Same-named tiers are not equal: 2.5 high only equals gpt-image-2-vip medium, and 2.5 max equals its high. The flat $0.03 does not change with the tier, but latency rises with it.
auto, low, medium, high, xhigh, max "high"
Output size. For editing, prefer auto (or omit the field) — the model preserves the aspect ratio of whichever reference image the prompt names as the target of the edit (not necessarily the first one in multi-image scenarios). For example, with the prompt "modify image2, change image2's outfit to match image1", the output ratio matches image2. If the prompt doesn't disambiguate, the model decides on its own. To force a different dimension, pick one of the 30 supported sizes; format: WIDTHxHEIGHT with lowercase ASCII x, e.g., 2048x1360, 3840x2160. Flat $0.03/image across all tiers.
auto, 1280x1280, 848x1280, 1280x848, 960x1280, 1280x960, 1024x1280, 1280x1024, 720x1280, 1280x720, 1280x544, 2048x2048, 1360x2048, 2048x1360, 1536x2048, 2048x1536, 1632x2048, 2048x1632, 1152x2048, 2048x1152, 2048x864, 2880x2880, 2336x3520, 3520x2336, 2480x3312, 3312x2480, 2560x3216, 3216x2560, 2160x3840, 3840x2160, 3840x1632 "2048x1360"
응답
Image successfully generated. Defaults to base64 in data[0].b64_json — url is not returned in the same response.
Image editing response. Returns base64 by default (data[0].b64_json); to get a url, switch to the image2_OSS group with response_format=url. data[0] returns either url or b64_json, never both.
이 페이지가 도움이 되었나요?