빠른 시작
로그인한 뒤 계정에서 API 키 페이지를 열고 키를 생성한 다음, 한 번만 표시되는 시크릿 키를 저장하세요.
모델 기능을 확인하려면 /api/v1/models를 호출하고 잔액을 확인하려면 /api/v1/credits를 호출하세요.
/api/v1/images/generations를 호출합니다. 오래 걸리는 호출은 async를 true로 설정하고 반환된 poll_url을 폴링하세요.
엔드포인트
/api/v1/modelsNo사용 가능한 이미지 모델, 지원되는 비율, 품질 및 크레딧 비용을 나열합니다.
/api/v1/creditsBearerAPI 키를 소유한 사용자의 크레딧 잔액을 읽습니다.
/api/v1/images/generationsBearer프롬프트로 이미지를 생성하거나, async=true로 설정해 백그라운드 작업으로 대기열에 등록합니다.
/api/v1/generations/:generationIdBearer생성 로그와 해당 생성에서 저장된 이미지를 가져옵니다.
인증
모델 목록을 제외한 모든 v1 엔드포인트에는 Authorization 헤더에 API 키가 필요합니다. 원시 키는 생성 시 한 번 표시됩니다. 서버는 해시만 저장합니다.
Authorization: Bearer gih_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx모델
모델 엔드포인트는 모델 ID, 공급자, 지원되는 종횡비, 지원되는 품질, 참조 이미지 제한 및 이미지당 크레딧을 반환합니다.
curl https://www.gptimagehub.com/api/v1/modelsZ-Image Turbo
z-image-turbo요청 필드
| 필드 | 값 | 메모 |
|---|---|---|
model | z-image-turbo | 이 모델 ID로 설정되어야 합니다. |
size | 1024x1024 | OpenAI-compatible output size, for example auto or 1024x1024 |
quality | high | 사용 가능한 품질: auto, low, medium, high |
n | 1 | 이미지 수(1~4) |
reference_image | - | multipart/form-data에만 해당됩니다. 개수는 모델 한도를 초과할 수 없습니다. |
JSON 호출
curl https://www.gptimagehub.com/api/v1/images/generations \
-H "Authorization: Bearer gih_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"model": "z-image-turbo",
"prompt": "A cinematic product photo with premium studio lighting",
"size": "1024x1024",
"quality": "high",
"n": 1
}'크레딧
크레딧 엔드포인트는 API 키를 소유한 사용자에 대한 잔액, 계정 유형 및 향후 크레딧 만료를 반환합니다.
curl https://www.gptimagehub.com/api/v1/credits \
-H "Authorization: Bearer gih_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"이미지 생성
이미지 생성 엔드포인트는 기본적으로 생성이 완료될 때까지 기다립니다. async를 true로 설정하면 generation id를 즉시 받을 수 있으며, /api/v1/generations/:generationId를 폴링해 결과를 확인합니다. 크레딧은 공급자 생성 전에 차감되며, 공급자 쪽에서 실패하거나 요청보다 적은 이미지를 반환하면 자동으로 환불됩니다.
JSON 요청
curl https://www.gptimagehub.com/api/v1/images/generations \
-H "Authorization: Bearer gih_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-image-2",
"prompt": "A cinematic product photo of a transparent perfume bottle on black marble",
"size": "1024x1024",
"quality": "high",
"n": 1
}'비동기 작업
curl https://www.gptimagehub.com/api/v1/images/generations \
-H "Authorization: Bearer gih_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: order-1042-hero-image" \
-d '{
"model": "gpt-image-2",
"prompt": "A cinematic product photo with premium studio lighting",
"size": "1024x1024",
"quality": "high",
"n": 1,
"async": true
}'{
"object": "image_generation",
"id": "clx_generation_log_id",
"status": "queued",
"model": "gpt-image-2",
"aspect_ratio": "1:1",
"quality": "1K",
"created_at": "2026-04-30T08:00:00.000Z",
"images": [],
"usage": {
"credits": 0,
"credits_requested": 7
},
"poll_url": "https://www.gptimagehub.com/api/v1/generations/clx_generation_log_id"
}참조 이미지 요청
curl https://www.gptimagehub.com/api/v1/images/generations \
-H "Authorization: Bearer gih_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
-F "model=gpt-image-2" \
-F "prompt=Use the reference image and render it as a premium studio product shot" \
-F "size=1024x1024" \
-F "quality=high" \
-F "n=1" \
-F "reference_image=@./reference.png"응답
{
"object": "image_generation",
"id": "clx_generation_log_id",
"status": "succeeded",
"model": "gpt-image-2",
"aspect_ratio": "1:1",
"quality": "1K",
"images": [
{
"id": "clx_image_id",
"object": "image",
"url": "https://cdn.example.com/generations/user/image.png",
"created_at": "2026-04-30T08:00:00.000Z"
}
],
"usage": {
"credits": 7
},
"balance": {
"credits": 113,
"account_type": "PRO",
"next_expiration": null
}
}생성 결과 조회
생성 엔드포인트가 반환한 ID로 저장된 생성 로그와 이미지 URL을 조회합니다. API 키로는 같은 사용자가 소유한 생성 기록만 읽을 수 있습니다.
curl https://www.gptimagehub.com/api/v1/generations/clx_generation_log_id \
-H "Authorization: Bearer gih_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"오류
{
"error": {
"message": "Invalid request body",
"code": "invalidRequest"
}
}| HTTP | code | 설명 |
|---|---|---|
| 400 | invalidRequest | 요청 본문 또는 매개변수가 잘못되었습니다. |
| 401 | missingApiKey | Authorization 헤더가 누락되었습니다. |
| 401 | invalidApiKey | API 키가 존재하지 않거나 취소되었습니다. |
| 401 | expiredApiKey | API 키가 만료되었습니다. |
| 401 | emailUnverified | 계정 이메일이 아직 인증되지 않았습니다. 발송된 이메일에서 인증을 완료한 후 다시 시도하세요. |
| 402 | insufficientCredits | 계정에 충분한 크레딧이 없습니다. |
| 404 | notFound | 요청한 리소스를 찾을 수 없습니다. |
| 429 | rateLimited | 요청이 너무 많습니다. Retry-After 헤더에 지정된 시간(초) 동안 대기한 후 다시 시도하세요. |
| 429 | freeTierLimited | 무료 가입 크레딧만 있는 계정은 시간당 최대 10개의 이미지를 생성할 수 있습니다. |
| 500 | generationFailed | 이미지 생성에 실패했습니다. |
| 503 | serviceUnavailable | 서비스를 일시적으로 사용할 수 없습니다. Retry-After 헤더 이후에 다시 시도하세요. |
한도
- 프로덕션 환경에서 동기식 생성은 최대 800초 동안 실행될 수 있습니다.
- n은 1에서 4 사이여야 합니다.
- 참조 이미지는 PNG, JPG, JPEG 및 WebP를 지원합니다. 모든 참조 이미지를 포함한 전체 요청은 4.5MB 미만을 유지해야 합니다(이미지 총합은 4MB 미만으로 유지). 더 큰 요청은 API에 도달하기 전에 호스팅 플랫폼에서 일반 텍스트 413으로 거부되므로, 먼저 이미지 크기를 조정하거나 압축하세요.
- 최대 참조 이미지 수는 각 모델의 reference_image_limit에 의해 정의됩니다.
- 속도 제한: API 키당 분당 60회의 생성 요청 및 IP 주소당 분당 120회. 모든 응답에는 RateLimit-Limit, RateLimit-Remaining 및 RateLimit-Reset 헤더가 포함되며, 429 응답에는 Retry-After도 포함됩니다.
- 생성을 안전하게 재시도하려면 Idempotency-Key 헤더(최대 120자)를 전송하세요. 동일한 API 키로 동일한 키를 다시 요청하면 요금이 다시 청구되지 않고 기존 생성 결과가 반환됩니다.
- 비동기 모드는 poll_url과 함께 202를 반환합니다. 웹후크는 아직 지원되지 않습니다.