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

第34章 Leonardo.AI 使用 Seedream 5.0 Pro 模型生成图像教程

# 第34章 Seedream 5.0 Pro 本指南介绍如何通过 Leonardo.AI REST API 使用 Seedream 5.0 Pro 模型生成图像。 请求示例
curl --request POST \
     --url https://cloud.leonardo.ai/api/rest/v2/generations \
     --header 'accept: application/json' \
     --header 'authorization: Bearer <YOUR_API_KEY>' \
     --header 'content-type: application/json' \
     --data '{
       "model": "seedream-5.0-pro",
       "parameters": {
           "width": 2048,
           "height": 2048,
           "prompt": "Koala with purple wizard hat on a skateboard",
           "quantity": 2,
           "guidances": {
               "image_reference": [
                   {
                       "image": {
                           "id": "YOUR_UPLOADED_IMAGE_ID",
                           "type": "UPLOADED"
                       },
                       "strength": "MID"
                   }
               ]
           }
       },
       "public": false
   }'
API 请求端点、请求头和参数 端点 https://cloud.leonardo.ai/api/rest/v2/generations 请求头
--header "accept: application/json" \
--header "authorization: Bearer <YOUR_API_KEY>" \
--header "content-type: application/json"
请求体参数
参数类型说明
guidancesobject可选。定义图像引导输入的对象,会影响生成结果。
guidances.image_referencearray可选。参考图像数组,最多 10 张。每张参考图包含 image.id、image.type(GENERATED 或 UPLOADED)以及 strength(LOW、MID、HIGH)。
heightinteger可选。输入分辨率的高度,支持 768 到 2048,默认 2048。
modelstring必填。模型标识符,设置为 seedream-5.0-pro。
output_formatstring可选。输出图像格式,支持 jpeg 或 png,默认 jpeg。
promptstring必填。文本提示词,描述希望模型生成的图像内容。
prompt_enhancestring可选。控制提示词增强,支持 AUTO、ON 或 OFF,默认 AUTO。
publicboolean可选。布尔值,决定生成结果是公开(true)还是私有(false)。
quantityinteger可选。单次请求生成的图像数量,支持 1 到 6,默认 1。
seedinteger可选。使用固定 seed,保证多组生成结果的一致性。
widthinteger可选。输入分辨率的宽度,支持 768 到 2048,默认 2048。

更新于 5 个月前 这个页面对你有帮助吗?

评论 (0)