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

第20章 Leonardo.AI API 使用 Krea 2 Turbo 模型生图指南

Krea 2 Turbo

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

示例请求

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": "krea-2-turbo", "parameters": { "width": 1024, "height": 1024, "prompt": "Koala with purple wizard hat on a skateboard", "quantity": 2 }, "public": false }'

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

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

请求头 --header "accept: application/json" \ --header "authorization: Bearer " \ --header "content-type: application/json"

请求体参数

height | integer | 可选。要生成的图像高度(像素)。支持 16 至 4096 之间且为 8 的倍数。默认值为 1024。 model | string | 必需。模型标识符。设置为 krea-2-turbo。 prompt | string | 必需。描述希望模型生成的图像内容的文本提示。支持最多 9999 个字符。 prompt_enhance | string | 可选。控制提示词增强功能。支持 AUTO、ON 或 OFF。默认值为 AUTO。 public | boolean | 可选。布尔标志,决定生成结果是公开(true)还是私有(false)。 quantity | integer | 可选。单次请求生成的图像数量。支持 1 至 8。默认值为 4。 width | integer | 可选。要生成的图像宽度(像素)。支持 16 至 4096 之间且为 8 的倍数。默认值为 1024。

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

评论 (0)