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

第12章 FLUX Schnell 使用指南

FLUX Schnell本指南介绍如何通过 Leonardo.AI REST API 使用 FLUX Schnell 模型生成图片。 示例请求 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": "flux-schnell", "parameters": { "width": 1024, "height": 1024, "prompt": "A photo of an orange cat playing with a tennis ball, cinematic lighting", "quantity": 4, "style_ids": [ "111dc692-d470-4eec-b791-3475abac4c46" ] }, "public": false }' API 请求端点、请求头与参数 端点 https://cloud.leonardo.ai/api/rest/v2/generations 请求头 --header "accept: application/json" \ --header "authorization: Bearer " \ --header "content-type: application/json" Body 参数 | 参数 | 类型 | 说明 | | guidances | object | 可选。定义图像引导输入的对象,会影响生成结果。 | | guidances.content | array | 可选。内容参考(最多 1 个),参照输入图像的形态与内容。每项包含 image.id、image.type(INIT、GENERATION、UPLOADED、GENERATED、VARIATION)和 strength(LOW、MID、HIGH),默认 MID。 | | guidances.style | array | 可选。风格参考(最多 1 个),参照输入图像的风格。每项包含 image.id、image.type(INIT、GENERATION、UPLOADED、GENERATED、VARIATION)和 strength(LOW、MID、HIGH、ULTRA、MAX),默认 MID。 | | height | integer | 可选。生成图像的高度(像素),支持 32 到 2048,且为 8 的倍数,默认 1024。 | | model | string | 必填。模型标识符,设为 flux-schnell。 | | prompt | string | 必填。描述想要生成的图像的文本提示词,长度为 1 到 2000 个字符。 | | prompt_enhance | string | 可选。控制提示词增强,可选 AUTO、ON 或 OFF,默认 AUTO。 | | public | boolean | 可选。布尔值,决定生成结果是公开(true)还是私有(false)。 | | quantity | integer | 可选。单次请求生成的图片数量,支持 1 到 8,默认 4。 | | seed | integer | 可选。指定固定 seed,保证多次生成结果的一致性,支持 0 到 2147483637。 | | style_ids | array | 可选。预设风格的 UUID 数组(最多 1 个),用于给输出应用预设风格,见下表。默认为 ["111dc692-d470-4eec-b791-3475abac4c46"](Dynamic)。 | | width | integer | 可选。生成图像的宽度(像素),支持 32 到 2048,且为 8 的倍数,默认 1024。 | 风格 ID 列表 | 预设风格 | UUID | | 3D Render | debdf72a-91a4-467b-bf61-cc02bdeb69c6 | | Acrylic | 3cbb655a-7ca4-463f-b697-8a03ad67327c | | Anime General | b2a54a51-230b-4d4f-ad4e-8409bf58645f | | Creative | 6fedbf1f-4a17-45ec-84fb-92fe524a29ef | | Dynamic | 111dc692-d470-4eec-b791-3475abac4c46 | | Fashion | 594c4a08-a522-4e0e-b7ff-e4dac4b6b622 | | Game Concept | 09d2b5b5-d7c5-4c02-905d-9f84051640f4 | | Graphic Design 3D | 7d7c2bc5-4b12-4ac3-81a9-630057e9e89f | | Illustration | 645e4195-f63d-4715-a3f2-3fb1e6eb8c70 | | None | 556c1ee5-ec38-42e8-955a-1e82dad0ffa1 | | Portrait | ab5a4220-7c42-41e5-a578-eddb9fed3d75 | | Portrait Cinematic | 4edb03c9-8a26-4041-9d01-f85b5d4abd71 | | Portrait Fashion | 0d34f8e1-46d4-428f-8ddd-4b11811fa7c9 | | Ray Traced | b504f83c-3326-4947-82e1-7fe9e839ec0f | | Stock Photo | 5bdc3f2a-1be6-4d1c-8e77-992a30824a2c | | Watercolor | 1db308ce-c7ad-4d10-96fd-592fa6b75cc4 |


更新于4个月前    本页是否有帮助?

评论 (0)