POST
/
v3
/
async
/
txt2img
curl --request POST \
  --url https://api.ppinfra.com/v3/async/txt2img \
  --header 'Authorization: <authorization>' \
  --header 'Content-Type: <content-type>' \
  --data '{
  "extra": {
    "response_image_type": "<string>"
  },
  "request": {
    "model_name": "<string>",
    "prompt": "<string>",
    "width": 123,
    "height": 123,
    "image_num": 123,
    "steps": 123,
    "guidance_scale": 123,
    "sampler_name": "<string>",
    "negative_prompt": "<string>",
    "sd_vae": "<string>",
    "seed": 123,
    "loras": [
      {
        "model_name": "<string>",
        "strength": 123
      }
    ],
    "embeddings": [
      {
        "model_name": "<string>"
      }
    ],
    "hires_fix": {
      "target_width": 123,
      "target_height": 123,
      "strength": 123,
      "upscaler": "<string>"
    },
    "refiner": {
      "switch_at": 123
    },
    "clip_skip": {},
    "enable_transparent_background": true,
    "restore_faces": true
  }
}'
{
  "task_id": "<string>"
}

文生图 API 能基于用户输入的内容,生成符合语义描述的图片。

请求头

Content-Type
string
required

枚举值: application/json

Authorization
string
required

Bearer 身份验证格式,例如:Bearer {{API 密钥}}。

请求体

extra
object

请求的可选 extra 参数

request
object
required

响应参数

task_id
string
required

异步任务的 task_id。您应该使用该 task_id 请求 查询任务结果 API 以获取生成结果