参数表

模型ID支持输入图片尺寸参数形式sizeaspect_ration(生成图片个数)
glm-image不支持size1280x12801568x10561056x15681472x10881088x14721728x960960x1728不支持/
cogview-4-250304不支持size1024x1024768x1344864x11521344x7681152x8641440x720720x1440不支持/
cogview-4不支持size1024x1024768x1344864x11521344x7681152x8641440x720720x1440不支持/
cogview-3-flash不支持size1024x1024768x1344864x11521344x7681152x8641440x720720x1440不支持/
kling-v2-new支持(必须输入图片)aspect_ratio + size1k2k,默认1k1:13:22:34:33:416:99:1621:9,默认16:91~9(默认1)
kling-v1支持aspect_ratio + size1k1:13:22:34:33:416:99:1621:9,默认16:91~9(默认1)
kling-v1-5支持aspect_ratio + size1k1:13:22:34:33:416:99:1621:9,默认16:91~9(默认1)
kling-v2支持aspect_ratio + size1k2k,默认1k1:13:22:34:33:416:99:1621:9,默认16:91~9(默认1)
kling-v2-1支持aspect_ratio + size1k2k,默认1k1:13:22:34:33:416:99:1621:9,默认16:91~9(默认1)
kling-image-o1支持(1~10张)aspect_ratio + size1k2k4k1:13:22:34:33:416:99:1621:9auto1~9(默认1)
Kolors不支持size1024x1024960x1280768x1024720x1440720x1280不支持/
step-1x-medium不支持size256x256512x512768x7681024x10241280x800800x1280不支持1
step-2x-large不支持size256x256512x512768x7681024x10241280x800800x1280不支持1
step-1x-edit支持(1张),必须输入图片size512x512768x7681024x1024不支持/
qwen-image-2.0支持(1~3张)size总像素需在512*5122048*2048之间,例如1024*1536。图片编辑时,默认分辨率与输入图(多图输入时为最后一张)一致。不支持1~6(默认1)
qwen-image-2.0-pro支持(1~3张)size总像素需在512*5122048*2048之间,例如1024*1536。图片编辑时,默认分辨率与输入图(多图输入时为最后一张)一致。不支持1~6(默认1)
Qwen-Image不支持size1328x13281664x928928x16641472x11401140x14721584x10561056x1584不支持1
qwen-image-max不支持size1664*9281472*11041328*13281104*1472928*1664,默认1664*928不支持1
qwen-image-plus不支持size1664*9281472*11041328*13281104*1472928*1664,默认1664*928不支持1
Qwen-Image-Edit支持(1~3张)//不支持1
qwen-image-edit-max支持(1~3张)size宽、高范围:[512, 2048]px不支持1~6(默认1)
qwen-image-edit-plus支持(1~3张)size宽、高范围:[512, 2048]px不支持1~6(默认1)
z-image-turbo不支持size总像素范围限制:总像素在 [512*512, 2048*2048]之间。

推荐分辨率范围:总像素在 [1024*1024, 1536*1536]之间,出图效果更佳。

默认1024*1536
不支持1
wan2.6-t2i不支持size总像素范围:[1280*1280, 1440*1440];宽高比:[1:4, 4:1]。推荐值:1280*12801104*14721472*1104960*16961696*960。默认 1280*1280不支持1~4(默认4)
wan2.5-t2i-preview不支持size总像素范围:[1280*1280, 1440*1440];宽高比:[1:4, 4:1]。推荐值:1280*12801104*14721472*1104960*16961696*960。默认 1280*1280不支持1~4(默认4)
wan2.2-t2i-plus不支持size宽高均在[512, 1440],默认1280*1280不支持1~4(默认4)
wan2.2-t2i-flash不支持size宽高均在[512, 1440],默认1280*1280不支持1~4(默认4)
wanx2.1-t2i-plus不支持size宽高均在[512, 1440],默认1280*1280不支持1~4(默认4)
wanx2.1-t2i-turbo不支持size宽高均在[512, 1440],默认1280*1280不支持1~4(默认4)
wanx-v1支持size1024*1024720*1280768*11521280*720不支持1~4(默认4)
wan2.6-image支持(图像编辑,1~4张),必须输入图片size1280*1280800*12001200*8001344*5761280*720720*12801280*960960*1280不支持1~4(默认4)
wan2.5-i2i-preview支持(1~3张)size1280*12801024*1024800*12001200*800960*12801280*960720*12801280*7201344*576不支持1~4(默认4)
wanx2.1-imageedit支持//不支持1~4(默认4)
Stable-Diffusion-3.5-Large不支持aspect_ratio不支持16:91:121:92:33:24:55:49:169:21/
Stable-Diffusion-3.5-Large-Turbo不支持aspect_ratio不支持16:91:121:92:33:24:55:49:169:21/
Stable-Diffusion-3.5-Medium不支持aspect_ratio不支持16:91:121:92:33:24:55:49:169:21/
Stable-Diffusion-3.5-Flash不支持aspect_ratio不支持16:91:121:92:33:24:55:49:169:21/
Stable-Image-Ultra不支持aspect_ratio不支持16:91:121:92:33:24:55:49:169:21/
Stable-Image-Core不支持aspect_ratio不支持16:91:121:92:33:24:55:49:169:21/
riverflow-v2-max-preview支持(0~4张)aspect_ratio + size不支持1:12:33:23:44:34:55:49:1616:921:9/
riverflow-v2-standard-preview支持(0~4张)aspect_ratio + size不支持1:12:33:23:44:34:55:49:1616:921:9/
riverflow-v2-fast-preview支持(0~4张)aspect_ratio + size不支持1:12:33:23:44:34:55:49:1616:921:9/
gpt-image-1-high支持(0~16张)size1024x10241536x10241024x1536auto不支持1~10(默认1)
gpt-image-1-medium支持(0~16张)size1024x10241536x10241024x1536auto不支持1~10(默认1)
gpt-image-1-low支持(0~16张)size1024x10241536x10241024x1536auto不支持1~10(默认1)
gpt-image-1-mini-high支持(0~16张)size1024x10241536x10241024x1536auto不支持1~10(默认1)
gpt-image-1-mini-medium支持(0~16张)size1024x10241536x10241024x1536auto不支持1~10(默认1)
gpt-image-1-mini-low支持(0~16张)size1024x10241536x10241024x1536auto不支持1~10(默认1)
gpt-image-2支持(0~16张)size1024x1024832x12481248x832864x11841184x864896x11521152x896768x13441344x7681536x10241024x15361792x10241024x17922048x2048auto不支持1~10(默认1)
gpt-image-1.5-high支持(0~16张)size1024x10241536x10241024x1536auto不支持1~10(默认1)
gpt-image-1.5-medium支持(0~16张)size1024x10241536x10241024x1536auto不支持1~10(默认1)
gpt-image-1.5-low支持(0~16张)size1024x10241536x10241024x1536auto不支持1~10(默认1)
dall-e-2不支持size256x256512x5121024x1024不支持1~10(默认1)
dall-e-3-hd不支持size1024x10241792x10241024x1792不支持1
dall-e-3-standard不支持size1024x10241792x10241024x1792不支持1
minimax-image-01支持aspect_ratio不支持1:116:94:33:22:33:49:1621:91~9(默认1)
minimax-image-01-live支持aspect_ratio不支持1:116:94:33:22:33:49:161~9(默认1)
flux.2-klein-4b支持(1~4张)aspect_ratio不支持1:12:33:23:44:34:55:49:1616:921:9/
flux.2-max支持(1~8张)aspect_ratio不支持1:12:33:23:44:34:55:49:1616:921:9/
flux.2-flex支持(1~8张)aspect_ratio不支持1:12:33:23:44:34:55:49:1616:921:9/
flux.2-pro支持(1~8张)aspect_ratio不支持1:12:33:23:44:34:55:49:1616:921:9/
viduq1支持(1~7张),必须输入图片aspect_ratio + size1080p16:99:161:13:44:3/
viduq2支持(0~7张)aspect_ratio + size1080p2K4K16:99:161:13:44:321:92:33:2/
uni-1支持(0~8张)aspect_ratio不支持3:12:116:93:21:12:39:161:21:3/
uni-1-max支持(0~8张)aspect_ratio不支持3:12:116:93:21:12:39:161:21:3/
uni-1-edit支持(1张),必须输入图片aspect_ratio不支持3:12:116:93:21:12:39:161:21:3/
uni-1-max-edit支持(1张),必须输入图片aspect_ratio不支持3:12:116:93:21:12:39:161:21:3/
reve-create-latest不支持aspect_ratio不支持16:99:163:22:34:33:41:1/
reve-edit-latest支持(1张),必须输入图片aspect_ratio不支持16:99:163:22:34:33:41:1/
reve-remix-latest支持(1~6张),必须输入图片aspect_ratio不支持16:99:163:22:34:33:41:1/
doubao-seedream-4-0-250828支持(0~14张)size输入方式一:1K2K4K,默认2K

输入方式二:1024x1024864x11521152x8641280x720720x1280832x12481248x8321512x6482048x20482304x17281728x23042848x16001600x28482496x16641664x24963136x13444096x40963520x47044704x35205504x30403040x55043328x49924992x33286240x2656。默认2048x2048
不支持/
doubao-seedream-4-5-251128支持(0~14张)size输入方式一:2K4K,默认2K

输入方式二:2048x20482304x17281728x23042848x16001600x28482496x16641664x24963136x13444096x40963520x47044704x35205504x30403040x55043328x49924992x33286240x2656。默认2048x2048
不支持/
Doubao-Seedream-5.0-lite支持(0~14张)size输入方式一:2K3K,默认2K

输入方式二:2048x20482304x17281728x23042848x16001600x28482496x16641664x24963136x13443072x30723456x25922592x34564096x23042304x40962496x37443744x24964704x2016。默认2048x2048
不支持/
gemini-2.5-flash-image(Nano Banana)支持(0~3张)aspect_ratio不支持1:12:33:23:44:34:55:49:1616:921:9。默认1:1/
gemini-3-pro-image-preview(Nano Banana Pro)支持(0~14张,高保真≤5张)aspect_ratio + size1K2K4K1:12:33:23:44:34:55:49:1616:921:9。默认1:1/
gemini-3.1-flash-image-preview(Nano Banana 2)支持(0~14张,高保真≤5张)aspect_ratio + size5121K2K4K1:11:41:82:33:23:44:14:34:55:48:19:1616:921:9。默认1:1/
imagen-4.0-generate-001不支持aspect_ratio + size1K2K1:13:44:39:1616:91~4(默认4)
imagen-4.0-ultra-generate-001不支持aspect_ratio + size1K2K1:13:44:39:1616:91~4(默认4)
imagen-4.0-fast-generate-001不支持aspect_ratio不支持1:13:44:39:1616:91~4(默认4)

cURL 调用示例

图像生成接口为同步返回:客户端发起请求后,服务端会等待图片生成完成,并在同一个响应中返回图片 URL。生成耗时可能较长,建议设置较长的 --max-time OpenAI gpt-image-2:文生图,使用 size 控制输出尺寸
curl -sS --max-time 300 \
  https://api.nonelinear.com/v1/images/generations \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-image-2",
    "prompt": "A clean product photo of a white ceramic coffee cup on a walnut desk, soft morning light, realistic style",
    "response_format": "url",
    "size": "1024x1024",
    "n": 1
  }'
OpenAI gpt-image-2:图片编辑,使用 image 传入参考图,并使用 size 控制输出尺寸
curl -sS --max-time 300 \
  https://api.nonelinear.com/v1/images/generations \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gpt-image-2",
    "prompt": "将图片背景替换为简洁的浅灰色摄影棚背景,保留主体不变",
    "response_format": "url",
    "size": "1024x1024",
    "n": 1,
    "image": [
      "https://imagen-nonelinear-2025.tos-cn-beijing.volces.com/others/gen-1780570031-PVCF2SwnzQCRFdkiSkON-0.png"
    ]
  }'
gpt-image-2 尺寸说明gpt-image-2size 参数支持任意满足约束的分辨率,方图通常生成速度最快。常用尺寸:
  • 1024x1024:方图
  • 1536x1024:横图
  • 1024x1536:竖图
  • 2048x2048:2K 方图
  • 2048x1152:2K 横图
  • 3840x2160:4K 横图
  • 2160x3840:4K 竖图
  • auto:默认值
尺寸约束:
  • 最大边长不超过 3840px
  • 宽和高都必须是 16px 的倍数
  • 长边与短边比例不超过 3:1
  • 总像素不少于 655360,不超过 8294400
quality 使用说明quality 参数仅适用于 gpt-image-2,其他生图模型不支持该参数。调用 gpt-image-2 时,可以通过 quality 控制图片的渲染质量;将其添加到请求体中,与 modelprompt 等参数同级。切换为其他生图模型时,请移除该参数。支持以下取值:
  • low:生成速度最快,适合草稿、缩略图和快速迭代
  • medium:兼顾生成质量、速度和费用
  • high:提供更高的渲染质量,适合生成最终成品
  • auto:由模型根据提示词自动选择,默认值
Python 请求体示例:
def text2img(model, size=None, quality=None):
    payload = {
        "model": model,
        "prompt": "星际穿越,黑洞里冲出一辆复古列车",
        "response_format": "url",
    }

    if size:
        payload["size"] = size
    if quality:
        payload["quality"] = quality

    return payload
质量档位越高,通常生成耗时、输出 Token 数量和费用也会相应增加。
Google gemini-2.5-flash-image(Nano Banana):使用 aspect_ratio 控制画面比例
curl -sS --max-time 300 \
  https://api.nonelinear.com/v1/images/generations \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gemini-2.5-flash-image",
    "prompt": "A cinematic wide-angle photo of a futuristic city skyline at sunset, rich details, natural lighting",
    "response_format": "url",
    "aspect_ratio": "16:9"
  }'
Google gemini-3.1-flash-image-preview(Nano Banana 2):使用 aspect_ratio + size 控制比例和清晰度
curl -sS --max-time 300 \
  https://api.nonelinear.com/v1/images/generations \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gemini-3.1-flash-image-preview",
    "prompt": "A minimal poster design with a red circle centered on a plain white background",
    "response_format": "url",
    "aspect_ratio": "1:1",
    "size": "1K"
  }'
Google gemini-3-pro-image-preview(Nano Banana Pro):使用 aspect_ratio + size 控制比例和清晰度
curl -sS --max-time 300 \
  https://api.nonelinear.com/v1/images/generations \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "gemini-3-pro-image-preview",
    "prompt": "A high fidelity studio portrait of a glass perfume bottle on black acrylic, sharp reflections, commercial photography",
    "response_format": "url",
    "aspect_ratio": "4:3",
    "size": "2K"
  }'
Google Gemini 图片生成注意事项Google Gemini 图片生成偶发会返回未出图结果,调用方需要判断响应中是否实际包含图片 URL 或 base64 图片内容。常见情况:
  • IMAGE_RECITATION:Google 官方定义为图片生成因 recitation 停止,通常不会返回图片结果。
  • NO_IMAGE / 空图片结果:Google 官方定义为期望生成图片,但未生成图片。实际响应中可能表现为 data: [],或只返回文本说明但没有图片 payload。
示例:
{
  "data": [],
  "text": "[ERROR]: FinishReason.IMAGE_RECITATION"
}
{
  "data": [],
  "text": "好的,我来为你生成这张图片。"
}
建议调用方以 data[0].urldata[0].b64_json 是否存在作为出图成功判断;如果 data 为空,或只有文本没有图片内容,应按未出图处理。对于 IMAGE_RECITATION,建议调整 prompt 后重试;对于普通空图片结果,可按业务需要进行重试。Google 官方说明:
https://ai.google.dev/api/generate-content#FinishReason

1、豆包seedream

模型ID: doubao-seedream-4-0-250828, doubao-seedream-4-5-251128 参数size取值范围: 2K4K 图片输入限制:
  • 图片格式:jpeg、png、webp、bmp、tiff、gif
  • 宽高比(宽/高)范围:[1/16, 16]
  • 宽高长度(px) > 14
  • 大小:不超过 10 MB
  • 总像素:不超过 6000×6000 px
  • 最多支持传入 14 张参考图。
(1)文生图(纯文本输入单图输出) 通过文字描述来生成对应图像。
import os
from openai import OpenAI

# 请确保您已将 API Key 存储在环境变量 Nonelinear_API_KEY 中
client = OpenAI(
    # 此为默认路径,您可根据业务所在地域进行配置
    base_url="https://api.nonelinear.com/v1",
    # 从环境变量中获取您的 API Key。此为默认方式,您可根据需要进行修改
    api_key=os.environ.get("Nonelinear_API_KEY"),
)

model = "doubao-seedream-4-0-250828" # 或doubao-seedream-4-5-251128

imagesResponse = client.images.generate(
    model=model,
    prompt="星际穿越,黑洞,黑洞里冲出一辆快支离破碎的复古列车,抢视觉冲击力,电影大片,末日既视感,动感,对比色,oc渲染,光线追踪,动态模糊,景深,超现实主义,深蓝,画面通过细腻的丰富的色彩层次塑造主体与场景,质感真实,暗黑风背景的光影效果营造出氛围,整体兼具艺术幻想感,夸张的广角透视效果,耀光,反射,极致的光影,强引力,吞噬",
    size="2K",
    response_format="url",
    extra_body={"watermark": False},
)

print(imagesResponse.data[0].url)
(2)【图片编辑】图文生图(单图输入单图输出) 基于已有图片,结合文字指令进行图像编辑,包括图像元素增删、风格转化、材质替换、色调迁移、改变背景/视角/尺寸等。 如果是本地图片,可以先上传到官方服务器,操作指南:文件上传API
import os
from openai import OpenAI

# 请确保您已将 API Key 存储在环境变量 Nonelinear_API_KEY 中
client = OpenAI(
    # 此为默认路径,您可根据业务所在地域进行配置
    base_url="https://api.nonelinear.com/v1",
    # 从环境变量中获取您的 API Key。此为默认方式,您可根据需要进行修改
    api_key=os.environ.get("Nonelinear_API_KEY"),
)

model = "doubao-seedream-4-0-250828"

imagesResponse = client.images.generate(
    model=model,
    prompt="生成狗狗趴在草地上的近景画面",
    size="2K",
    response_format="url",
    extra_body = {
        "image": "https://ark-project.tos-cn-beijing.volces.com/doc_image/seedream4_imageToimage.png",
        "watermark": False
    }
)

print(imagesResponse.data[0].url)
(3)【图片编辑】多图融合(多图输入单图输出) 根据您输入的文本描述和多张参考图片,融合它们的风格、元素等特征来生成新图像。如衣裤鞋帽与模特图融合成穿搭图,人物与风景融合为人物风景图等。 不指定 sequential_image_generation,或配置为 disabled 如果是本地图片,可以先上传到官方服务器,操作指南:文件上传API
import os
from openai import OpenAI

# 请确保您已将 API Key 存储在环境变量 Nonelinear_API_KEY 中
client = OpenAI(
    # 此为默认路径,您可根据业务所在地域进行配置
    base_url="https://api.nonelinear.com/v1",
    # 从环境变量中获取您的 API Key。此为默认方式,您可根据需要进行修改
    api_key=os.environ.get("Nonelinear_API_KEY"),
)

model = "doubao-seedream-4-0-250828"

imagesResponse = client.images.generate(
    model=model,
    prompt="将图1的服装换为图2的服装",
    size="2K",
    response_format="url",
    extra_body={
        "image": [
            "https://ark-project.tos-cn-beijing.volces.com/doc_image/seedream4_imagesToimage_1.png",
            "https://ark-project.tos-cn-beijing.volces.com/doc_image/seedream4_imagesToimage_2.png"
        ],
        "watermark": False,
        "sequential_image_generation": "disabled",
    }
)

print(imagesResponse.data[0].url)
(4)组图输出(多图输出) 支持通过一张或者多张图片 and 文字信息, 生成漫画分镜、品牌视觉等一组内容关联的图片。 文生组图
import os
from openai import OpenAI

# 请确保您已将 API Key 存储在环境变量 Nonelinear_API_KEY 中
client = OpenAI(
    # 此为默认路径,您可根据业务所在地域进行配置
    base_url="https://api.nonelinear.com/v1",
    # 从环境变量中获取您的 API Key。此为默认方式,您可根据需要进行修改
    api_key=os.environ.get("Nonelinear_API_KEY"),
)

model = "doubao-seedream-4-0-250828"

imagesResponse = client.images.generate(
    model=model,
    prompt="生成一组共4张连贯插画,核心为同一庭院一角的四季变迁,以统一风格展现四季独特色彩、元素与氛围",
    size="2K",
    response_format="url",
    extra_body={
        "watermark": False,
        "sequential_image_generation": "auto",
        "sequential_image_generation_options": {
            "max_images": 4
        },
    },
)

# 遍历所有图片数据
for image in imagesResponse.data:
    # 输出当前图片的url和size
    print(f"URL: {image.url}, Size: {image.size}")
【图片编辑】单张图生组图 如果是本地图片,可以先上传到官方服务器,操作指南:文件上传API
import os
from openai import OpenAI

# 请确保您已将 API Key 存储在环境变量 Nonelinear_API_KEY 中
client = OpenAI(
    # 此为默认路径,您可根据业务所在地域进行配置
    base_url="https://api.nonelinear.com/v1",
    # 从环境变量中获取您的 API Key。此为默认方式,您可根据需要进行修改
    api_key=os.environ.get("Nonelinear_API_KEY"),
)

model = "doubao-seedream-4-0-250828"

imagesResponse = client.images.generate(
    model=model,
    prompt="参考这个LOGO,做一套户外运动品牌视觉设计,品牌名称为GREEN,包括包装袋、帽子、纸盒、手环、挂绳等。绿色视觉主色调,趣味、简约现代风格",
    size="2K",
    response_format="url",
    extra_body={
        "image": "https://ark-project.tos-cn-beijing.volces.com/doc_image/seedream4_imageToimages.png",
        "watermark": True,
        "sequential_image_generation": "auto",
        "sequential_image_generation_options": {
            "max_images": 5
        },
    }
)

# 遍历所有图片数据
for image in imagesResponse.data:
    # 输出当前图片的url和size
    print(f"URL: {image.url}, Size: {image.size}")
【图片编辑】多参考图生组图 如果是本地图片,可以先上传到官方服务器,操作指南:文件上传API
import os
from openai import OpenAI

# 请确保您已将 API Key 存储在环境变量 Nonelinear_API_KEY 中
client = OpenAI(
    # 此为默认路径,您可根据业务所在地域进行配置
    base_url="https://api.nonelinear.com/v1",
    # 从环境变量中获取您的 API Key。此为默认方式,您可根据需要进行修改
    api_key=os.environ.get("Nonelinear_API_KEY"),
)

model = "doubao-seedream-4-0-250828"

imagesResponse = client.images.generate(
    model=model,
    prompt="生成3张女孩和奶牛玩偶在游乐园开心地坐过山车的图片,涵盖早晨、中午、晚上",
    size="2K",
    response_format="url",
    extra_body={
        "image": [
            "https://ark-project.tos-cn-beijing.volces.com/doc_image/seedream4_imagesToimages_1.png",
            "https://ark-project.tos-cn-beijing.volces.com/doc_image/seedream4_imagesToimages_2.png"
        ],
        "watermark": False,
        "sequential_image_generation": "auto",
        "sequential_image_generation_options": {
            "max_images": 3
        },
    }
)

# 遍历所有图片数据
for image in imagesResponse.data:
    # 输出当前图片的url和size
    print(f"URL: {image.url}, Size: {image.size}")

2、谷歌nano banana、OpenAI DALLE/GPT、阿里千问qwen/wan、智谱glm/cogview、快手可灵kling/Kolors、MiniMax、flux、riverflow、谷歌imagen、StableDiffusion、阶跃星程step、vidu、lumaAI、Reve

(1)文生图(纯文本输入单图输出) 通过文字描述来生成对应图像。 【模型ID】:
  • 谷歌nano banana: gemini-2.5-flash-image(Nano Banana)gemini-3-pro-image-preview(Nano Banana pro)gemini-3.1-flash-image-preview(Nano Banana 2)
  • OpenAI: dall-e-2, dall-e-3-hd, dall-e-3-standard, gpt-image-1-high, gpt-image-1-medium, gpt-image-1-low, gpt-image-1-mini-high, gpt-image-1-mini-medium, gpt-image-1-mini-low, gpt-image-2, gpt-image-1.5-high, gpt-image-1.5-medium, gpt-image-1.5-low
  • 千问qwen: Qwen-Image, qwen-image-max, qwen-image-plus
  • 千问wan: wan2.7-image, wan2.7-image-pro, wan2.6-t2i, wan2.5-t2i-preview, wan2.2-t2i-plus, wan2.2-t2i-flash, wanx2.1-t2i-plus, wanx2.1-t2i-turbo, wanx-v1, z-image-turbo
  • 智谱: glm-image, cogview-4-250304, cogview-4, cogview-3-flash
  • 快手可灵: kling-image-o1, kling-v2-1, kling-v2, kling-v1-5, kling-v1, Kolors
  • MiniMax: minimax-image-01, minimax-image-01-live
  • flux: flux.2-klein-4b, flux.2-max, flux.2-flex, flux.2-pro
  • riverflow: riverflow-v2-max-preview, riverflow-v2-standard-preview, riverflow-v2-fast-preview
  • 谷歌imagen: imagen-4.0-generate-001, imagen-4.0-ultra-generate-001, imagen-4.0-fast-generate-001
  • StableDiffusion: Stable-Image-Ultra, Stable-Diffusion-3.5-Large, Stable-Diffusion-3.5-Large-Turbo, Stable-Diffusion-3.5-Medium, Stable-Diffusion-3.5-Flash, Stable-Image-Core
  • 阶跃星程step: step-1x-medium, step-2x-large
  • vidu: viduq2
  • lumaAI: uni-1, uni-1-max
  • Reve: reve-create-latest
import os
from openai import OpenAI

# 请确保您已将 API Key 存储在环境变量 Nonelinear_API_KEY 中
client = OpenAI(
    # 此为默认路径,您可根据业务所在地域进行配置
    base_url="https://api.nonelinear.com/v1",
    # 从环境变量中获取您的 API Key。此为默认方式,您可根据需要进行修改
    api_key=os.environ.get("Nonelinear_API_KEY"),
)
model = "<模型ID>"
prompt = "星际穿越,黑洞,黑洞里冲出一辆快支离破碎的复古列车,抢视觉冲击力,电影大片,末日既视感,动感,对比色,oc渲染,光线追踪,动态模糊,景深,超现实主义,深蓝,画面通过细腻的丰富的色彩层次塑造主体与场景,质感真实,暗黑风背景的光影效果营造出氛围,整体兼具艺术幻想感,夸张的广角透视效果,耀光,反射,极致的光影,强引力,吞噬"
imagesResponse = client.images.generate(
    model=model,
    prompt=prompt,
    response_format="url",
)
print(imagesResponse, '\n', imagesResponse.data[0].url)

# --- 设置size参数 ---
# 特别留意:不同模型的size取值范围区别很大(部分模型不支持该参数),详见上文参数表
imagesResponse = client.images.generate(
    model=model,
    prompt=prompt,
    response_format="url",
    size="1k",
)
print(imagesResponse, '\n', imagesResponse.data[0].url)

# --- 设置aspect_ratio参数 ---
# 特别留意:不同模型的aspect_ratio取值范围区别很大(部分模型不支持该参数),详见上文参数表
imagesResponse = client.images.generate(
    model=model,
    prompt=prompt,
    response_format="url",
    extra_body={"aspect_ratio": "16:9"},
)
print(imagesResponse, '\n', imagesResponse.data[0].url)
(2)【图片编辑】图文生图(单图输入单图输出) 基于已有图片,结合文字指令进行图像编辑,包括图像元素增删、风格转化、材质替换、色调迁移、改变背景/视角/尺寸等。 如果是本地图片,可以先上传到官方服务器,操作指南:文件上传API 【模型ID】:
  • 谷歌nano banana: gemini-2.5-flash-image(Nano Banana)gemini-3-pro-image-preview(Nano Banana pro)gemini-3.1-flash-image-preview(Nano Banana 2)
  • OpenAI: gpt-image-1-high, gpt-image-1-medium, gpt-image-1-low, gpt-image-1-mini-high, gpt-image-1-mini-medium, gpt-image-1-mini-low, gpt-image-2, gpt-image-1.5-high, gpt-image-1.5-medium, gpt-image-1.5-low
  • 千问qwen: Qwen-Image-Edit, qwen-image-edit-max, qwen-image-edit-plus
  • 千问wan: wan2.7-image, wan2.7-image-pro, wanx-v1, wan2.6-image, wan2.5-i2i-preview, wanx2.1-imageedit
  • qwen-mt-image:通义千问-图像翻译模型,支持中/英文与其他语种之间的互译,但不支持在非中/英语种之间直接翻译(例如,从日语翻译为韩语)。详情请参见 支持的语种
  • MiniMax: minimax-image-01, minimax-image-01-live
  • flux: flux.2-klein-4b, flux.2-max, flux.2-flex, flux.2-pro
  • riverflow: riverflow-v2-max-preview, riverflow-v2-standard-preview, riverflow-v2-fast-preview
  • 快手可灵: kling-image-o1, kling-v2-new, kling-v2, kling-v1-5, kling-v1
  • 阶跃星程step: step-1x-edit
  • vidu: viduq1, viduq2
  • lumaAI: uni-1(参考生图image_ref), uni-1-max(参考生图image_ref), uni-1-edit, uni-1-max-edit
  • Reve: reve-edit-latest
import os
from openai import OpenAI

# 请确保您已将 API Key 存储在环境变量 Nonelinear_API_KEY 中
client = OpenAI(
    # 此为默认路径,您可根据业务所在地域进行配置
    base_url="https://api.nonelinear.com/v1",
    # 从环境变量中获取您的 API Key。此为默认方式,您可根据需要进行修改
    api_key=os.environ.get("Nonelinear_API_KEY"),
)
model = "Qwen-Image-Edit" # 或qwen-image-edit-max、qwen-image-edit-plus……

imagesResponse = client.images.generate(
    model=model,
    prompt="生成狗狗趴在草地上的近景画面",
    response_format="url",
    extra_body = {
        "image": "https://ark-project.tos-cn-beijing.volces.com/doc_image/seedream4_imageToimage.png",
    }
)

print(imagesResponse, '\n', imagesResponse.data[0].url)
(3)【图片编辑】多图融合(多图输入单图输出) 根据您输入的文本描述和多张参考图片,融合它们的风格、元素等特征来生成新图像。如衣裤鞋帽与模特图融合成穿搭图,人物与风景融合为人物风景图等。 如果是本地图片,可以先上传到官方服务器,操作指南:文件上传API 【模型ID】:
  • 谷歌nano banana: gemini-2.5-flash-image(Nano Banana)gemini-3-pro-image-preview(Nano Banana pro)gemini-3.1-flash-image-preview(Nano Banana 2)
  • OpenAI: gpt-image-1-high, gpt-image-1-medium, gpt-image-1-low, gpt-image-1-mini-high, gpt-image-1-mini-medium, gpt-image-1-mini-low, gpt-image-2, gpt-image-1.5-high, gpt-image-1.5-medium, gpt-image-1.5-low
  • 千问qwen: qwen-image-edit-max, qwen-image-edit-plus
  • 千问wan: wan2.7-image, wan2.7-image-pro, wan2.5-i2i-preview, wan2.6-image
  • flux: flux.2-klein-4b, flux.2-max, flux.2-flex, flux.2-pro
  • riverflow: riverflow-v2-max-preview, riverflow-v2-standard-preview, riverflow-v2-fast-preview
  • 快手可灵: kling-image-o1, kling-v2-1, kling-v2
  • vidu: viduq1, viduq2
  • lumaAI: uni-1(参考生图image_ref), uni-1-max(参考生图image_ref)
  • Reve: reve-remix-latest
import os
from openai import OpenAI

# 请确保您已将 API Key 存储在环境变量 Nonelinear_API_KEY 中
client = OpenAI(
    # 此为默认路径,您可根据业务所在地域进行配置
    base_url="https://api.nonelinear.com/v1",
    # 从环境变量中获取您的 API Key。此为默认方式,您可根据需要进行修改
    api_key=os.environ.get("Nonelinear_API_KEY"),
)
model = "qwen-image-edit-max" # 或qwen-image-edit-plus ……

extra_body = {
        "image": ["https://ark-project.tos-cn-beijing.volces.com/doc_image/seedream4_imagesToimage_1.png",
            "https://ark-project.tos-cn-beijing.volces.com/doc_image/seedream4_imagesToimage_2.png"]}

imagesResponse = client.images.generate(
    model=model,
    prompt="将图1的服装换为图2的服装",
    response_format="url",
    extra_body=extra_body,
)
print(imagesResponse, '\n', imagesResponse.data[0].url)
谷歌nano banana aspect_ratio对应分辨率:
aspect_ratio生成的图片分辨率
1:11024x1024
2:3832x1248
3:21248x832
3:4864x1184
4:31184x864
4:5896x1152
5:41152x896
9:16768x1344
16:91344x768
21:91536x672