跳轉到主要內容

介面說明

為了方便開發者呼叫不同的圖像生成模型,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> 為模型路徑,支援:
    • openai/gpt-image-2
    • opanai/gpt-image-1
    • opanai/dall-e-3
    • imagen-4.0-ultra-generate-001
    • imagen-4.0-generate-001
    • imagen-4.0-fast-generate-001
    • imagen-4.0-fast-generate-preview-06-06
    • imagen-3.0-generate-002
    • flux-kontext-max
    • flux-kontext-pro
    • FLUX.1-Kontext-pro
    • FLUX-1.1-pro
    • ideogram/V3
    • stability/Stable-Diffusion-3-5-Large
  • sk-*** 為你在 Aihubmix 生成的 API Key

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

OpenAI

支援的模型:

  • gpt-image-2(支援透過 OpenAI 相容圖片編輯端點呼叫,模型 ID 必須寫成 gpt-image-2,不可簡寫為 image2
  • gpt-image-1
  • dall-e-3

呼叫方法:

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

gpt-image-2

這是 OpenAI 圖片編輯模型,呼叫時請填寫完整模型名 gpt-image-2,不可簡寫為 image2。該端點返回 b64_json 時,可按下面範例保存為 edited.png
curl.exe -sS -X POST "https://aihubmix.com/v1/images/edits" `
  -H "Authorization: Bearer YOUR_API_KEY" `
  -F "model=gpt-image-2" `
  -F "prompt=把背景換成藍天白雲" `
  -F "image=@test.png" `
  -F "size=1024x1024" `
  -D headers.txt `
  -o response.json `
  -w "HTTP_CODE:%{http_code}`nTOTAL:%{time_total}`n"

$b64 = (Get-Content .\response.json -Raw | ConvertFrom-Json).data[0].b64_json
[IO.File]::WriteAllBytes(".\edited.png", [Convert]::FromBase64String($b64))

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-4.0-ultra-generate-001
  • imagen-4.0-generate-001
  • imagen-4.0-fast-generate-001
  • imagen-4.0-fast-generate-preview-06-06
  • imagen-3.0-generate-002
不支援 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
  }
}'

最後更新:2026-06-01