Alibaba

alibaba/wan-2.2-a14b/text-to-image

文生图
更多设置(8 项)
生成结果演示示例登录后试用

$0.025 / 张 · 约 40 张/$1

Wan 2.2 A14B 文生图示例
示例 · 由以下输入生成

In this breathtaking wildlife documentary, we are drawn into an intimate close-up of a majestic lion's face, framed against the backdrop of a vast African savannah at dawn. The camera captures the raw power and nobility of the creature as it gazes intently into the distance, its golden-brown fur glistening under the soft, diffused light that bathes the scene in an ethereal glow. Harsh shadows dance across its features, accentuating the deep wrinkles around its eyes and the rugged texture of its fur, each strand a testament to its age and wisdom. The static camera angle invites viewers to immerse themselves in this moment of profound stillness, where the lion's intense focus hints at an unseen presence or a distant threat. As the sun ascends, the landscape transforms into a symphony of warm hues, enhancing the serene yet tense atmosphere that envelops this extraordinary encounter with nature's untamed beauty.

价格

单价 $0.025 / 张

按实际生成张数结算。

约 40 张/$1

每次请求会先临时冻结 $0.025,按实际用量扣费,通常在一分钟内完成:多余部分退回,超出部分从余额扣除,余额可能因此变为负数;余额为负时新请求暂停,充值后先抵扣欠款。

生成失败不收费。

API 接入

用这个模型 ID 提交生成请求。

POST/v1/model-tasks
alibaba/wan-2.2-a14b/text-to-image
请求体
{
  "model": "alibaba/wan-2.2-a14b/text-to-image",
  "input": {
    "prompt": "In this breathtaking wildlife documentary, we are drawn into an intimate close-up of a majestic lion's face, framed against the backdrop of a vast African savannah at dawn. The camera captures the raw power and nobility of the creature as it gazes intently into the distance, its golden-brown fur glistening under the soft, diffused light that bathes the scene in an ethereal glow. Harsh shadows dance across its features, accentuating the deep wrinkles around its eyes and the rugged texture of its fur, each strand a testament to its age and wisdom. The static camera angle invites viewers to immerse themselves in this moment of profound stillness, where the lion's intense focus hints at an unseen presence or a distant threat. As the sun ascends, the landscape transforms into a symphony of warm hues, enhancing the serene yet tense atmosphere that envelops this extraordinary encounter with nature's untamed beauty.",
    "acceleration": "regular",
    "enable_prompt_expansion": false,
    "guidance_scale": 3.5,
    "guidance_scale_2": 4,
    "image_size": "square_hd",
    "negative_prompt": "",
    "num_inference_steps": 27,
    "shift": 2
  }
}

输入 Schema

参数类型是否必填默认值
promptstring必填—
accelerationstring可选regular
enable_prompt_expansionboolean可选false
guidance_scalenumber可选3.5
guidance_scale_2number可选4
image_sizeobject | string可选square_hd
negative_promptstring可选
num_inference_stepsinteger可选27
seedinteger可选—
shiftnumber可选2

返回结果

接口会返回生成结果,或返回可轮询的异步任务;具体响应方式与结果字段见下方示例和 Schema。

异步任务
提交响应
HTTP 202
/v1/model-tasksapplication/json
{
  "id": "task_example",
  "model": "alibaba/wan-2.2-a14b/text-to-image",
  "status": "queued"
}
状态响应
HTTP 200
/v1/model-tasks/{id}application/json
{
  "id": "task_example",
  "model": "alibaba/wan-2.2-a14b/text-to-image",
  "status": "completed",
  "output": {
    "image": {
      "url": "https://api.musespan.com/v1/model-tasks/task_example/artifacts/0"
    }
  }
}
文件下载
HTTP 200
/v1/model-tasks/{id}/artifacts/{index}生成的图片(如 image/png)

任务完成后,output 里的文件地址就指向此接口,序号从 0 开始。下载时要带上同一个 API Key(Authorization 请求头)。

错误响应
HTTP 400
/v1/model-tasksapplication/json
{
  "error": {
    "code": "invalid_input",
    "message": "The input does not match this model's input schema. Check the model's API documentation.",
    "type": "invalid_request_error"
  }
}

调用示例

异步任务提交后返回任务 ID,轮询至 status 为 completed 后,按返回结果获取生成内容。API Key 在控制台获取。

# Use a new directory for each new generation. Rerunning here continues this task.
set -eu
test -s model-task-id.txt || python3 -c "import uuid; print(uuid.uuid4())" > model-task-id.txt
REQUEST_ID=$(cat model-task-id.txt)
# Idempotent: resending the same bytes with the same ID never charges twice.
curl --fail-with-body --retry 3 --retry-connrefused --request POST 'https://api.musespan.com/v1/model-tasks' \
  --header "Authorization: Bearer $MUSESPAN_API_KEY" \
  --header "X-Request-Id: $REQUEST_ID" \
  --header "Content-Type: application/json" \
  --data '{"model":"alibaba/wan-2.2-a14b/text-to-image","input":{"prompt":"In this breathtaking wildlife documentary, we are drawn into an intimate close-up of a majestic lion'\''s face, framed against the backdrop of a vast African savannah at dawn. The camera captures the raw power and nobility of the creature as it gazes intently into the distance, its golden-brown fur glistening under the soft, diffused light that bathes the scene in an ethereal glow. Harsh shadows dance across its features, accentuating the deep wrinkles around its eyes and the rugged texture of its fur, each strand a testament to its age and wisdom. The static camera angle invites viewers to immerse themselves in this moment of profound stillness, where the lion'\''s intense focus hints at an unseen presence or a distant threat. As the sun ascends, the landscape transforms into a symphony of warm hues, enhancing the serene yet tense atmosphere that envelops this extraordinary encounter with nature'\''s untamed beauty.","acceleration":"regular","enable_prompt_expansion":false,"guidance_scale":3.5,"guidance_scale_2":4,"image_size":"square_hd","negative_prompt":"","num_inference_steps":27,"shift":2}}'
# Poll every 5 seconds for up to 25 minutes until status is completed or failed.
# Still queued (with queue_position) 5 minutes after submission: failed with queue_timeout, not charged.
# No result 15 minutes after acceptance (or no confirmation 15 minutes after submission): failed with generation_timeout, not charged.
# Any failure is final: generate again in a new directory (a new X-Request-Id).
# A 404 means the POST did not arrive: rerun this script to resend it with the same ID.
curl --fail-with-body 'https://api.musespan.com/v1/model-tasks/'"$REQUEST_ID"'' --header "Authorization: Bearer $MUSESPAN_API_KEY"