Sınırlı süreli fırsat: GPT Image 2 görsel başına $0.008’den başlar
Şimdi dene
Kamu API

GPT Image Hub API Dokümanlar

Görüntü oluşturma, model listeleme, kredi bakiyesi ve oluşturma arama uç noktalarını çağırmak için Bearer API tuşlarını kullanın.

Temel URLhttps://www.gptimagehub.comKimlik doğrulama başlığıAuthorization: Bearer gih_live_...

Hızlı başlangıç

1
Create an API key

Sign in, open API Keys in your account, create a key, and store the one-time secret.

2
Check models and credits

Call /api/v1/models for model capabilities, then /api/v1/credits for your balance.

3
Submit a generation request

Call /api/v1/images/generations. For long-running calls, set async to true and poll the returned poll_url.

Uç noktalar

GET/api/v1/modelsNo

Mevcut görsel modellerini, desteklenen oranları, kaliteleri ve kredi maliyetini listeleyin.

GET/api/v1/creditsBearer

API anahtarına sahip olan kullanıcının kredi bakiyesini okuyun.

POST/api/v1/images/generationsBearer

Generate images from a prompt, or set async=true to queue a background task.

GET/api/v1/generations/:generationIdBearer

Bir nesil günlüğünü ve o nesil için kaydedilen görüntüleri getirin.

Kimlik doğrulama

Model listesi dışındaki tüm v1 uç noktaları, Authorization başlığında bir API anahtarı gerektirir. Ham anahtar, oluşturma sırasında bir kez gösterilir; sunucu yalnızca bir karma saklar.

Authorization: Bearer gih_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Modeller

Modelin uç noktası, model kimliklerini, sağlayıcıları, desteklenen en boy oranlarını, desteklenen nitelikleri, referans görüntü sınırlarını ve görüntü başına krediyi döndürür.

curl https://www.gptimagehub.com/api/v1/models

GPT IMAGE 2

gpt-image-2
openai
API model kimliğigpt-image-2
sağlayıcıopenai
Kredi1K: 8 | 2K: 10 | 4K: 12
Varsayılan seçeneklerauto, 1K
Desteklenen nitelikler1K, 2K, 4K
Desteklenen oranlarauto, 1:1, 4:3, 3:4, 3:2, 2:3, 16:9, 9:16, 5:4, 4:5, 21:9, 9:21, 2:1, 1:2, 3:1, 1:3
Referans görselleriMaksimum resim: 16

Talep alanları

AlanDeğerNotlar
modelgpt-image-2Bu model kimliğine ayarlanmalıdır
size1024x1024OpenAI-compatible output size, for example auto or 1024x1024
qualityhighMevcut nitelikler: auto, low, medium, high
n11'den 4'e kadar resim sayısı
reference_image@./reference.pngYalnızca multipart/form-data için; sayım model sınırını aşamaz

JSON çağrı

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 with premium studio lighting",
    "size": "1024x1024",
    "quality": "high",
    "n": 1
  }'

Referans görseli çağrısı

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"

Kredi

Kredi uç noktası, API anahtarına sahip olan kullanıcının bakiyesini, hesap türünü ve yaklaşan kredi son kullanma tarihini döndürür.

curl https://www.gptimagehub.com/api/v1/credits \
  -H "Authorization: Bearer gih_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

Görüntüler oluştur

The image generation endpoint waits for completion by default. Set async to true to receive a generation id immediately and poll /api/v1/generations/:generationId for the result. Credits are charged before provider generation and refunded automatically when the provider fails or returns fewer images than requested.

JSON isteği

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
  }'

Async task

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 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": 8
  },
  "poll_url": "https://www.gptimagehub.com/api/v1/generations/clx_generation_log_id"
}

Referans görseli isteği

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"

Yanıt

{
  "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": 8
  },
  "balance": {
    "credits": 112,
    "account_type": "PRO",
    "next_expiration": null
  }
}

Oluşturmayı al

Kaydedilen günlüğünü ve URLs görüntüsünü almak için nesil uç noktası tarafından döndürülen kimliği kullanın. API anahtarları yalnızca aynı kullanıcıya ait nesilleri okuyabilir.

curl https://www.gptimagehub.com/api/v1/generations/clx_generation_log_id \
  -H "Authorization: Bearer gih_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"

Hatalar

{
  "error": {
    "message": "Invalid request body",
    "code": "invalid_request"
  }
}
HTTPcodeAçıklama
400invalid_requestİstek gövdesi veya parametreler geçersiz.
401missingApiKeyAuthorization başlığı eksik.
401invalidApiKeyAPI anahtarı mevcut değil veya iptal edildi.
401expiredApiKeyAPI anahtarının süresi doldu.
402insufficientCreditsHesapta yeterli kredi yok.
404notFoundİstenilen kaynak bulunamadı.
500generationFailedGörüntü oluşturma başarısız oldu.

Sınırlar

  • Synchronous generation can run for up to 800 seconds on production.
  • n must be between 1 and 4.
  • Reference images support PNG, JPG, JPEG, and WebP. Each file can be up to 50MB.
  • The maximum reference image count is defined by each model's reference_image_limit.
  • Async mode returns 202 with poll_url. Webhooks and a separate API rate limit are not included yet.