Flux Kontext Pro API
다중 이미지 컨텍스트 이해 기능을 갖춘 Flux Kontext Pro의 완전한 API 레퍼런스입니다.
모델 개요
빠른 비교
지원되는 화면 비율
두 모드 모두 9가지 화면 비율을 지원합니다:
1:1, 16:9, 9:16, 3:2, 2:3, 4:3, 3:4, 21:9, 9:21
비용 {#}
Flux Kontext Pro (텍스트-이미지)
엔드포인트
POST /api/v1/image/task
인증
Authorization: Bearer YOUR_API_KEY
요청 매개변수
필수
참고: width:height 비율은 다음 중 하나여야 합니다: "1:1", "16:9", "9:16", "3:2", "2:3", "4:3", "3:4", "21:9", "9:21"
요청 예시
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: 'flux-kontext-pro',
prompt: 'A serene mountain landscape at sunset',
width: 16,
height: 9
})
});
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);
Flux Kontext Pro (이미지-이미지)
엔드포인트
POST /api/v1/image/task
요청 매개변수
필수
참고: width:height 비율은 다음 중 하나여야 합니다: "1:1", "16:9", "9:16", "3:2", "2:3", "4:3", "3:4", "21:9", "9:21"
단일 이미지 편집 예시
{
model_name: 'flux-kontext-pro',
prompt: 'Transform this photo into a watercolor painting',
width: 16,
height: 9,
image_url_list: ['https://example.com/image.jpg']
}
다중 이미지 합성 예시
{
model_name: 'flux-kontext-pro',
prompt: 'Combine these images into a cohesive landscape scene',
width: 16,
height: 9,
image_url_list: ['https://example.com/image1.jpg', 'https://example.com/image2.jpg', 'https://example.com/image3.jpg']
}
응답 형식
초기 응답
두 모드 모두 폴링을 위한 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"
}
폴링 응답
/api/v1/image/{taskId}를 폴링하여 상태를 확인합니다:
{
"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.04,
"images": [
{
"url": "https://example.com/generated-image.jpeg"
}
]
}
},
"message": "success"
}
상태 값
submitted: 작업이 수락되었습니다
processing: 생성 진행 중
succeed: 생성 완료
failed: 생성 실패
오류 처리
일반적인 오류
잘못된 화면 비율
{
"code": 400,
"message": "Ratio must be one of: 1:1, 16:9, 9:16, 3:2, 2:3, 4:3, 3:4, 21:9, 9:21"
}
이미지 URL 누락 (이미지-이미지 모드)
{
"code": 400,
"message": "image_url_list is required for flux-kontext-pro"
}
이미지 개수 초과
{
"code": 400,
"message": "Maximum 5 images allowed"
}
모범 사례
텍스트-이미지 팁
- 구체적으로 작성: 주제, 스타일, 조명, 구도 세부 사항 포함
- 화면 비율 선택: 사용 사례에 따라 비율 선택 (웹은 16:9, 모바일은 9:16)
- 프롬프트 품질: 더 상세한 프롬프트가 일반적으로 더 나은 결과를 생성
- 효율적인 폴링: 2-3초마다 상태 확인
이미지-이미지 팁
- 명확한 지시: 원하는 변환에 대해 구체적으로 설명
- 다중 이미지 컨텍스트: 컨텍스트 인식 생성을 위해 최대 5개의 이미지 결합 가능
- 프롬프트 가이드: 변경 사항뿐만 아니라 원하는 결과 설명
- 이미지 품질: 더 높은 품질의 입력 이미지가 더 나은 결과 생성
사용 사례 예시
제품 사진
{
model_name: 'flux-kontext-pro',
prompt: 'Professional product shot of luxury watch on marble surface',
width: 4,
height: 3
}
다중 이미지 콜라주
{
model_name: 'flux-kontext-pro',
image_url_list: ['photo1.jpg', 'photo2.jpg', 'photo3.jpg'],
prompt: 'Create a seamless collage with these vacation photos',
width: 16,
height: 9
}
스타일 전환
{
model_name: 'flux-kontext-pro',
image_url_list: ['photo.jpg'],
prompt: 'Transform into impressionist painting style',
width: 1,
height: 1
}