curl --request POST \
--url https://api.apimart.ai/v1/images/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "gpt-image-2.6-ext",
"version": "flare",
"prompt": "An orange cat resting on a sunny windowsill, a city after the rain, warm cinematic lighting",
"size": "16:9",
"resolution": "1k",
"quality": "high",
"n": 1
}'
import time
import requests
base_url = "https://api.apimart.ai"
headers = {"Authorization": "Bearer <token>"}
payload = {
"model": "gpt-image-2.6-ext",
"version": "flare",
"prompt": "An orange cat resting on a sunny windowsill, a city after the rain, warm cinematic lighting",
"size": "16:9",
"resolution": "1k",
"quality": "high",
"n": 1
}
response = requests.post(
f"{base_url}/v1/images/generations",
headers=headers, json=payload, timeout=30,
)
response.raise_for_status()
task_id = response.json()["data"][0]["task_id"]
print(task_id)
deadline = time.monotonic() + 300
while time.monotonic() < deadline:
response = requests.get(
f"{base_url}/v1/tasks/{task_id}", headers=headers, timeout=30,
)
response.raise_for_status()
body = response.json()
task = body.get("data", body)
if task["status"] == "completed":
print(task["result"]["images"][0]["url"])
break
if task["status"] == "failed":
raise RuntimeError(task["error"]["message"])
time.sleep(4)
else:
raise TimeoutError(f"Continue polling task {task_id}")
const baseUrl = "https://api.apimart.ai";
const headers = {
Authorization: "Bearer <token>",
"Content-Type": "application/json",
};
const response = await fetch(`${baseUrl}/v1/images/generations`, {
method: "POST",
headers,
body: JSON.stringify({
"model": "gpt-image-2.6-ext",
"version": "flare",
"prompt": "An orange cat resting on a sunny windowsill, a city after the rain, warm cinematic lighting",
"size": "16:9",
"resolution": "1k",
"quality": "high",
"n": 1
}),
});
if (!response.ok) throw new Error(await response.text());
const taskId = (await response.json()).data[0].task_id;
console.log(taskId);
async function waitForTask(taskId) {
const deadline = Date.now() + 300_000;
while (Date.now() < deadline) {
const response = await fetch(`${baseUrl}/v1/tasks/${taskId}`, { headers });
if (!response.ok) throw new Error(await response.text());
const body = await response.json();
const task = body.data ?? body;
if (task.status === "completed") return task.result.images[0].url;
if (task.status === "failed") throw new Error(task.error.message);
await new Promise(resolve => setTimeout(resolve, 4000));
}
throw new Error(`Continue polling task ${taskId}`);
}
console.log(await waitForTask(taskId));
{
"code": 200,
"data": [
{
"status": "submitted",
"task_id": "task_01EXAMPLE"
}
]
}
{
"error": {
"message": "quality \"ultra\" is not supported (supported: auto / low / medium / high / xhigh / max)",
"type": "invalid_request_error",
"param": "",
"code": "invalid_request_error"
}
}
GPT-Image-2.6 Ext
GPT-Image-2.6 Ext 이미지 생성
gpt-image-2.6-ext로 이미지당 고정 요금 생성. version으로 Flare / Sunburst를 선택하고 참조 이미지, SVG, GIF를 사용하세요.
POST
/
v1
/
images
/
generations
curl --request POST \
--url https://api.apimart.ai/v1/images/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "gpt-image-2.6-ext",
"version": "flare",
"prompt": "An orange cat resting on a sunny windowsill, a city after the rain, warm cinematic lighting",
"size": "16:9",
"resolution": "1k",
"quality": "high",
"n": 1
}'
import time
import requests
base_url = "https://api.apimart.ai"
headers = {"Authorization": "Bearer <token>"}
payload = {
"model": "gpt-image-2.6-ext",
"version": "flare",
"prompt": "An orange cat resting on a sunny windowsill, a city after the rain, warm cinematic lighting",
"size": "16:9",
"resolution": "1k",
"quality": "high",
"n": 1
}
response = requests.post(
f"{base_url}/v1/images/generations",
headers=headers, json=payload, timeout=30,
)
response.raise_for_status()
task_id = response.json()["data"][0]["task_id"]
print(task_id)
deadline = time.monotonic() + 300
while time.monotonic() < deadline:
response = requests.get(
f"{base_url}/v1/tasks/{task_id}", headers=headers, timeout=30,
)
response.raise_for_status()
body = response.json()
task = body.get("data", body)
if task["status"] == "completed":
print(task["result"]["images"][0]["url"])
break
if task["status"] == "failed":
raise RuntimeError(task["error"]["message"])
time.sleep(4)
else:
raise TimeoutError(f"Continue polling task {task_id}")
const baseUrl = "https://api.apimart.ai";
const headers = {
Authorization: "Bearer <token>",
"Content-Type": "application/json",
};
const response = await fetch(`${baseUrl}/v1/images/generations`, {
method: "POST",
headers,
body: JSON.stringify({
"model": "gpt-image-2.6-ext",
"version": "flare",
"prompt": "An orange cat resting on a sunny windowsill, a city after the rain, warm cinematic lighting",
"size": "16:9",
"resolution": "1k",
"quality": "high",
"n": 1
}),
});
if (!response.ok) throw new Error(await response.text());
const taskId = (await response.json()).data[0].task_id;
console.log(taskId);
async function waitForTask(taskId) {
const deadline = Date.now() + 300_000;
while (Date.now() < deadline) {
const response = await fetch(`${baseUrl}/v1/tasks/${taskId}`, { headers });
if (!response.ok) throw new Error(await response.text());
const body = await response.json();
const task = body.data ?? body;
if (task.status === "completed") return task.result.images[0].url;
if (task.status === "failed") throw new Error(task.error.message);
await new Promise(resolve => setTimeout(resolve, 4000));
}
throw new Error(`Continue polling task ${taskId}`);
}
console.log(await waitForTask(taskId));
{
"code": 200,
"data": [
{
"status": "submitted",
"task_id": "task_01EXAMPLE"
}
]
}
{
"error": {
"message": "quality \"ultra\" is not supported (supported: auto / low / medium / high / xhigh / max)",
"type": "invalid_request_error",
"param": "",
"code": "invalid_request_error"
}
}
모델은
gpt-image-2.6-ext, version은 flare / sunburst이며 이미지당 과금합니다. resolution은 **1k / 2k / 4k**를 지원하며 현재 **n: 1**을 사용합니다. 모든 품질 단계와 PNG / JPEG / WebP / SVG / GIF를 지원합니다.curl --request POST \
--url https://api.apimart.ai/v1/images/generations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "gpt-image-2.6-ext",
"version": "flare",
"prompt": "An orange cat resting on a sunny windowsill, a city after the rain, warm cinematic lighting",
"size": "16:9",
"resolution": "1k",
"quality": "high",
"n": 1
}'
import time
import requests
base_url = "https://api.apimart.ai"
headers = {"Authorization": "Bearer <token>"}
payload = {
"model": "gpt-image-2.6-ext",
"version": "flare",
"prompt": "An orange cat resting on a sunny windowsill, a city after the rain, warm cinematic lighting",
"size": "16:9",
"resolution": "1k",
"quality": "high",
"n": 1
}
response = requests.post(
f"{base_url}/v1/images/generations",
headers=headers, json=payload, timeout=30,
)
response.raise_for_status()
task_id = response.json()["data"][0]["task_id"]
print(task_id)
deadline = time.monotonic() + 300
while time.monotonic() < deadline:
response = requests.get(
f"{base_url}/v1/tasks/{task_id}", headers=headers, timeout=30,
)
response.raise_for_status()
body = response.json()
task = body.get("data", body)
if task["status"] == "completed":
print(task["result"]["images"][0]["url"])
break
if task["status"] == "failed":
raise RuntimeError(task["error"]["message"])
time.sleep(4)
else:
raise TimeoutError(f"Continue polling task {task_id}")
const baseUrl = "https://api.apimart.ai";
const headers = {
Authorization: "Bearer <token>",
"Content-Type": "application/json",
};
const response = await fetch(`${baseUrl}/v1/images/generations`, {
method: "POST",
headers,
body: JSON.stringify({
"model": "gpt-image-2.6-ext",
"version": "flare",
"prompt": "An orange cat resting on a sunny windowsill, a city after the rain, warm cinematic lighting",
"size": "16:9",
"resolution": "1k",
"quality": "high",
"n": 1
}),
});
if (!response.ok) throw new Error(await response.text());
const taskId = (await response.json()).data[0].task_id;
console.log(taskId);
async function waitForTask(taskId) {
const deadline = Date.now() + 300_000;
while (Date.now() < deadline) {
const response = await fetch(`${baseUrl}/v1/tasks/${taskId}`, { headers });
if (!response.ok) throw new Error(await response.text());
const body = await response.json();
const task = body.data ?? body;
if (task.status === "completed") return task.result.images[0].url;
if (task.status === "failed") throw new Error(task.error.message);
await new Promise(resolve => setTimeout(resolve, 4000));
}
throw new Error(`Continue polling task ${taskId}`);
}
console.log(await waitForTask(taskId));
{
"code": 200,
"data": [
{
"status": "submitted",
"task_id": "task_01EXAMPLE"
}
]
}
{
"error": {
"message": "quality \"ultra\" is not supported (supported: auto / low / medium / high / xhigh / max)",
"type": "invalid_request_error",
"param": "",
"code": "invalid_request_error"
}
}
인증
버전 선택
| 버전 | 용도 |
|---|---|
flare | 기본 버전. 일상적인 생성, 대량 작업, 빠른 반복을 위한 속도 우선. |
sunburst | 완성도 높은 소재, 이미지 속 글자, 세밀한 편집을 위한 구도와 편집 정밀도 우선. |
요청 매개변수
열거 값은 대소문자를 구분하지 않고 앞뒤 공백을 제거합니다. 예제는 소문자를 사용합니다.string
필수
고정값
gpt-image-2.6-ext.string
필수
필수이며 비어 있으면 안 되는 생성·편집 지침. 여러 참조는 첫 번째·두 번째 이미지로 지칭하고 변경 및 유지할 내용을 설명하세요.
string
기본값:"flare"
flare / sunburst, 기본값 flare. 다른 값은 HTTP 400. 버전별 가격은 다를 수 있습니다.string
기본값:"1k"
1k / 2k / 4k(대문자 1K / 2K / 4K도 허용). size 비율과 함께 출력 픽셀을 결정합니다(아래 “비율과 크기” 표 참고). 이미지당 가격은 해상도별로 다르며, hd / 8k 등은 HTTP 400을 반환합니다.string
기본값:"auto"
auto 또는 아래 10개 비율만 허용하며 1024x1024 같은 픽셀 값은 불가합니다. auto는 텍스트 생성 시 1:1, 편집 시 크기를 읽을 수 있는 첫 참조와 가장 가까운 지원 비율을 선택합니다. GIF는 생략하거나 auto를 사용하세요.string
size의 별칭으로 하나만 사용하면 됩니다. 둘 다 전달하면 같아야 하며 다르면 HTTP 400. GIF에서는 생략 또는 auto만 가능합니다.integer
기본값:"1"
현재 정수
1을 사용하세요.string
auto / low / medium / high / xhigh / max. 생략하면 업스트림에 전달하지 않고 자동 선택합니다. auto는 low로 고정되지 않습니다. 품질은 이미지당 가격에 영향을 주지 않으며 높은 단계는 보통 오래 걸립니다. 다른 값은 HTTP 400.string
기본값:"png"
png / jpeg / webp / svg / gif. jpg는 jpeg의 별칭. SVG·GIF는 텍스트 생성만 지원하며 다른 형식은 HTTP 400.SVG 출력은 아직 지원하지 않습니다.
string
low / medium / high. 생략하면 업스트림이 결정합니다. 장면 복잡도를 제어하며 low는 간결한 아이콘·평면 일러스트, high는 풍부한 세부 묘사에 적합합니다. 단가에 영향이 없습니다.string[]
최대 16장, 각각 최대 20 MB. PNG / JPEG / WebP / GIF / BMP 지원. 공개 HTTP(S) URL 또는
data:image/png;base64,... 같은 이미지 Data URL을 받습니다. 전달하면 편집 모드이며 SVG·GIF에는 참조를 사용할 수 없습니다.resolution이 2k / 4k이면 참조 이미지로 GIF / BMP를 사용할 수 없습니다.image_url, image, images, input_image, input_images도 지원하나 image_urls를 권장합니다. URL은 로그인 없이 공개 접근 가능해야 합니다.
비율과 크기
| 비율 | 1k | 2k | 4k |
|---|---|---|---|
1:1 | 1024×1024 | 2048×2048 | 2880×2880 |
3:2 | 1536×1024 | 2048×1360 | 3520×2336 |
2:3 | 1024×1536 | 1360×2048 | 2336×3520 |
4:3 | 1024×768 | 2048×1536 | 3312×2480 |
3:4 | 768×1024 | 1536×2048 | 2480×3312 |
5:4 | 1280×1024 | 2560×2048 | 3216×2576 |
4:5 | 1024×1280 | 2048×2560 | 2576×3216 |
16:9 | 1536×864 | 2048×1152 | 3840×2160 |
9:16 | 864×1536 | 1152×2048 | 2160×3840 |
21:9 | 2016×864 | 2688×1152 | 3840×1648 |
auto의 텍스트 생성은 1:1이며 1k 1024×1024, 2k 2048×2048, 4k 2880×2880입니다. 편집은 위 표에서 가장 가까운 비율을 선택하며 원본 픽셀 크기를 보장하지 않습니다.
참조 이미지 편집 예제
편집도POST /v1/images/generations를 사용합니다. 예제 URL을 접근 가능한 실제 이미지로 교체하세요.
{
"model": "gpt-image-2.6-ext",
"version": "sunburst",
"prompt": "Place the product from the first image into the scene in the second image. Preserve the logo and packaging text, and match the lighting.",
"image_urls": [
"https://example.com/product.png",
"https://example.com/scene.jpg"
],
"size": "auto",
"quality": "high",
"n": 1
}
SVG 출력
output_format: "svg"로 설정하세요. 텍스트 생성만 가능하며 n=1이어야 합니다. size에 비율을 사용할 수 있고 complexity: "low"는 간결한 벡터 이미지에 적합합니다.
object
{
"model": "gpt-image-2.6-ext",
"prompt": "A minimalist rocket icon in a single line color, flat vector style, no text",
"size": "1:1",
"output_format": "svg",
"complexity": "low",
"svg": {
"model": "gpt-4.1-mini"
},
"n": 1
}
GIF 애니메이션
output_format: "gif"로 설정하세요. 텍스트 생성만 가능합니다. size / aspect_ratio는 생략 또는 auto를 사용하세요. 비율 이름과 픽셀 값은 HTTP 400입니다. 프롬프트에 움직임과 반복 방식을 설명하세요.
{
"model": "gpt-image-2.6-ext",
"prompt": "A cartoon puppy raises one paw to wave, then returns to the starting pose. White background, fixed camera, seamless loop.",
"output_format": "gif",
"quality": "medium",
"n": 1
}
미지원·무효 매개변수
| 매개변수 | 동작 |
|---|---|
width / height / markup / markup_url | 제출 시 HTTP 400. 크기는 비율 이름을 사용하며 마크업 편집은 지원하지 않습니다. |
background / moderation / output_compression / seed / negative_prompt / style | 오류는 없지만 적용되지 않습니다. |
response_format | 출력 방식을 바꾸지 않습니다. 결과는 파일 URL이며 Base64 이미지는 반환하지 않습니다. |
제출과 작업 결과
제출 성공은 HTTP 200입니다.data[0].task_id를 읽고 작업 조회 API를 3–5초 간격으로 completed / failed까지 호출하세요. 클라이언트 타임아웃 후에도 생성 요청을 다시 제출하지 말고 기존 작업을 조회하세요.
curl --request GET \
--url https://api.apimart.ai/v1/tasks/task_01EXAMPLE \
--header 'Authorization: Bearer <token>'
{code, data} 형식이면 먼저 data를 읽으세요. Python / JavaScript 예제는 두 형식을 처리합니다.
{
"id": "task_01EXAMPLE",
"status": "completed",
"progress": 100,
"result": {
"images": [
{
"url": [
"https://upload.apimart.ai/images/example.png"
],
"expires_at": 1793923252
}
]
}
}
result.images[0].url은 배열이며 첫 링크는 result.images[0].url[0]입니다. expires_at 전에 저장하세요. 권장 유효 기간은 완료 후 24시간입니다. cost / credits_cost는 최종 요금입니다.
| 상태 | 처리 |
|---|---|
pending / processing | 계속 조회합니다. |
completed | 파일 링크를 읽고 저장합니다. |
failed | error.message를 확인하세요. 전액 환불되며 cost는 0입니다. 원인을 수정한 뒤 다시 제출하세요. |
POST /v1/tasks/batch, 본문은 {"task_ids":["task_xxx","task_yyy"]}입니다.
과금
이미지당 가격은version × resolution만으로 결정됩니다. 품질, 형식(SVG / GIF 포함), 복잡도, 비율, 참조 수, svg.model은 가격에 영향이 없습니다. 현재 n=1을 사용하며 실패는 전액 환불됩니다. 최신 요금은 APIMart 가격 페이지 또는 /api/pricing에서 확인하세요.
오류 처리
| 단계 / 상태 | 원인과 처리 |
|---|---|
| HTTP 400 | 잘못된 매개변수로 작업 생성 전 거절되며 과금되지 않습니다. 열거 값, 비율, 참조 제한, SVG / GIF 전용 필드를 확인하세요. |
| HTTP 401 | API 키 누락 또는 무효. Authorization을 확인하세요. |
| HTTP 403 | model_price_not_configured: 해당 version × resolution에 가격이 설정되지 않았습니다. 지원팀에 문의하거나 다른 해상도를 사용하세요. |
| HTTP 429 | 요청이 너무 많습니다. 동시 요청 수를 낮추고 재시도하세요. |
status: "failed" | 정지 이미지·GIF의 n=2–4, 참조 다운로드 실패, 콘텐츠 안전 정책 등으로 실행에 실패했습니다. error.message를 읽고 요청을 수정하세요. 전액 환불됩니다. |