创建图片

POST /v1/images/generations

MethodPOST
Path/v1/images/generations
Typehttp
Status1
Module2102810
Folder62716892

说明

给定提示和/或输入图像,模型将生成新图像。

相关指南:图像生成

根据提示创建图像。

概览

MethodPOST
Path/v1/images/generations
Typehttp
Status1
Module2102810
Folder62716892

参数

{
  "query": [],
  "path": [],
  "cookie": [],
  "header": [
    {
      "required": false,
      "description": "",
      "type": "string",
      "id": "GTujCrB2It",
      "enable": true,
      "name": "Authorization",
      "sampleValue": "Bearer {{YOUR_API_KEY}}"
    }
  ]
}

请求体

{
  "type": "application/json",
  "parameters": [],
  "jsonSchema": {
    "type": "object",
    "properties": {
      "model": {
        "type": "string",
        "description": "- 支持:文生图\n\t- doubao-seedream-3-0-t2i-250415\n- 支持:图片编辑\n\t- doubao-seededit-3-0-i2i-250628\n- 支持:文生图、图生图\n\t- doubao-seedream-5-0-260128\n\t- doubao-seedream-4-5-251128\n\t- doubao-seedream-4-0-250828"
      },
      "prompt": {
        "type": "string",
        "description": "用于生成图像的提示词。"
      },
      "response_format": {
        "type": "string",
        "description": "指定生成图像的返回格式。支持以下两种返回方式:\n- url:返回图片下载链接;链接在图片生成后24小时内有效,请及时下载图片。\n- b64_json:以 Base64 编码字符串的 JSON 格式返回图像数据。\n\n默认值 url"
      },
      "size": {
        "anyOf": [
          {
            "type": "string",
            "title": "seedream-5.0",
            "description": "指定生成图像的尺寸信息,支持以下两种方式,不可混用。\n- 方式 1 | 指定生成图像的分辨率,并在prompt中用自然语言描述图片宽高比、图片形状或图片用途,最终由模型判断生成图片的大小。\n\t- 可选值:2K、3K\n- 方式 2 | 指定生成图像的宽高像素值:\n\t- 默认值:2048x2048\n\t- 总像素取值范围:[2560x1440=3686400, 3072x3072x1.1025=10404496] \n\t- 宽高比取值范围:[1/16, 16]\n\n\n推荐的宽高像素值:\n| 分辨率 | 宽高比 | 宽高像素值   |\n|--------|--------|--------------|\n| 2K     | 1:1    | 2048×2048    |\n| 2K     | 4:3    | 2304×1728    |\n| 2K     | 3:4    | 1728×2304    |\n| 2K     | 16:9   | 2848×1600    |\n| 2K     | 9:16   | 1600×2848    |\n| 2K     | 3:2    | 2496×1664    |\n| 2K     | 2:3    | 1664×2496    |\n| 2K     | 21:9   | 3136×1344    |\n| 3K     | 1:1    | 3072×3072    |\n| 3K     | 4:3    | 3456×2592    |\n| 3K     | 3:4    | 2592×3456    |\n| 3K     | 16:9   | 4096×2304    |\n| 3K     | 9:16   | 2304×4096    |\n| 3K     | 2:3    | 2496×3744    |\n| 3K     | 3:2    | 3744×2496    |\n| 3K     | 21:9   | 4704×2016    |"
          },
          {
            "type": "string",
            "title": "seedream-4.5",
            "description": "指定生成图像的尺寸信息,支持以下两种方式,不可混用。\n- 方式 1 | 指定生成图像的分辨率,并在prompt中用自然语言描述图片宽高比、图片形状或图片用途,最终由模型判断生成图片的大小。\n\t- 可选值:2K、4K\n- 方式 2 | 指定生成图像的宽高像素值:\n\t- 默认值:2048x2048\n\t- 总像素取值范围:[2560x1440=3686400, 4096x4096=16777216] \n\t- 宽高比取值范围:[1/16, 16]\n\n推荐的宽高像素值:\n\n| 分辨率 | 宽高比 | 宽高像素值   |\n|--------|--------|--------------|\n| 2K     | 1:1    | 2048×2048    |\n| 2K     | 4:3    | 2304×1728    |\n| 2K     | 3:4    | 1728×2304    |\n| 2K     | 16:9   | 2848×1600    |\n| 2K     | 9:16   | 1600×2848    |\n| 2K     | 3:2    | 2496×1664    |\n| 2K     | 2:3    | 1664×2496    |\n| 2K     | 21:9   | 3136×1344    |\n| 4K     | 1:1    | 4096×4096    |\n| 4K     | 3:4    | 3520×4704    |\n| 4K     | 4:3    | 4704×3520    |\n| 4K     | 16:9   | 5504×3040    |\n| 4K     | 9:16   | 3040×5504    |\n| 4K     | 2:3    | 3328×4992    |\n| 4K     | 3:2    | 4992×3328    |\n| 4K     | 21:9   | 6240×2656    |"
          },
          {
            "type": "string",
            "title": "seedream-4.0",
            "description": "指定生成图像的尺寸信息,支持以下两种方式,不可混用。\n- 方式 1 | 指定生成图像的分辨率,并在prompt中用自然语言描述图片宽高比、图片形状或图片用途,最终由模型判断生成图片的大小。\n\t- 可选值:1K、2K、4K\n- 方式 2 | 指定生成图像的宽高像素值:\n\t- 默认值:2048x2048\n\t- 总像素取值范围:[1280x720=921600, 4096x4096=16777216] \n\t- 宽高比取值范围:[1/16, 16]\n\t\n推荐的宽高像素值:\n\n| 分辨率 | 宽高比 | 宽高像素值   |\n|--------|--------|--------------|\n| 1K     | 1:1    | 1024×1024    |\n| 1K     | 4:3    | 864×1152     |\n| 1K     | 3:4    | 1152×864     |\n| 1K     | 16:9   | 1280×720     |\n| 1K     | 9:16   | 720×1280     |\n| 1K     | 3:2    | 832×1248     |\n| 1K     | 2:3    | 1248×832     |\n| 1K     | 21:9   | 1512×648     |\n| 2K     | 1:1    | 2048×2048    |\n| 2K     | 4:3    | 2304×1728    |\n| 2K     | 3:4    | 1728×2304    |\n| 2K     | 16:9   | 2848×1600    |\n| 2K     | 9:16   | 1600×2848    |\n| 2K     | 3:2    | 2496×1664    |\n| 2K     | 2:3    | 1664×2496    |\n| 2K     | 21:9   | 3136×1344    |\n| 4K     | 1:1    | 4096×4096    |\n| 4K     | 3:4    | 3520×4704    |\n| 4K     | 4:3    | 4704×3520    |\n| 4K     | 16:9   | 5504×3040    |\n| 4K     | 9:16   | 3040×5504    |\n| 4K     | 2:3    | 3328×4992    |\n| 4K     | 3:2    | 4992×3328    |\n| 4K     | 21:9   | 6240×2656    |"
          },
          {
            "type": "string",
            "title": "seedream-3.0-t2i",
            "description": "指定生成图像的宽高像素值。\n- 默认值:1024x1024\n- 单张图片像素取值范围: [512x512, 2048x2048] \n\n推荐的宽高像素值:\n\n| 宽高比 | 宽高像素值   |\n|--------|--------------|\n| 1:1    | 1024×1024    |\n| 4:3    | 864×1152     |\n| 3:4    | 1152×864     |\n| 16:9   | 1280×720     |\n| 9:16   | 720×1280     |\n| 3:2    | 832×1248     |\n| 2:3    | 1248×832     |\n| 21:9   | 1512×648     |"
          },
          {
            "type": "string",
            "title": "seededit-3.0-i2i",
            "description": "指定生成图像的宽高像素值。当前仅支持 adaptive。\n- adaptive。将您的输入图片尺寸与下表中的尺寸进行对比,选择最接近的,作为输出图片的尺寸。具体而言,会按顺序从可选比例中,选取与原图宽高比差值最小的第一个,作为生成图片的比例。\n- 预设的高宽像素\n\n| 宽/高 | 宽   | 高   |\n|-------|------|------|\n| 0.33  | 512  | 1536 |\n| 0.35  | 544  | 1536 |\n| 0.38  | 576  | 1536 |\n| 0.4   | 608  | 1536 |\n| 0.42  | 640  | 1536 |\n| 0.47  | 640  | 1376 |\n| 0.51  | 672  | 1312 |\n| 0.55  | 704  | 1280 |\n| 0.56  | 736  | 1312 |\n| 0.6   | 768  | 1280 |\n| 0.63  | 768  | 1216 |"
          }
        ]
      },
      "seed": {
        "type": "integer",
        "description": "仅 doubao-seedream-3.0-t2i/seededit-3.0-i2i 支持该参\n随机数种子,用于控制模型生成内容的随机性。取值范围为 [-1, 2147483647]。\n注意:\n- 相同的请求下,模型收到不同的seed值,如:不指定seed值或令seed取值为-1(会使用随机数替代)、或手动变更seed值,将生成不同的结果。\n- 相同的请求下,模型收到相同的seed值,会生成类似的结果,但不保证完全一致。"
      },
      "guidance_scale": {
        "type": "number",
        "description": "模型输出结果与prompt的一致程度,生成图像的自由度,又称为文本权重;值越大,模型自由度越小,与用户输入的提示词相关性越强,取值范围:[1, 10] 。\n- doubao-seedream-3.0-t2i 默认值 2.5\n- doubao-seededit-3.0-i2i 默认值 5.5\n- doubao-seedream-5.0-lite/4.5/4.0 不支持"
      },
      "watermark": {
        "type": "boolean",
        "description": "是否在生成的图片中添加水印。\n- false:不添加水印。\n- true:在图片右下角添加“AI生成”字样的水印标识。\n\n默认值 true"
      },
      "image": {
        "anyOf": [
          {
            "type": "string",
            "title": "单图",
            "description": "- doubao-seededit-3.0-i2i 仅支持单图输入。\n- doubao-seedream-5.0-lite/4.5/4.0 支持单图。"
          },
          {
            "type": "array",
            "items": {
              "type": "string"
            },
            "title": "多图",
            "description": "- doubao-seedream-5.0-lite/4.5/4.0 支持单图或多图输入。\n- doubao-seedream-5.0-lite/4.5/4.0 最多支持传入 14 张参考图。"
          }
        ],
        "description": "输入的图片信息,支持 URL 或 Base64 编码。\n\n- 图片URL:请确保图片URL可被访问。\n- Base64编码:请遵循此格式data:image/<图片格式>;base64,<Base64编码>。注意 <图片格式> 需小写,如 data:image/png;base64,<base64_image>。"
      },
      "sequential_image_generation": {
        "type": "string",
        "description": "仅 doubao-seedream-5.0-lite/4.5/4.0 支持该参\n控制是否关闭组图功能;基于您输入的内容,生成的一组内容关联的图片。\n- auto:自动判断模式,模型会根据用户提供的提示词自主判断是否返回组图以及组图包含的图片数量。\n- disabled:关闭组图功能,模型只会生成一张图。\n\n默认值 disabled"
      },
      "sequential_image_generation_options": {
        "type": "object",
        "properties": {
          "max_images": {
            "type": "integer",
            "description": "指定本次请求,最多可生成的图片数量,取值范围: [1, 15]\n默认值 15"
          }
        },
        "x-apifox-orders": [
          "max_images"
        ],
        "description": "仅 doubao-seedream-5.0-lite/4.5/4.0 支持该参\n组图功能的配置。仅当 sequential_image_generation 为 auto 时生效。"
      },
      "output_format": {
        "type": "string",
        "description": "仅 doubao-seedream-5.0 支持该参\n指定生成图像的文件格式。可选值:\n- png\n- jpeg\n\n默认值 jpeg"
      }
    },
    "required": [
      "model",
      "prompt"
    ],
    "x-apifox-orders": [
      "model",
      "prompt",
      "image",
      "size",
      "seed",
      "sequential_image_generation",
      "sequential_image_generation_options",
      "guidance_scale",
      "output_format",
      "response_format",
      "watermark"
    ]
  },
  "required": false,
  "mediaType": "",
  "examples": [
    {
      "value": "{\n    \"model\": \"doubao-seedream-5-0-260128\",\n    \"prompt\": \"充满活力的特写编辑肖像,模特眼神犀利,头戴雕塑感帽子,色彩拼接丰富,眼部焦点锐利,景深较浅,具有Vogue杂志封面的美学风格,采用中画幅拍摄,工作室灯光效果强烈。\",\n    \"size\": \"2K\",\n    \"output_format\": \"png\",\n    \"response_format\": \"url\",\n    \"watermark\": false\n}",
      "mediaType": "application/json",
      "description": "",
      "name": "seedream-5.0/4.5/4.0 - 文生图"
    },
    {
      "name": "seedream-5.0/4.5/4.0 - 图生图",
      "value": "{\r\n    \"model\": \"doubao-seedream-5-0-260128\",\r\n    \"prompt\": \"保持模特姿势和液态服装的流动形状不变。将服装材质从银色金属改为完全透明的清水(或玻璃)。透过液态水流,可以看到模特的皮肤细节。光影从反射变为折射。\",\r\n    \"image\": \"https://ark-project.tos-cn-beijing.volces.com/doc_image/seedream4_5_imageToimage.png\",\r\n    \"size\": \"2K\",\r\n    \"output_format\": \"png\",\r\n    \"watermark\": false\r\n}",
      "mediaType": "application/json"
    },
    {
      "name": "seedream-5.0/4.5/4.0 - 多图融合",
      "value": "{\r\n    \"model\": \"doubao-seedream-5-0-260128\",\r\n    \"prompt\": \"将图1的服装换为图2的服装\",\r\n    \"image\": [\r\n        \"https://ark-project.tos-cn-beijing.volces.com/doc_image/seedream4_imagesToimage_1.png\",\r\n        \"https://ark-project.tos-cn-beijing.volces.com/doc_image/seedream4_5_imagesToimage_2.png\"\r\n    ],\r\n    \"sequential_image_generation\": \"disabled\",\r\n    \"size\": \"2K\",\r\n    \"output_format\": \"png\",\r\n    \"watermark\": false\r\n}",
      "mediaType": "application/json"
    },
    {
      "name": "seedream-5.0/4.5/4.0 - 多参考图生图",
      "value": "{\r\n    \"model\": \"doubao-seedream-5-0-260128\",\r\n    \"prompt\": \"生成3张女孩和奶牛玩偶在游乐园开心地坐过山车的图片,涵盖早晨、中午、晚上\",\r\n    \"image\": [\r\n        \"https://ark-project.tos-cn-beijing.volces.com/doc_image/seedream4_imagesToimages_1.png\",\r\n        \"https://ark-project.tos-cn-beijing.volces.com/doc_image/seedream4_imagesToimages_2.png\"\r\n    ],\r\n    \"sequential_image_generation\": \"auto\",\r\n    \"sequential_image_generation_options\": {\r\n        \"max_images\": 3\r\n    },\r\n    \"size\": \"2K\",\r\n    \"output_format\": \"png\",\r\n    \"watermark\": false\r\n}",
      "mediaType": "application/json"
    },
    {
      "name": "seedream-3.0-t2i",
      "value": "{\r\n    \"model\": \"doubao-seedream-3-0-t2i-250415\",\r\n    \"prompt\": \"鱼眼镜头,一只猫咪的头部,画面呈现出猫咪的五官因为拍摄方式扭曲的效果。\",\r\n    \"response_format\": \"url\",\r\n    \"size\": \"1024x1024\",\r\n    \"seed\": 12,\r\n    \"guidance_scale\": 2.5,\r\n    \"watermark\": true\r\n}",
      "mediaType": "application/json"
    },
    {
      "name": "seededit-3.0-i2i",
      "value": "{\r\n    \"model\": \"doubao-seededit-3-0-i2i-250628\",\r\n    \"prompt\": \"改成爱心形状的泡泡\",\r\n    \"image\": \"https://ark-project.tos-cn-beijing.volces.com/doc_image/seededit_i2i.jpeg\",\r\n    \"response_format\": \"url\",\r\n    \"size\": \"adaptive\",\r\n    \"seed\": 21,\r\n    \"guidance_scale\": 5.5,\r\n    \"watermark\": true\r\n}",
      "mediaType": "application/json"
    }
  ],
  "oasExtensions": ""
}

响应

[
  {
    "id": 731436072,
    "name": "Create image",
    "code": 200,
    "contentType": "json",
    "jsonSchema": {
      "type": "object",
      "properties": {
        "created": {
          "type": "integer"
        },
        "data": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "url": {
                "type": "string"
              }
            },
            "required": [
              "url"
            ],
            "x-apifox-orders": [
              "url"
            ]
          }
        }
      },
      "required": [
        "created",
        "data"
      ],
      "x-apifox-orders": [
        "created",
        "data"
      ]
    },
    "itemSchema": {},
    "description": "",
    "mediaType": "",
    "headers": [],
    "oasExtensions": ""
  }
]

响应示例

[
  {
    "name": "成功示例",
    "responseId": 731436072,
    "data": "{\r\n    \"created\": 1749819664,\r\n    \"data\": [\r\n        {\r\n            \"content_filter_results\": {\r\n                \"hate\": {\r\n                    \"filtered\": false,\r\n                    \"severity\": \"safe\"\r\n                },\r\n                \"self_harm\": {\r\n                    \"filtered\": false,\r\n                    \"severity\": \"safe\"\r\n                },\r\n                \"sexual\": {\r\n                    \"filtered\": false,\r\n                    \"severity\": \"safe\"\r\n                },\r\n                \"violence\": {\r\n                    \"filtered\": false,\r\n                    \"severity\": \"safe\"\r\n                }\r\n            },\r\n            \"prompt_filter_results\": {\r\n                \"hate\": {\r\n                    \"filtered\": false,\r\n                    \"severity\": \"safe\"\r\n                },\r\n                \"profanity\": {\r\n                    \"detected\": false,\r\n                    \"filtered\": false\r\n                },\r\n                \"self_harm\": {\r\n                    \"filtered\": false,\r\n                    \"severity\": \"safe\"\r\n                },\r\n                \"sexual\": {\r\n                    \"filtered\": false,\r\n                    \"severity\": \"safe\"\r\n                },\r\n                \"violence\": {\r\n                    \"filtered\": false,\r\n                    \"severity\": \"safe\"\r\n                }\r\n            },\r\n            \"revised_prompt\": \"A young, adorable sea otter floating in the ocean\",\r\n            \"url\": \"https://dalleproduse.blob.core.windows.net/private/images/6b0ee3bd-fe24-46c7-8ab8-85be87b00eaf/generated_00.png?se=2025-06-14T13%3A01%3A13Z&sig=9pLM1cLo1Af6FKRZc2AZSVxfSQBBBIyzfg0cOiT7C%2B0%3D&ske=2025-06-13T23%3A43%3A31Z&skoid=09ba021e-c417-441c-b203-c81e5dcd7b7f&sks=b&skt=2025-06-06T23%3A43%3A31Z&sktid=33e01921-4d64-4f8c-a055-5bdaffd5e33d&skv=2020-10-02&sp=r&spr=https&sr=b&sv=2020-10-02\"\r\n        }\r\n    ]\r\n}",
    "description": "",
    "oasKey": "",
    "oasExtensions": "",
    "id": 649974032
  }
]