介面說明

為了方便開發者呼叫不同的圖像生成模型,Aihubmix 提供了統一的圖形介面,支援以下多種主流模型: 介面規格:
Curl
curl https://aihubmix.com/v1/models/<model_path>/predictions \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer sk-***" \
    -d '{
  "input": {
    "prompt": "your prompt"
  }
}'
其中:
  • https://aihubmix.com/v1/models/ 為固定前綴
  • <model_path> 為模型路徑,支援:
    • opanai/gpt-image-1
    • opanai/dall-e-3
    • ideogram/V3
    • stability/Stable-Diffusion-3-5-Large
    • imagen-4.0-generate-preview-05-20
    • imagen-4.0-ultra-generate-exp-05-20
    • imagen-3.0-generate-002
  • sk-*** 為你在 Aihubmix 生成的 API Key

下面是各個模型的呼叫方法。

OpenAI

支援的模型:

  • gpt-image-1
  • dall-e-3
不支援 2 個逆向模型 gpt-4o-image-vipgpt-4o-image

呼叫方法:

curl https://aihubmix.com/v1/models/opanai/gpt-image-1/predictions \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer sk-***" \
    -d '{
  "input": {
    "prompt": "A deer drinking in the lake, Sakura petals falling, green and clean water, japanese temple, dappled sunlight, cinematic lighting, expansive view, peace",
    "size": "1024x1024", 
    "n": 1,
    "quality": "high",
    "moderation": "low",
    "background": "auto"
  }
}'

Ideogram V3

支援的模型:

  • V3
  1. V3 以下版本(V_2、V_1 等)為舊介面,暫不支援
  2. 返回的連結需要開啟代理網路才能取得

呼叫方法:

curl https://aihubmix.com/v1/models/ideogram/V3/predictions \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer sk-***" \
    -d '{
  "input": {
    "prompt": "A deer drinking in the lake, Sakura petals falling, green and clean water, japanese temple, dappled sunlight, cinematic lighting, expansive view, peace, in the style of Pixar 3D",
    "rendering_speed": "QUALITY",
    "aspect_ratio": "2x1"
  }
}'

Stability

支援的模型:

  • Stable-Diffusion-3-5-Large

呼叫方法:

curl https://aihubmix.com/v1/models/stability/Stable-Diffusion-3-5-Large/predictions \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer sk-***" \
    -d '{
  "input": {
    "prompt": "A deer drinking in the lake, Sakura petals falling, green and clean water, japanese temple, dappled sunlight, cinematic lighting, expansive view, peace",
    "n": 1
  }
}'

Google Imagen

支援的模型:

  • imagen-3.0-generate-002
  • imagen-4.0-generate-preview-05-20
  • imagen-4.0-ultra-generate-exp-05-20
不支援 gemini 系列

呼叫方法:

curl https://aihubmix.com/v1/models/google/imagen-3.0-generate-002/predictions \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer sk-***" \
    -d '{
  "input": {
    "prompt": "A deer drinking in the lake, Sakura petals falling, green and clean water, japanese temple, dappled sunlight, cinematic lighting, expansive view, peace",
    "numberOfImages": 1
  }
}'