Nano Banana 2 API 기술 가이드
고도화된 인공지능 기능을 활용하는 Nano Banana 2 비주얼 제작 서비스의 심화 기술 문서
Nano Banana 2 API 소개
Nano Banana 2 비주얼 제작 API는 텍스트 설명과 샘플 그래픽으로 고품질 이미지를 만드는 고급 AI 시스템과의 통합을 지원합니다. 우리의 Nano Banana 2 플랫폼은 광범위한 작업 관리 및 알림 기능을 갖춘 간단한 REST 아키텍처를 제공합니다.
Nano Banana 2 핵심 기능
- • 최신 AI 시스템을 활용한 Nano Banana 2 텍스트-이미지 변환
- • 샘플 그래픽과 호환되는 Nano Banana 2 (최대 4개 이미지)
- • 진행 상황 모니터링이 가능한 Nano Banana 2 비동기 작업 실행
- • 실시간 상태 업데이트를 위한 Nano Banana 2 웹훅 통합
- • JSON 형식 응답을 제공하는 Nano Banana 2 REST 아키텍처
- • Nano Banana 2 Bearer 토큰 인증 시스템
overview.base_url
https://api.defapi.orgoverview.api_version
v1.0.0Nano Banana 2 시작 가이드
- 1. 메인 플랫폼을 통해 Nano Banana 2 API 자격 증명 등록
- 2. Authorization 헤더에 Nano Banana 2 액세스 토큰 포함
- 3. Nano Banana 2 이미지 생성 엔드포인트로 POST 요청 전송
- 4. 제공된 Nano Banana 2 작업 ID로 상태 확인
- 5. 작업 완료 시 생성된 Nano Banana 2 이미지 다운로드
신원 확인
모든 API 요청에는 Bearer 토큰 인증이 필요합니다. 각 전송 시 Authorization 매개변수에 액세스 자격 증명을 포함하세요.
인증 방법
Authorization 매개변수에 액세스 자격 증명을 포함하여 HTTP Bearer 토큰 검증을 구현하세요:
Authorization: Bearer <your-api-key>액세스 키 구조 예시
Authorization: Bearer dk-1234567890abcdef요청 예시
curl -X POST "https://api.defapi.org/api/image/gen" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer your-api-key-here" \
-d '{
"model": "google/gempix2",
"prompt": "A beautiful landscape"
}'인증 성공
- ✅ 액세스 자격 증명이 유효함
- ✅ 클라이언트 등록 상태가 활성화됨
- ✅ 충분한 서비스 크레딧 보유
자주 발생하는 문제
- ❌ 액세스 자격 증명 누락
- ❌ 잘못된 액세스 키 설정
- ❌ 비활성화되거나 중단된 등록
Nano Banana 2 이미지 생성 API
고급 AI 시스템과 유연한 텍스트 프롬프트 및 참조 이미지를 활용하여 Nano Banana 2로 이미지를 생성합니다.
연결 엔드포인트
POST /api/image/gen요청 매개변수
| Parameter | Type | Required | Description |
|---|---|---|---|
| model | string | Yes | Model identifier (e.g., "google/gempix2") |
| prompt | string | Yes | Text prompt describing the image |
| images | array | No | Reference image URLs (max 4) |
| callback_url | string | No | Webhook URL for completion notifications |
구현 예시
기본 Nano Banana 2 이미지 생성
{
"model": "google/gempix2",
"prompt": "A beautiful girl dancing in a garden"
}참조 이미지를 활용한 Nano Banana 2 생성
{
"model": "google/gempix2",
"prompt": "Put them in a basket",
"images": [
"https://cdn.openai.com/API/docs/images/body-lotion.png",
"https://cdn.openai.com/API/docs/images/soap.png"
],
"callback_url": "https://example.com/webhook/image-callback"
}응답 구조
{
"code": 0,
"message": "ok",
"data": {
"task_id": "ta12345678-1234-1234-1234-123456789abc"
}
}오류 처리
400 - Bad Request
{"code": 1, "message": "failed", "detail": "prompt is required"}401 - Unauthorized
{"code": 1, "message": "Invalid API key"}Nano Banana 2 작업 상태 API
Nano Banana 2 시각 제작 터미널에서 제공된 작업 식별자를 사용하여 Nano Banana 2 시각 제작 작업의 진행 상황과 결과를 조사합니다.
연결 터미널
GET /api/task/query?task_id=<task_id>조사 변수
| Parameter | Type | Required | Description |
|---|---|---|---|
| task_id | string | Yes | Unique task identifier returned from generation endpoint |
제출 예시
curl -X GET "https://api.defapi.org/api/task/query?task_id=ta823dfb-eaac-44fd-aec2-3e2c7ba8e071" \ -H "Authorization: Bearer your-api-key-here"
Nano Banana 2 작업 상태 카테고리
pending - Nano Banana 2 작업 초기화가 완료되어 처리 시작을 기다리는 중submitted - Nano Banana 2 작업이 제작 시퀀스에 입력됨in_progress - Nano Banana 2 작업이 현재 활발히 처리 중success - Nano Banana 2 작업이 성공적으로 완료되어 시각 자료가 제작됨failed - 기술적 문제로 인해 Nano Banana 2 작업이 중단됨문제 응답
404 - Task Not Found
{"code": 1, "message": "task not found"}401 - Unauthorized
{"code": 401, "message": "Invalid API key"}Nano Banana 2 정보 구조
API 통신 및 제출에서 사용되는 모든 Nano Banana 2 정보 구성 및 템플릿에 대한 종합 문서입니다.
ImageGenResult
Represents a generated image result.
{
"image": "https://google.datas.systems/fileSystem/response_images/287/2025/08/29/1756432513771985292_2989.png"
}| Field | Type | Description |
|---|---|---|
| image | string | Image URL or base64 data URI |
CallbackPayload
Payload sent to the callback_url when task status changes to final states.
{
"result": [
{
"image": "https://google.datas.systems/fileSystem/response_images/287/2025/08/29/1756432513771985292_2989.png"
}
],
"status": "success",
"task_id": "ta5c9705-b8ae-4cb9-aa6f-97c4fee88c8d",
"consumed": "0.500000",
"status_reason": {
"message": null
}
}| Field | Type | Description |
|---|---|---|
| result | array | Array of ImageGenResult objects (null if failed) |
| status | string | Final task status (success/failed) |
| task_id | string | Unique task identifier |
| consumed | string | Credits consumed by the task |
| status_reason | object | Status details including error message if failed |
Nano Banana 2 지원 구성
google/gempix2Nano Banana image generation modelgoogle/gemini-2.5-flash-imageGemini 2.5 Flash image model문제 관리
복잡한 상황을 관리하고 API 응답 지표를 해석하기 위한 종합 가이드북입니다. 모든 문제 알림은 효율적인 해결 방법을 위해 표준화된 형식을 따릅니다.
HTTP 응답 지표
OK
Request was successful
Bad Request
Invalid request parameters or malformed JSON
Unauthorized
Invalid, missing, or expired API key
Not Found
Task not found or endpoint doesn't exist
Internal Server Error
Server-side error occurred
문제 해결 권장 방법
- 출력 내용을 분석하기 전에 항상 HTTP 응답 지표를 확인하세요
- 500 오류 발생 시 반복 메커니즘에서 점진적 지연 알고리즘을 사용하세요
- 문제 해결을 위해 문제 알림을 상세히 기록하세요
- 400 오류를 방지하기 위해 요청 전송 전에 입력 유효성을 확인하세요
- 클라이언트에게 API 자격 증명 업데이트를 요청하여 인증 문제를 해결하세요
- 과도한 상태 조회보다는 적절한 간격으로 작업 진행 상황을 추적하세요
- 지속적인 완료 모니터링을 제거하기 위해 가능한 한 웹훅 통합을 사용하세요
문제 관리 예시 (JavaScript)
async function generateImage(prompt, apiKey) {
try {
const response = await fetch('https://api.defapi.org/api/image/gen', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${apiKey}`
},
body: JSON.stringify({
model: 'google/gempix2',
prompt: prompt
})
});
if (!response.ok) {
const errorData = await response.json();
throw new Error(`API Error ${response.status}: ${errorData.message}`);
}
const data = await response.json();
return data.data.task_id;
} catch (error) {
console.error('Image generation failed:', error.message);
throw error;
}
}