عرض لفترة محدودة: 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 باستثناء قائمة النماذج مفتاح API في الرأس Authorization. يظهر المفتاح الأولي مرة واحدة في وقت الإنشاء؛ يقوم الخادم بتخزين التجزئة فقط.

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نص الطلب أو المعلمات غير صالحة.
401missingApiKeyرأس Authorization مفقود.
401invalidApiKeyالمفتاح API غير موجود أو تم إبطاله.
401expiredApiKeyالمفتاح API منتهي الصلاحية.
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.