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

第19章 使用 Leonardo.AI API 调用 Ideogram 模型生成图像

P-Image-Ideogram

本指南展示了如何通过 Leonardo.AI REST API 使用 P-Image-Ideogram 模型生成图像。

示例请求

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": "ideogram/p-image-ideogram", "parameters": { "width": 1024, "height": 1024, "prompt": "A vintage travel poster of Mount Fuji at sunrise, bold art deco typography", "quality": "MEDIUM", "quantity": 4, "prompt_enhance": "AUTO" }, "public": false }'

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

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

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

Body 参数

height integer 可选。输入高度分辨率。默认为 1024。接受以下值之一:512、640、720、800、832、864、896、1024、1120、1152、1248、1280、1440、1536、1600、1664、1728、1792、2048、2240、2304、2496、2560、2880、3072、3456。

model string 必填。模型标识符。设置为 ideogram/p-image-ideogram。

prompt string 必填。描述您希望模型生成图像的文本提示。接受 1 到 10000 个字符。

prompt_enhance string 可选。控制提示词增强功能。可选值为 AUTO、ON 或 OFF。默认为 AUTO。

public boolean 可选。决定生成的图像是否显示在社区动态中(true)或保持私密(false)。

quality string 可选。输出质量等级。可选值为 VERY_LOW、LOW、MEDIUM 或 HIGH。默认为 MEDIUM。对于第三方模型,请使用 quality 而不是 mode。

quantity integer 可选。单次请求生成的图像数量。接受 1 到 8。默认为 4。

width integer 可选。输入宽度分辨率。默认为 1024。接受以下值之一:512、640、720、800、832、864、896、1024、1120、1152、1248、1280、1440、1536、1600、1664、1728、1792、2048、2240、2304、2496、2560、2880、3072、3456。

更新于 4 个月前 本页对您有帮助吗?

评论 (0)