跳转到主要内容

可用模型列表

OpenAI 模型

  • gpt-image-1.5 —— OpenAI 最新的图像生成模型,它具有更好的指令遵循性和对提示的执行能力。
  • gpt-image-1 —— 多模态语言模型,它接受文本和图像输入,并生成图像输出。
  • gpt-image-1-mini —— gpt-image-1 的经济型版本。
  • dall-e-3 —— 能够根据自然语言描述创建逼真的图像和艺术作品,支持根据提示创建指定尺寸的新图像。

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

Qwen 模型

  • qwen-image —— Qwen 系列中的一个图像生成基础模型,在复杂文本渲染和精确图像编辑方面取得了显著进展。
  • qwen-image-edit —— Qwen 图像编辑模型。

Doubao 模型

  • doubao-seedream-4-5 —— 字节跳动最新推出的图像多模态模型,整合了文生图、图生图、组图输出等能力。
  • doubao-seedream-4-0 —— 字节跳动SOTA级多模态图像创作模型,支持多图融合创作、图像编辑、组图生成等多样玩法。

Flux 模型

  • flux-2-flex —— 专为真实世界的创意生产工作流打造,在生成高质量图像的同时,能够保持多参考图之间的角色与风格一致性。
  • flux-2-pro —— 黑森林实验室研发的图片生成与编辑模型,支持复杂文本的读写。
  • FLUX.1-Kontext-pro —— 黑森林实验室研发的多模态流匹配模型,既支持文本到图像的生成,又支持在上下文中进行图像编辑。

iRAG 模型

  • irag-1.0 —— 百度自研生图模型,能够生成超真实图片。
  • ernie-irag-edit —— 百度自研的图像编辑模型,支持基于图片进行 erase、repaint、variation 等操作。

Ideogram 模型

  • V3 —— Ideogram AI 生图模型,能够快速生成图片。

API 接口

请求地址


POST https://aihubmix.com/v1/models/<model_path>/predictions
<model_path> 为<供应商/模型id>,如<openai/gpt-image-1.5>,<qianfan/qwen-image>。

请求头

Authorization: Bearer $AIHUBMIX_API_KEY
Content-Type: application/json

请求参数

通用参数

参数类型必填说明
promptstring提示词
sizestring图像尺寸,支持1K(Doubao-4-5系列不支持)、2K4Kauto (默认)。Qwen系列支持参数:512*1024768*512768*10241024*576576*10241024*1024(默认)
imagestring参考图片路径
ninteger生成图像数量,支持1-10,默认为 1
qualitystring渲染质量,支持 lowmediumhigh,质量越高,耗时越长

OpenAI 模型参数

参数类型必填说明
input_fidelitystring保真度,支highlow(默认)
moderationstring内容审核严格程度,支持 auto (默认,标准过滤)和 low(过滤限制较少),图生图模式下不支持
output_formatstring输出图片格式,支持 pngjpeg (默认) 、webp

Flux 模型参数

参数类型必填说明
safety_toleranceinteger审核宽松度,数值越大越宽松。支持范围 0<=x<=5 ,默认值为 2
aspect_ratiostring图像所需的宽高比,支持16:9(默认), 1:14:3
seedinteger随机数种子
rawboolean是否启用原始模式,获得更自然的视觉效果,默认false

Qwen 模型参数

参数类型必填说明
watermarkboolean是否在生成的图片中添加水印,支持 true (默认)和 false
seedinteger随机数种子,取值范围[0,2147483647]

Doubao 模型参数

参数类型必填说明
sequential_image_generationstring控制是否关闭组图功能
sequential_image_generation_optionsobject组图功能配置,仅当 sequential_image_generationauto 时生效。目前支max_images,取值范围[1, 15],默认值为 15
watermarkboolean是否在生成的图片中添加水印,支持 true (默认)和 false
seedinteger随机数种子,取值范围为 [-1, 2147483647],默认值为 -1
response_formatstring生成图像的返回格式,支url(链接在图片生成后24小时内有效,请及时下载图片)base64_json
实际可生成的图片数量,除受到 max_images 影响外,还受到输入的参考图数量影响。输入的参考图数量+最终生成的图片数量 ≤ 15 张。

使用示例

OpenAI

curl https://aihubmix.com/v1/models/openai/gpt-image-1.5/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"
  }
}'

Google Imagen

curl https://aihubmix.com/v1/models/google/imagen-4.0-fast-generate-001/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
  }
}'

Qwen

curl https://aihubmix.com/v1/models/qianfan/qwen-image/predictions \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer sk-***" \
  -d '{
    "input": {
      "prompt": "A beautiful sunset over a calm ocean",
      "refer_image": "",
      "n": 1,
      "size": "1024x1024",
      "watermark": false
    }
  }'

Doubao

curl https://aihubmix.com/v1/models/doubao/doubao-seedream-4-0/predictions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer sk-***" \
  -d '{
    "input": {
      "prompt": "星际穿越,黑洞,黑洞里冲出一辆快支离破碎的复古列车,抢视觉冲击力,电影大片,末日既视感,动感,对比色,oc渲染,光线追踪,动态模糊,景深,超现实主义,深蓝,画面通过细腻的丰富的色彩层次塑造主体与场景,质感真实,暗黑风背景的光影效果营造出氛围,整体兼具艺术幻想感,夸张的广角透视效果,耀光,反 射,极致的光影,强引力,吞噬",
      "size": "2K",
      "sequential_image_generation": "disabled",
      "stream": false,
      "response_format": "url",
      "watermark": true
    }
  }'

Flux

  • flux-2-flexflux-2-pro 为异步端口,需要分 2 步请求。该系列速度极快,几乎秒出。
  • FLUX.1-Kontext-pro 使用通用接口,一步到位

FLUX 一步绘图

curl https://aihubmix.com/v1/images/generations \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer sk-***" \
    -d '{
  "model": "FLUX.1-Kontext-pro",
  "prompt": "a cat in the garden, cute cartoon",
  "safety_tolerance": 6
}' \
| jq -r '.data[0].b64_json' \
| base64 -D > "$HOME/Desktop/image_extract.png"

Flux 异步绘图

第一步:发出绘图请求
curl https://aihubmix.com/v1/models/bfl/flux-kontext-max/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. reference style as the given image:",
    "aspect_ratio": "2:3",
    "safety_tolerance": 6
  }
}'
输出结果示例:
{
  "output": [
    {
      "taskId": "api.us1.***",
      "polling_url": "https://api.us1.bfl.ai/v1/get_result?id=f9821dbf-f134-41c2-aaa8-5405fb665c76"
    }
  ]
}
第二步:获取生成的图片链接
获取图片
curl https://api.aihubmix.com/v1/tasks/<taskId> \
    -H "Authorization: Bearer sk-***" \
    -X GET

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

iRAG

curl https://aihubmix.com/v1/models/qianfan/irag-1.0/predictions\
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer sk-***" \
  -d '{
    "input": {
      "prompt": "A beautiful sunset over a calm ocean",
      "refer_image": "",
      "n": 1,
      "size": "1024x1024",
      "guidance": 7.5,
      "watermark": false
    }
  }'