可用模型列表
OpenAI 模型
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 模型
Doubao 模型
Flux 模型
iRAG 模型
Ideogram 模型
V3 —— Ideogram AI 生图模型,能够快速生成图片。
API 接口
请求地址
POST https://aihubmix.com/v1/models/ < model_pat h > /predictions
<model_path> 为<供应商/模型id>,如<openai/gpt-image-1.5>,<qianfan/qwen-image>。
请求头
Authorization: Bearer $AIHUBMIX_API_KEY
Content-Type: application/json
请求参数
通用参数
参数 类型 必填 说明 prompt string 是 提示词 size string 否 图像尺寸,支持1K(Doubao-4-5系列不支持)、2K、4K、auto (默认)。Qwen系列支持参数:512*1024、768*512、 768*1024、 1024*576、 576*1024、 1024*1024(默认) image string 否 参考图片路径 n integer 否 生成图像数量,支持1-10,默认为 1 quality string 否 渲染质量,支持 low 、medium 和high,质量越高,耗时越长
OpenAI 模型参数
参数 类型 必填 说明 input_fidelity string 否 保真度,支high和 low(默认) moderation string 否 内容审核严格程度,支持 auto (默认,标准过滤)和 low(过滤限制较少),图生图模式下不支持 output_format string 否 输出图片格式,支持 png 、 jpeg (默认) 、webp
Flux 模型参数
参数 类型 必填 说明 safety_tolerance integer 否 审核宽松度,数值越大越宽松。支持范围 0<=x<=5 ,默认值为 2 aspect_ratio string 否 图像所需的宽高比,支持16:9(默认), 1:1 、4:3 seed integer 否 随机数种子 raw boolean 否 是否启用原始模式,获得更自然的视觉效果,默认false
Qwen 模型参数
参数 类型 必填 说明 watermark boolean 否 是否在生成的图片中添加水印,支持 true (默认)和 false seed integer 否 随机数种子,取值范围[0,2147483647]
Doubao 模型参数
参数 类型 必填 说明 sequential_image_generation string 否 控制是否关闭组图功能 sequential_image_generation_options object 否 组图功能配置,仅当 sequential_image_generation 为 auto 时生效。目前支max_images,取值范围[1, 15],默认值为 15 watermark boolean 否 是否在生成的图片中添加水印,支持 true (默认)和 false seed integer 否 随机数种子,取值范围为 [-1, 2147483647],默认值为 -1 response_format string 否 生成图像的返回格式,支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
Qwen-Image
Qwen-Image-Edit
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-flex 和 flux-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/ < taskI d > \
-H "Authorization: Bearer sk-***" \
-X GET
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"
}
}'
iRAG
ERNIE iRAG
ERNIE iRAG Edit
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
}
}'