GPT Image Hub API Dokumentacja
Użyj kluczy Bearer API, aby wywołać generowanie obrazu, listę modeli, saldo kredytowe i punkty końcowe wyszukiwania generacji.
https://www.gptimagehub.comNagłówek uwierzytelnianiaAuthorization: Bearer gih_live_...Szybki start
Sign in, open API Keys in your account, create a key, and store the one-time secret.
Call /api/v1/models for model capabilities, then /api/v1/credits for your balance.
Call /api/v1/images/generations. For long-running calls, set async to true and poll the returned poll_url.
Punkty końcowe
/api/v1/modelsNoLista dostępnych modeli obrazów, obsługiwanych współczynników, jakości i kosztów kredytu.
/api/v1/creditsBearerOdczytaj saldo kredytu użytkownika będącego właścicielem klucza API.
/api/v1/images/generationsBearerGenerate images from a prompt, or set async=true to queue a background task.
/api/v1/generations/:generationIdBearerPobierz dziennik generacji i obrazy zapisane dla tej generacji.
Uwierzytelnianie
Wszystkie punkty końcowe w wersji 1 z wyjątkiem listy modeli wymagają klucza API w nagłówku Authorization. Surowy klucz jest wyświetlany raz w momencie tworzenia; serwer przechowuje tylko skrót.
Authorization: Bearer gih_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxModele
Punkt końcowy modeli zwraca identyfikatory modeli, dostawców, obsługiwane współczynniki proporcji, obsługiwane jakości, limity obrazów referencyjnych i kredyty na obraz.
curl https://www.gptimagehub.com/api/v1/modelsGPT IMAGE 2
gpt-image-2Pola żądania
| Pole | Wartość | Notatki |
|---|---|---|
model | gpt-image-2 | Musi być ustawiony na ten identyfikator modelu |
size | 1024x1024 | OpenAI-compatible output size, for example auto or 1024x1024 |
quality | high | Dostępne jakości: auto, low, medium, high |
n | 1 | Liczba obrazów, od 1 do 4 |
reference_image | @./reference.png | Tylko dla multipart/form-data; liczba nie może przekroczyć limitu modelu |
JSON zadzwoń
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
}'Wywołanie obrazu referencyjnego
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"Kredyty
Punkt końcowy kredytów zwraca saldo, typ konta i zbliżającą się wygaśnięcie kredytu dla użytkownika będącego właścicielem klucza API.
curl https://www.gptimagehub.com/api/v1/credits \
-H "Authorization: Bearer gih_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"Generuj obrazy
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 żądanie
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"
}Żądanie obrazu referencyjnego
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"Odpowiedź
{
"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
}
}Odzyskaj generację
Użyj identyfikatora zwróconego przez punkt końcowy generacji, aby pobrać zapisany dziennik i obraz URLs. Klucze API mogą odczytywać tylko generacje należące do tego samego użytkownika.
curl https://www.gptimagehub.com/api/v1/generations/clx_generation_log_id \
-H "Authorization: Bearer gih_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"Błędy
{
"error": {
"message": "Invalid request body",
"code": "invalid_request"
}
}| HTTP | code | Opis |
|---|---|---|
| 400 | invalid_request | Treść żądania lub parametry są nieprawidłowe. |
| 401 | missingApiKey | Brak nagłówka Authorization. |
| 401 | invalidApiKey | Klucz API nie istnieje lub został unieważniony. |
| 401 | expiredApiKey | Klucz API wygasł. |
| 402 | insufficientCredits | Na koncie nie ma wystarczającej liczby kredytów. |
| 404 | notFound | Nie znaleziono żądanego zasobu. |
| 500 | generationFailed | Wygenerowanie obrazu nie powiodło się. |
Limity
- 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.