GPT Image Hub API Doc
Utilizza le chiavi Bearer API per chiamare gli endpoint di generazione delle immagini, elenco dei modelli, saldo del credito e ricerca della generazione.
https://www.gptimagehub.comIntestazione di autenticazioneAuthorization: Bearer gih_live_...Avvio rapido
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.
Endpoint
/api/v1/modelsNoElenca i modelli di immagine disponibili, i rapporti supportati, le qualità e il costo del credito.
/api/v1/creditsBearerLeggi il saldo del credito per l'utente che possiede la chiave API.
/api/v1/images/generationsBearerGenerate images from a prompt, or set async=true to queue a background task.
/api/v1/generations/:generationIdBearerRecupera un registro di generazione e le immagini salvate per quella generazione.
Autenticazione
Tutti gli endpoint v1, ad eccezione dell'elenco dei modelli, richiedono una chiave API nell'intestazione Authorization. La chiave grezza viene mostrata una volta al momento della creazione; il server memorizza solo un hash.
Authorization: Bearer gih_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxModelli
L'endpoint dei modelli restituisce ID modello, fornitori, proporzioni supportate, qualità supportate, limiti di immagini di riferimento e crediti per immagine.
curl https://www.gptimagehub.com/api/v1/modelsGPT IMAGE 2
gpt-image-2Campi richiesta
| Campo | Valore | Note |
|---|---|---|
model | gpt-image-2 | Deve essere impostato su questo ID modello |
size | 1024x1024 | OpenAI-compatible output size, for example auto or 1024x1024 |
quality | high | Qualità disponibili: auto, low, medium, high |
n | 1 | Conteggio immagini, da 1 a 4 |
reference_image | @./reference.png | Solo per multipart/form-data; il conteggio non può superare il limite del modello |
JSON chiama
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
}'Richiamo dell'immagine di riferimento
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"Crediti
L'endpoint dei crediti restituisce il saldo, il tipo di conto e la prossima scadenza del credito per l'utente che possiede la chiave API.
curl https://www.gptimagehub.com/api/v1/credits \
-H "Authorization: Bearer gih_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"Genera immagini
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 richiesta
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"
}Richiesta immagine di riferimento
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"Risposta
{
"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
}
}Recupera la generazione
Utilizza l'ID restituito dall'endpoint di generazione per recuperare il log e l'immagine salvati URLs. Le chiavi API possono leggere solo generazioni possedute dallo stesso utente.
curl https://www.gptimagehub.com/api/v1/generations/clx_generation_log_id \
-H "Authorization: Bearer gih_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"Errori
{
"error": {
"message": "Invalid request body",
"code": "invalid_request"
}
}| HTTP | code | Descrizione |
|---|---|---|
| 400 | invalid_request | Il corpo o i parametri della richiesta non sono validi. |
| 401 | missingApiKey | Manca l'intestazione Authorization. |
| 401 | invalidApiKey | La chiave API non esiste o è stata revocata. |
| 401 | expiredApiKey | La chiave API è scaduta. |
| 402 | insufficientCredits | L'account non dispone di crediti sufficienti. |
| 404 | notFound | La risorsa richiesta non è stata trovata. |
| 500 | generationFailed | La generazione dell'immagine non è riuscita. |
Limiti
- 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.