进阶 docs.leonardo.ai 2026-11-22 15:11:20 · 0 阅读

第33章 Leonardo.AI API 使用 Seedream 4.5 图像生成指南

Seedream 4.5

本指南介绍如何通过 Leonardo.AI REST API 使用 Seedream 4.5 模型生成图像。

请求示例

curl --request POST \
     --url https://cloud.leonardo.ai/api/rest/v2/generations \
     --header 'accept: application/json' \
     --header 'authorization: Bearer ' \
     --header 'content-type: application/json' \
     --data '{
       "model": "seedream-4.5",
       "parameters": {
           "width": 1920,
           "height": 1080,
           "prompt": "Koala with purple wizard hat on a skateboard",
           "quantity": 2,
           "guidances": {
               "image_reference": [
                   {
                       "image": {
                           "id": "YOUR_UPLOADED_IMAGE_ID",
                           "type": "UPLOADED"
                       },
                       "strength": "MID"
                   }
               ]
           },
           "style_ids": [
               "111dc692-d470-4eec-b791-3475abac4c46"
           ]
       },
       "public": false
   }'

配置说明

API 请求端点、请求头与参数
Endpoint

https://cloud.leonardo.ai/api/rest/v2/generations

请求头
--header "accept: application/json" \
--header "authorization: Bearer " \
--header "content-type: application/json"
请求体参数
参数类型说明
guidancesobject可选。定义图像引导输入的对象,会影响生成结果。
guidances.image_referencearray可选。最多 6 张参考图像的数组。每张参考图包含 image.id、image.type(GENERATED 或 UPLOADED)和 strength(LOW、MID、HIGH)。
heightinteger可选。输入分辨率的高度。
modelstring必填。模型标识符,设置为 seedream-4.5。
promptstring必填。描述你希望模型生成图像的文本提示词。
prompt_enhancestring可选。设置为 "ON" 时启用提示词增强,设置为 "OFF" 时关闭。
publicboolean可选。布尔值,决定生成结果是公开(true)还是私有(false)。
quantityinteger可选。单次请求生成的图像数量。
seedinteger可选。使用固定 seed 以保证多批次生成结果的一致性。
style_idsarray可选。风格 UUID 数组,用于为输出应用预设艺术风格。
widthinteger可选。输入分辨率的宽度,支持 256 到 1440。

风格 ID 列表

预设风格UUID
Cinematica5632c7c-ddbb-4e2f-ba34-8456ab3ac436
Creative6fedbf1f-4a17-45ec-84fb-92fe524a29ef
Dynamic111dc692-d470-4eec-b791-3475abac4c46
Fashion594c4a08-a522-4e0e-b7ff-e4dac4b6b622
Portraitab5a4220-7c42-41e5-a578-eddb9fed3d75
Stock Photo5bdc3f2a-1be6-4d1c-8e77-992a30824a2c
Vibrantdee282d3-891f-4f73-ba02-7f8131e5541b

更新于 10 个月前 此页面是否对你有帮助?

评论 (0)