为了方便开发者调用不同的图像生成模型,CaMeL AI 提供了统一的图片生成接口
可用模型列表
💡
Nano Banana 系列请参考:/api/Gemini-Guides
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-5.0-lite —— 字节跳动发布的最新图像创作模型,该模型首次搭载联网检索功能,能融合实时网络信息,提升生图时效性。
-
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://api.kr777.top/models/<model_path>/predictions💡
<model_path> 为<供应商/模型id>,如<openai/gpt-image-1.5>,<qianfan/qwen-image>。
请求头
Authorization: Bearer $CAMELAI_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://api.kr777.top/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://api.kr777.top/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://api.kr777.top/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://api.kr777.top/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://api.kr777.top/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://api.kr777.top/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.kr777.top/tasks/<taskId> \
-H "Authorization: Bearer sk-***" \
-X GETIdeogram V3
- V3 以下版本(V_2、V_1 等)为旧接口,暂不支持
- 返回的链接需要打开代理网络才能获取
curl https://api.kr777.top/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://api.kr777.top/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
}
}'