跳转到内容
本站为社区维护的非官方中文翻译,与 Cloudflare, Inc. 无关联。本站不提供账户登录,请勿在任何非官方站点输入您的 Cloudflare 账户信息。官方文档:developers.cloudflare.com
Alibaba logo

Wan 2.6 Image

Text-to-Image • Alibaba

查看 MarkdownAgent 设置
  • Third-party
  • Zero data retention

阿里巴巴 Wan 2.6 文生图模型,可根据文本提示词生成图像,支持可选的负面提示词和自定义尺寸。

模型信息
条款和许可证链接 ↗
更多信息链接 ↗
零数据保留是
定价在 Cloudflare 仪表板中查看定价 ↗

用法

const response = await env.AI.run(
  'alibaba/wan-2.6-image',
  { prompt: 'A golden retriever puppy playing in autumn leaves' },
)
console.log(response)
curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run \
  --header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
  --header "Content-Type: application/json" \
  --data '{
  "model": "alibaba/wan-2.6-image",
  "input": {
    "prompt": "A golden retriever puppy playing in autumn leaves"
  }
}'
简单生成
{
  "gatewayMetadata": {
    "keySource": "Unified"
  },
  "result": {
    "image": "https://dashscope-463f.oss-accelerate.aliyuncs.com/1d/66/20260417/c057796c/32701268-BbftSa6r_189314ac1a36.png"
  },
  "state": "Completed"
}

示例

自定义尺寸 — 以 WxH 格式指定图像尺寸
const response = await env.AI.run(
  'alibaba/wan-2.6-image',
  {
    prompt:
      'A vast alien desert landscape with two suns setting on the horizon, ancient ruins in the foreground',
    size: '1024x768',
  },
)
console.log(response)
curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run \
  --header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
  --header "Content-Type: application/json" \
  --data '{
  "model": "alibaba/wan-2.6-image",
  "input": {
    "prompt": "A vast alien desert landscape with two suns setting on the horizon, ancient ruins in the foreground",
    "size": "1024x768"
  }
}'
自定义尺寸
{
  "gatewayMetadata": {
    "keySource": "Unified"
  },
  "result": {
    "image": "https://dashscope-463f.oss-accelerate.aliyuncs.com/1d/35/20260417/c057796c/3257252-vy1GbNI6_bc223e38c5b4.png"
  },
  "state": "Completed"
}
方形格式 — 适用于社交媒体或产品照片的方形图像
const response = await env.AI.run(
  'alibaba/wan-2.6-image',
  {
    prompt:
      'A sleek wireless headphone on a minimalist white marble surface with soft studio lighting',
    size: '1024x1024',
  },
)
console.log(response)
curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run \
  --header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
  --header "Content-Type: application/json" \
  --data '{
  "model": "alibaba/wan-2.6-image",
  "input": {
    "prompt": "A sleek wireless headphone on a minimalist white marble surface with soft studio lighting",
    "size": "1024x1024"
  }
}'
方形格式
{
  "gatewayMetadata": {
    "keySource": "Unified"
  },
  "result": {
    "image": "https://dashscope-463f.oss-accelerate.aliyuncs.com/1d/84/20260417/c057796c/18355039-RFkWcHgG_0dcb1c1d6d95.png"
  },
  "state": "Completed"
}
负面提示词 — 引导生成结果避开不需要的元素
const response = await env.AI.run(
  'alibaba/wan-2.6-image',
  {
    prompt: 'A detailed oil painting portrait of a Renaissance nobleman with intricate lace collar',
    negative_prompt: 'modern clothing, photograph, blurry, low quality',
  },
)
console.log(response)
curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run \
  --header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
  --header "Content-Type: application/json" \
  --data '{
  "model": "alibaba/wan-2.6-image",
  "input": {
    "prompt": "A detailed oil painting portrait of a Renaissance nobleman with intricate lace collar",
    "negative_prompt": "modern clothing, photograph, blurry, low quality"
  }
}'
负面提示词
{
  "gatewayMetadata": {
    "keySource": "Unified"
  },
  "result": {
    "image": "https://dashscope-463f.oss-accelerate.aliyuncs.com/1d/53/20260417/c057796c/26097304-eVhNm6uS_edc041cd5e2b.png"
  },
  "state": "Completed"
}
竖版格式 — 适合人像的高竖版图像
const response = await env.AI.run(
  'alibaba/wan-2.6-image',
  {
    prompt: 'An elegant Art Deco poster featuring a jazz singer under a spotlight',
    size: '768x1024',
  },
)
console.log(response)
curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/run \
  --header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
  --header "Content-Type: application/json" \
  --data '{
  "model": "alibaba/wan-2.6-image",
  "input": {
    "prompt": "An elegant Art Deco poster featuring a jazz singer under a spotlight",
    "size": "768x1024"
  }
}'
竖版格式
{
  "gatewayMetadata": {
    "keySource": "Unified"
  },
  "result": {
    "image": "https://dashscope-463f.oss-accelerate.aliyuncs.com/1d/5a/20260417/c057796c/79957405-YTXQsRY6_8d8a6631f1d6.png"
  },
  "state": "Completed"
}

参数

prompt
stringrequired
size
stringpattern: ^\d+x\d+$
negative_prompt
string
image
stringformat: uri

API schema(原始)

输入
输出

这篇文档对您有帮助吗?