सीमित समय ऑफर: GPT Image 2 सिर्फ $0.008 प्रति इमेज से
अभी आज़माएं
सार्वजनिक API

GPT Image Hub API दस्तावेज़

इमेज जेनरेशन, मॉडल लिस्टिंग, क्रेडिट बैलेंस और जेनरेशन लुकअप एंडपॉइंट्स को कॉल करने के लिए Bearer API कुंजियों का उपयोग करें।

आधार URLhttps://www.gptimagehub.comप्रमाणीकरण शीर्षलेखAuthorization: Bearer gih_live_...

त्वरित शुरुआत

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.

समापनबिंदु

GET/api/v1/modelsNo

उपलब्ध छवि मॉडल, समर्थित अनुपात, गुण और क्रेडिट लागत की सूची बनाएं।

GET/api/v1/creditsBearer

उस उपयोगकर्ता के लिए क्रेडिट शेष पढ़ें जिसके पास API कुंजी है।

POST/api/v1/images/generationsBearer

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

GET/api/v1/generations/:generationIdBearer

एक पीढ़ी लॉग और उस पीढ़ी के लिए सहेजी गई छवियां प्राप्त करें।

प्रमाणीकरण

मॉडल सूची को छोड़कर सभी v1 समापन बिंदुओं को Authorization हेडर में API कुंजी की आवश्यकता होती है। निर्माण के समय कच्ची कुंजी एक बार दिखाई जाती है; सर्वर केवल हैश संग्रहीत करता है।

Authorization: Bearer gih_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

मॉडल

मॉडल समापन बिंदु मॉडल आईडी, प्रदाता, समर्थित पहलू अनुपात, समर्थित गुण, संदर्भ छवि सीमाएं और प्रति छवि क्रेडिट लौटाता है।

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

GPT IMAGE 2

gpt-image-2
openai
API मॉडल आईडीgpt-image-2
प्रदाताopenai
श्रेय1K: 8 | 2K: 10 | 4K: 12
डिफ़ॉल्ट विकल्पauto, 1K
समर्थित गुण1K, 2K, 4K
समर्थित अनुपातauto, 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
संदर्भ छवियाँअधिकतम छवियाँ: 16

फ़ील्ड का अनुरोध करें

मैदानमूल्यटिप्पणियाँ
modelgpt-image-2इस मॉडल आईडी पर सेट होना चाहिए
size1024x1024OpenAI-compatible output size, for example auto or 1024x1024
qualityhighउपलब्ध गुण: auto, low, medium, high
n1छवि गिनती, 1 से 4 तक
reference_image@./reference.pngकेवल 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": "gpt-image-2",
    "prompt": "A cinematic product photo with premium studio lighting",
    "size": "1024x1024",
    "quality": "high",
    "n": 1
  }'

संदर्भ छवि कॉल

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"

श्रेय

क्रेडिट एंडपॉइंट उस उपयोगकर्ता के लिए शेष राशि, खाता प्रकार और आगामी क्रेडिट समाप्ति लौटाता है जिसके पास API कुंजी है।

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

छवियाँ उत्पन्न करें

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 अनुरोध

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

संदर्भ छवि अनुरोध

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

पीढ़ी पुनः प्राप्त करें

इसके सहेजे गए लॉग और छवि URLs को पुनः प्राप्त करने के लिए जनरेशन एंडपॉइंट द्वारा लौटाई गई आईडी का उपयोग करें। 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": "invalid_request"
  }
}
HTTPcodeविवरण
400invalid_requestअनुरोध का मुख्य भाग या पैरामीटर अमान्य हैं.
401missingApiKeyAuthorization हेडर गायब है.
401invalidApiKeyAPI कुंजी मौजूद नहीं है या निरस्त कर दी गई है।
401expiredApiKeyAPI कुंजी समाप्त हो गई है.
402insufficientCreditsखाते में पर्याप्त क्रेडिट नहीं है.
404notFoundअनुरोधित संसाधन नहीं मिला.
500generationFailedछवि निर्माण विफल रहा.

सीमाएँ

  • 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.