期間限定特価:GPT Image 2 は 1 枚 $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 キーが必要です。生のキーは作成時に 1 回表示されます。サーバーにはハッシュのみが保存されます。

Authorization: Bearer gih_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

モデル

モデル エンドポイントは、モデル ID、プロバイダー、サポートされているアスペクト比、サポートされている品質、参照画像の制限、および画像ごとのクレジットを返します。

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

GPT IMAGE 2

gpt-image-2
openai
API モデル IDgpt-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このモデル ID に設定する必要があります
size1024x1024OpenAI-compatible output size, for example auto or 1024x1024
qualityhigh利用可能な品質: auto, low, medium, high
n1画像数、1 ~ 4
reference_image@./reference.pngmultipart/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
  }
}

世代の取得

生成エンドポイントによって返された ID を使用して、保存されたログとイメージ URL を取得します。 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.