Nano Banana Pro API
Google Gemini 기반 Nano Banana Pro 모델의 전체 API 레퍼런스입니다.
모델 종류
이 API는 두 가지 모델 변형을 지원합니다:
빠른 비교
지원 화면 비율
두 모델 모두 11가지 화면 비율을 지원합니다:
16:9 (기본값), 9:16, 1:1, 3:2, 2:3, 4:3, 3:4, 4:5, 5:4, 21:9, 9:21
Nano Banana Pro (텍스트-이미지)
엔드포인트 {#}
POST /api/v1/image/task
인증
Authorization: Bearer YOUR_API_KEY
요청 파라미터
필수
참고: width:height 비율은 다음 중 하나여야 합니다: "21:9", "9:21", "16:9", "9:16", "4:3", "3:4", "3:2", "2:3", "1:1"
요청 예시
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: 'nano-banana-pro',
prompt: 'A serene mountain landscape at sunset',
width: 16,
height: 9,
resolution: '2k'
})
});
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);
Nano Banana Pro Edit (이미지 편집)
엔드포인트
POST /api/v1/image/task
요청 파라미터
필수
참고: width:height 비율은 다음 중 하나여야 합니다: "21:9", "9:21", "16:9", "9:16", "4:3", "3:4", "3:2", "2:3", "1:1"
단일 이미지 편집 예시
{
model_name: 'nano-banana-pro-edit',
prompt: 'Change the sky to sunset colors',
width: 16,
height: 9,
resolution: '2k',
image_url_list: ['https://example.com/image.jpg']
}
다중 이미지 합성 예시
{
model_name: 'nano-banana-pro-edit',
prompt: 'Combine these images into a cohesive landscape',
width: 16,
height: 9,
resolution: '2k',
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.0997,
"images": [
{
"url": "https://example.com/generated-image.jpeg"
}
]
}
},
"message": "success"
}
상태 값
submitted: 작업이 수락되었습니다
processing: 생성 진행 중
succeed: 생성 완료
failed: 생성 실패
오류 처리
일반적인 오류
Invalid Resolution
{
"code": 400,
"message": "Resolution must be one of: 1k, 2k, 4k"
}
Invalid Aspect Ratio
{
"code": 400,
"message": "Ratio must be one of: 16:9, 9:16, 1:1, 3:2, 2:3, 4:3, 3:4, 4:5, 5:4, 21:9, 9:21"
}
Missing Image URL (Edit Mode)
{
"code": 400,
"message": "image_url_list is required for nano-banana-pro-edit"
}
모범 사례
텍스트-이미지 팁
- 구체적으로 작성: 피사체, 스타일, 조명, 구도 세부 사항 포함
- 해상도 선택: 2K가 기본값이며 비용 효율적, 최고 품질에는 4K 사용
- 화면 비율 선택: 사용 목적에 맞는 비율 선택 (웹은 16:9, 모바일은 9:16)
- 프롬프트 품질: 상세한 프롬프트일수록 일반적으로 더 좋은 결과 생성
이미지 편집 팁
- 명확한 지시: 변경할 내용을 구체적으로 명시
- 다중 이미지 합성: 단일 요청으로 최대 14개 이미지 합성 가능
- 해상도 매칭: 출력 해상도는 입력과 다를 수 있음
- 프롬프트 안내: 변경 사항이 아닌 원하는 결과물을 설명
사용 사례 예시
제품 사진
{
model_name: 'nano-banana-pro',
prompt: 'Professional product shot of luxury watch on marble surface',
width: 4,
height: 3,
resolution: '4k'
}
다중 이미지 콜라주
{
model_name: 'nano-banana-pro-edit',
image_url_list: [
'photo1.jpg',
'photo2.jpg',
'photo3.jpg'
],
prompt: 'Create a seamless collage with these vacation photos',
width: 16,
height: 9,
resolution: '2k'
}
이미지 향상
{
model_name: 'nano-banana-pro-edit',
image_url_list: ['photo.jpg'],
prompt: 'Enhance colors and add dramatic lighting',
width: 1,
height: 1,
resolution: '2k'
}