字节豆包图像

seedream-5-5

图像生成、编辑与参考图工作流,统一接入主流视觉模型。

能力

  • 文生图
  • 参考图

接入示例(异步图片)

先提交图片任务,再用同一把密钥查询 data.task_id。等待时继续查询原任务,结果链接请及时下载保存。

查看透明 PNG、图层拆分与实际消耗结算

cURL
curl https://api.wanapis.com/v1/images/tasks \
  -H "Authorization: Bearer $WANAPIS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "seedream-5-5",
  "prompt": "A red circle and a blue square on a white background",
  "size": "1K",
  "n": 1,
  "output_format": "png"
}'

# 用提交响应的 data.task_id 替换 task_xxx,持续查询原任务
curl https://api.wanapis.com/v1/images/tasks/task_xxx \
  -H "Authorization: Bearer $WANAPIS_API_KEY"
Python
import json
import os
import time
from urllib.request import Request, urlopen

url = "https://api.wanapis.com/v1/images/tasks"
headers = {
    "Authorization": "Bearer " + os.environ["WANAPIS_API_KEY"],
    "Content-Type": "application/json",
    "User-Agent": "Mozilla/5.0 WanAPIs image example",
}
payload = {
    "model": "seedream-5-5",
    "prompt": "A red circle and a blue square on a white background",
    "size": "1K",
    "n": 1,
    "output_format": "png"
}
with urlopen(Request(url, data=json.dumps(payload).encode(), headers=headers), timeout=60) as response:
    task_id = json.load(response)["data"]["task_id"]

while True:
    with urlopen(Request(url + "/" + task_id, headers=headers), timeout=60) as response:
        task = json.load(response)
    if task["data"]["status"] in ("SUCCESS", "FAILURE"):
        print(json.dumps(task, ensure_ascii=False))
        break
    time.sleep(3)

更多 字节豆包 模型

几分钟接入 seedream-5-5

注册即送体验额度,改一行 base_url 即可上线。