- 修正3个i3-3代SKU文件总成本与配件之和不一致的问题:i3-3代-4G-32G总成本221.5->236.5,i3-3代-4G-64G总成本236.5->251.5,i3-3代-8G-64G总成本313.5->298.5 - 删除售价验证临时图片,新增nascab产品和2.5金单有产品目录
6.2 KiB
6.2 KiB
引擎1:豆包万相(Doubao Seedream)
使用火山引擎 Ark API 的 Doubao Seedream 模型,支持文生图、图生图、多图融合、图片编辑。
前提条件
curl.exe(Windows内置)- Ark API Key:
ark-119a37ed-f123-42fc-aea6-b38d47d47fc0-f7ddf - API端点:
https://ark.cn-beijing.volces.com/api/v3/images/generations
模式一览
| 模式 | image参数 |
用途 |
|---|---|---|
| 文生图 | 省略或[] |
从文字描述生成图片 |
| 图生图 | ["url1"] |
风格转换、精修、变换 |
| 多图融合 | ["url1","url2",...] |
最多14张参考图融合 |
| 图片编辑 | ["url1"] + 编辑提示词 |
移除/替换元素、换背景等 |
默认模型: doubao-seedream-5-0-260128
文生图(Windows PowerShell)
$tmpFile = "$env:TEMP\request.json"
$prompt = "YOUR_PROMPT_HERE"
$json = @"
{"model":"doubao-seedream-5-0-260128","prompt":"$prompt","size":"2k","sequential_image_generation":"disabled","response_format":"url","stream":false,"watermark":false}
"@
$sw = [System.IO.StreamWriter]::new($tmpFile, $false, (New-Object System.Text.UTF8Encoding $false))
$sw.Write($json); $sw.Close()
$response = curl.exe -s -X POST https://ark.cn-beijing.volces.com/api/v3/images/generations `
-H "Content-Type: application/json" `
-H "Authorization: Bearer ark-119a37ed-f123-42fc-aea6-b38d47d47fc0-f7ddf" `
-d "@$tmpFile" | ConvertFrom-Json
$imageUrl = $response.data[0].url
$outputPath = Join-Path (Get-Location) "output-name.png"
curl.exe -s -o $outputPath $imageUrl
Write-Output $outputPath
图生图/图片编辑(本地文件输入,Windows PowerShell)
$imgBytes = [System.IO.File]::ReadAllBytes((Resolve-Path "path\to\input.png"))
$imgBase64 = [System.Convert]::ToBase64String($imgBytes)
$tmpFile = "$env:TEMP\request.json"
$prompt = "YOUR_EDIT_INSTRUCTIONS_HERE"
$json = @"
{"model":"doubao-seedream-5-0-260128","prompt":"$prompt","image":["data:image/png;base64,$imgBase64"],"size":"2k","sequential_image_generation":"disabled","response_format":"url","stream":false,"watermark":false}
"@
$sw = [System.IO.StreamWriter]::new($tmpFile, $false, (New-Object System.Text.UTF8Encoding $false))
$sw.Write($json); $sw.Close()
$response = curl.exe -s -X POST https://ark.cn-beijing.volces.com/api/v3/images/generations `
-H "Content-Type: application/json" `
-H "Authorization: Bearer ark-119a37ed-f123-42fc-aea6-b38d47d47fc0-f7ddf" `
-d "@$tmpFile" | ConvertFrom-Json
$imageUrl = $response.data[0].url
$outputPath = Join-Path (Get-Location) "output-name.png"
curl.exe -s -o $outputPath $imageUrl
Write-Output $outputPath
多图融合
{
"model": "doubao-seedream-5-0-260128",
"prompt": "把图1的人物穿上图2的衣服,站在图3的场景中",
"image": ["url1", "url2", "url3"],
"size": "2k",
"sequential_image_generation": "disabled",
"response_format": "url",
"stream": false,
"watermark": false
}
批量生成(最多15张)
{
"model": "doubao-seedream-5-0-260128",
"prompt": "一个女孩和她的布偶牛在过山车上,分别呈现早晨、中午、傍晚的场景",
"sequential_image_generation": "auto",
"sequential_image_generation_options": { "max_images": 3 },
"size": "2k",
"response_format": "url",
"stream": false,
"watermark": false
}
豆包参数参考
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
model |
string | 是 | doubao-seedream-5-0-260128(默认)或 doubao-seededit-3-0-i2i(精确编辑) |
prompt |
string | 是 | 文本提示词,最多 |
image |
string[] | 否 | 参考图片URL或Base64(data:image/png;base64,...),最多14张 |
size |
string | 否 | 2k(默认)、3k、4k 或 WIDTHxHEIGHT(如2048x1024),必须小写 |
response_format |
string | 否 | url(下载链接,24h有效)或 b64_json |
sequential_image_generation |
string | 否 | disabled(默认,单图)或 auto(模型决定批量数) |
sequential_image_generation_options |
object | 否 | { "max_images": N } N为1-15,仅auto模式 |
stream |
boolean | 否 | false(等待全部)或 true(逐张返回) |
watermark |
boolean | 否 | 添加"AI Generated"水印,默认false |
guidance_scale |
float | 否 | 文本遵循度(CFG),范围[1,10],仅seededit-3-0-i2i |
seed |
int32 | 否 | 可复现种子,仅seededit-3-0-i2i |
豆包尺寸指南
| 别名 | 近似分辨率 | 适用场景 |
|---|---|---|
2k |
~2048px | 默认 — 质量与速度平衡 |
3k |
~3072px | 高质量,产品图 |
4k |
~4096px | 最终生产质量 |
WIDTHxHEIGHT |
自定义 | 如2048x1024宽幅横幅 |
像素约束:两个维度必须在[1280, 4096],最大3:1宽高比。
豆包提示词技巧
- 描述场景: 主体、动作、环境、氛围
- 指定风格: "电影大片感"、"水彩画风"、"赛博朋克"、"oc渲染"、"超现实主义"
- 质量关键词: "光线追踪"、"景深"、"极致的光影"、"动态模糊"
- 编辑指令: "把背景换成海滩"、"移除画面中的人物"、"将风格改为水彩画"
- 中文提示词原生支持 — 无需翻译为英文
Windows注意事项
| 问题 | 解决方案 |
|---|---|
| PowerShell 5.1给JSON加UTF-8 BOM | 不要用Set-Content或[System.Text.Encoding]::UTF8,用[System.IO.StreamWriter]::new($path, $false, (New-Object System.Text.UTF8Encoding $false)) |
PowerShell破坏curl中的" |
始终写JSON到临时文件,用-d "@$tmpFile" |
| curl别名冲突 | 用curl.exe而非curl |
| 续行符 | 用反引号` |
豆包错误处理
- 401: API Key无效 — 检查Authorization头
- 400: 请求错误 — 检查提示词长度、图片格式、尺寸值
- 429: 限流 — 等待后重试
- 500: 服务器错误 — 稍后重试
精确编辑模型
需要精细编辑时,doubao-seededit-3-0-i2i提供额外控制:
{
"model": "doubao-seededit-3-0-i2i",
"prompt": "Change the dress color to red",
"image": ["data:image/png;base64,..."],
"guidance_scale": 5.5,
"seed": 42,
"size": "adaptive",
"response_format": "url",
"watermark": false
}