接口说明

为了方便开发者调用不同的图像生成模型,Aihubmix 提供了统一的图形接口,支持以下多种主流模型:

接口规格:

Curl
curl https://api.aihubmix.com/v1/models/<model_path>/predictions \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer sk-***" \
    -d '{
  "input": {
    "prompt": "your prompt"
  }
}'

其中:

  • https://api.aihubmix.com/v1/models/ 为固定前缀
  • <model_path> 为模型路径,如 ideogram/V3stability/Stable-Diffusion-3-5-Largeopanai/gpt-image-1google/gemini-2.0-pro-exp-02-05
  • sk-*** 为你在 Aihubmix 生成的 API Key

下面是各个模型的调用方法。

OpenAI

支持的模型:

  • gpt-image-1
  • dall-e-3

不支持 2 个逆向模型 gpt-4o-image-vipgpt-4o-image

调用方法:

curl https://api.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://api.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://api.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://api.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
  }
}'