GPT Image Hub API المستندات
استخدم مفاتيح Bearer API لاستدعاء إنشاء الصور وقائمة النماذج ورصيد الائتمان ونقاط نهاية البحث عن الإنشاء.
https://www.gptimagehub.comرأس المصادقةAuthorization: Bearer gih_live_...بداية سريعة
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.
نقاط النهاية
/api/v1/modelsNoقائمة نماذج الصور المتاحة، والنسب المدعومة، والصفات، وتكلفة الائتمان.
/api/v1/creditsBearerاقرأ الرصيد الدائن للمستخدم الذي يملك المفتاح API.
/api/v1/images/generationsBearerGenerate images from a prompt, or set async=true to queue a background task.
/api/v1/generations/:generationIdBearerقم بإحضار سجل الإنشاء والصور المحفوظة لهذا الجيل.
المصادقة
تتطلب جميع نقاط النهاية v1 باستثناء قائمة النماذج مفتاح API في الرأس Authorization. يظهر المفتاح الأولي مرة واحدة في وقت الإنشاء؛ يقوم الخادم بتخزين التجزئة فقط.
Authorization: Bearer gih_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxنماذج
تقوم نقطة نهاية النماذج بإرجاع معرفات النموذج والموفرين ونسب العرض إلى الارتفاع المدعومة والصفات المدعومة وحدود الصورة المرجعية والاعتمادات لكل صورة.
curl https://www.gptimagehub.com/api/v1/modelsGPT IMAGE 2
gpt-image-2حقول الطلب
| الميدان | القيمة | ملاحظات |
|---|---|---|
model | gpt-image-2 | يجب ضبطه على معرف النموذج هذا |
size | 1024x1024 | OpenAI-compatible output size, for example auto or 1024x1024 |
quality | high | الصفات المتاحة: auto, low, medium, high |
n | 1 | عدد الصور من 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"
}
}| HTTP | code | الوصف |
|---|---|---|
| 400 | invalid_request | نص الطلب أو المعلمات غير صالحة. |
| 401 | missingApiKey | رأس Authorization مفقود. |
| 401 | invalidApiKey | المفتاح API غير موجود أو تم إبطاله. |
| 401 | expiredApiKey | المفتاح API منتهي الصلاحية. |
| 402 | insufficientCredits | الحساب لا يحتوي على أرصدة كافية. |
| 404 | notFound | لم يتم العثور على المورد المطلوب. |
| 500 | generationFailed | فشل إنشاء الصورة. |
حدود
- 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.