创建图片任务
生成 PNG 图片,支持文生图和图生图。图生图通过 reference_asset_id 或 reference_asset_ids 指定参考图,最多 10 张。请携带配置接口返回的 rate_version,并使用唯一的 Idempotency-Key 处理重试。
认证
API Key:X-API-Key: <API Key> 或 Authorization: Bearer <API Key>。
示例中的凭证为占位值,请替换后在服务器端运行。
代码示例
curl -X POST 'https://shixux.com/api/v1/image/generate' \ -H 'X-API-Key: yb_xxx_yyy' \ -H 'Content-Type: application/json' \ -H 'Idempotency-Key: your-unique-business-action-id' \ -d '{"mode":"text-to-image","model":"sx-image-2.6-sunburst","prompt":"A yellow ceramic cup on a plain table.","size":"1024x1024","rate_version":1}'{ "id": "job_xxx", "type": "tts", "status": "queued", "reserved_credits": 1, "estimate_detail": {}}Idempotency-Key?|幂等键,最长 128 个字符。重试同一请求时使用相同的值;同一个键用于不同的请求时返回 409。
application/json- body
reference_asset_ids?array<string>按顺序排列的参考图片素材 ID,最多 10 张,与 reference_asset_id 二选一。
元素
items <= 10mode*string生成模式。视频支持 t2va、fl2va、ref2va;图片支持 text-to-image 和 image-to-image。各模型支持的模式以对应配置接口为准。
可选值
"text-to-image""image-to-image"model*string模型 ID。图片和视频模型的可用状态、清晰度和费率以对应配置接口的返回为准;语音合成和音频编排可选 indextts-2(默认)或 indextts-2.5。
可选值
"doubao-seedream-5-0-pro-260628""doubao-seedream-5-0-flash-260915""doubao-seedream-5-5-261028""sx-image-2.6-sunburst"prompt*string图片提示词,1–32000 个字符。
长度
1 <= length <= 32000rate_version*integer费率版本。图片生成传入配置接口返回的 billing.version;费率变化后提交会被拒绝,需重新读取配置或报价。
范围
1 <= valuereference_asset_id?string单张参考图片的素材 ID,与 reference_asset_ids 二选一。
size*string图片输出尺寸。可用尺寸和费率由 GET /v1/image/config 返回;1776x2368 和 2368x1776 按对应的大尺寸档位计费。
可选值
"1024x1024""1536x1024""1024x1536""2048x2048""2048x1152""1152x2048""1776x2368""2368x1776"请求成功
application/json- response
estimate_detail*id*Idreserved_credits*Reserved Creditsstatus*JobStatus可选值
"queued""processing""succeeded""failed""cancelled"type*JobType可选值
"tts""avatar""video""video_analysis""image""voice_design""audio_composition"