GPT Image 2 API
OpenAI 기반 GPT Image 2 모델을 위한 전체 API 레퍼런스입니다.
모델 변형
이 API는 4가지 모델 변형을 지원합니다.
빠른 비교
지원되는 비율
16:9, 9:16, 1:1, 3:2, 2:3, 3:4, 4:3, 5:4, 4:5, 21:9
GPT Image 2 (텍스트-투-이미지)
엔드포인트 {#}
POST /api/v1/image/task
인증
Authorization: Bearer YOUR_API_KEY
요청 파라미터
필수
참고: width:height 비율은 다음 중 하나여야 합니다: 16:9, 9:16, 1:1, 3:2, 2:3, 3:4, 4:3, 5:4, 4:5, 21:9
요청 예시
const response = await fetch('https://api.flaq.ai/api/v1/image/task', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
model_name: 'gpt-image-2',
prompt: 'A minimalist product shot of a ceramic mug on marble, soft studio light',
width: 1,
height: 1,
resolution: '1k',
quality: 'medium'
})
});
const { data } = await response.json();
const taskId = data.task_id;
const pollResponse = await fetch(
`https://api.flaq.ai/api/v1/image/${taskId}`,
{
headers: { Authorization: 'Bearer YOUR_API_KEY' }
}
);
const result = await pollResponse.json();
console.log(result.data.task_result.images[0].url);
GPT Image 2 Edit (이미지 편집)
엔드포인트
POST /api/v1/image/task
요청 파라미터
필수
선택
참고: width와 height를 제공하는 경우 비율은 다음 중 하나여야 합니다: 16:9, 9:16, 1:1, 3:2, 2:3, 3:4, 4:3, 5:4, 4:5, 21:9
단일 이미지 편집 예시
{
model_name: 'gpt-image-2-edit',
prompt: 'Replace the background with a clean studio scene and brighten the product lighting',
image_url_list: ['https://example.com/product-photo.jpg'],
width: 16,
height: 9,
resolution: '1k',
quality: 'medium'
}
멀티 이미지 합성 예시
{
model_name: 'gpt-image-2-edit',
prompt: 'Blend these reference images into a polished campaign composition while keeping the main subject identity consistent',
image_url_list: [
'https://example.com/image1.jpg',
'https://example.com/image2.jpg',
'https://example.com/image3.jpg'
],
width: 16,
height: 9,
resolution: '2k',
quality: 'high'
}
GPT Image 2 Client
GPT Image 2와 동일한 파라미터와 기능을 사용하며 model_name만 gpt-image-2-client로 설정하면 됩니다. 이 변형은 프리뷰 체험판이며 안정성이 더 낮을 수 있습니다.
요청 예시
const response = await fetch('https://api.flaq.ai/api/v1/image/task', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
model_name: 'gpt-image-2-client',
prompt: 'A luxury skincare still life with soft reflections and elegant typography',
width: 4,
height: 5,
resolution: '1k',
quality: 'medium'
})
});
const { data } = await response.json();
const taskId = data.task_id;
GPT Image 2 Edit Client
GPT Image 2 Edit와 동일한 파라미터와 기능을 사용하며 model_name만 gpt-image-2-edit-client로 설정하면 됩니다. 이 변형은 프리뷰 체험판이며 안정성이 더 낮을 수 있습니다.
요청 예시
const response = await fetch('https://api.flaq.ai/api/v1/image/task', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
model_name: 'gpt-image-2-edit-client',
prompt: 'Turn this portrait into a clean editorial poster while preserving the face and pose',
image_url_list: ['https://example.com/portrait.jpg'],
width: 4,
height: 5,
resolution: '1k',
quality: 'medium'
})
});
const { data } = await response.json();
const taskId = data.task_id;
응답 형식
초기 응답
모든 GPT Image 2 변형은 폴링에 사용할 task_id를 반환합니다.
{
"code": 0,
"data": {
"task_id": "{task_id}",
"task_status": "submitted",
"response_url": "https://api.flaq.ai/api/v1/image/{task_id}"
},
"message": "success"
}
폴링 응답
상태 확인을 위해 GET /api/v1/image/{task_id}를 폴링합니다.
{
"code": 0,
"data": {
"task_id": "{task_id}",
"task_status": "succeed",
"task_status_msg": null,
"response_url": "https://api.flaq.ai/api/v1/image/{task_id}",
"task_result": {
"credit": 0.0997,
"images": [
{
"url": "https://example.com/generated-image.jpeg"
}
]
}
},
"message": "success"
}
상태 값
submitted: 작업 접수 완료
processing: 이미지 생성 또는 편집 진행 중
succeed: 작업 성공
failed: 작업 실패
처리 시간
일반적인 처리 시간은 15-60초이며, 해상도, 품질, 프롬프트 복잡도, 그리고 편집 요청 시 이미지 수에 따라 달라집니다.
모범 사례
- 구도를 명확히 설명하세요: 피사체, 구도, 조명, 스타일을 명확히 설명할수록 GPT Image 2가 더 좋은 결과를 냅니다.
- 워크플로에 맞게 품질을 선택하세요: 반복 작업에는
low 또는 medium, 최종 결과물에는 high를 사용하는 것이 좋습니다.
- 출력 목적에 맞춰 비율을 먼저 정하세요: 소셜 포스트, 배너, 상품 페이지, 에디토리얼 레이아웃에 맞춰 생성 전에 비율을 정하세요.
- 편집에는 선명한 원본 이미지를 사용하세요: 선명하고 조명이 좋은 입력 이미지는 주체 보존과 로컬 편집 품질 향상에 도움이 됩니다.
- 멀티 이미지 요청에는 핵심 참조만 넣으세요: 편집 모델에서는 꼭 필요한 참조 이미지만 제공해 시각적 충돌을 줄이세요。