介面說明
為了方便開發者呼叫不同的圖像生成模型,Aihubmix 提供了統一的圖形介面,支援以下多種主流模型:
介面規格:
curl https://aihubmix.com/v1/models/ < model_pat h > /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
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
支援的模型:
不支援 2 個逆向模型 gpt-4o-image-vip 和 gpt-4o-image
呼叫方法:
Curl gpt-image-1
Curl 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"
}
}'
Ideogram V3
支援的模型:
V3 以下版本(V_2、V_1 等)為舊介面,暫不支援
返回的連結需要開啟代理網路才能取得
呼叫方法:
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
呼叫方法:
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
}
}'