创建图片生成任务
POST /ent/v2/reference2image
说明
概览
| Method | POST |
|---|---|
| Path | /ent/v2/reference2image |
| Type | http |
| Status | 1 |
| Module | 2102810 |
| Folder | 76611123 |
参数
{ "query": [], "path": [], "cookie": [], "header": [ { "required": false, "description": "", "type": "string", "id": "Jsj23RwEo1", "enable": true, "name": "Authorization", "sampleValue": "Bearer {{YOUR_API_KEY}}" }, { "required": false, "description": "", "type": "string", "id": "jjYSOg2NrR", "enable": true, "name": "Content-Type", "sampleValue": "application/json" } ] }
请求体
{ "type": "application/json", "parameters": [], "jsonSchema": { "type": "object", "properties": { "prompt": { "type": "string", "description": "文本提示词\n视频生成的文本描述,长度不能超过 2000 个字符\n注1:viduq2模型支持文生图,在使用viduq2模型,且没有上传任何images时,模型会使用该参数的文本内容生成图片" }, "model": { "type": "string", "description": "模型名称\n可选值:viduq2、viduq1\nviduq2:支持文生图、图片编辑、参考生图\nviduq1:支持参考生图" }, "seed": { "type": "string", "description": "随机种子参数\n当默认不传或者传0时,会使用随机数替代\n手动设置则使用设置的种子" }, "images": { "type": "array", "items": { "type": "string" }, "description": "图像参考\nviduq2:支持输入 0~7 张图片\nviduq1:支持输入 1~7 张图片\n模型将以此参数中传入的图片中的主题为参考,生成与图片中主体一致的视频。\n注1:支持传入图片 Base64 编码或图片URL(确保可访问)\n注2:图片支持 png、jpeg、jpg、webp格式\n注3:图片像素不能小于 128*128,且比例需要小于1:4或者4:1\n注4: 且大小不超过50M\n注5:请注意,http请求的post body不超过20MB,且编码必须包含适当的内容类型字符串,例如:\n\ndata:image/png;base64,{base64_encode}" }, "aspect_ratio": { "type": "string", "description": "比例参数,不同模型支持不同的比例:\nviduq1:默认值16:9,可选值:16:9、9:16、1:1、3:4、4:3\nviduq2:默认值16:9,可选值如下:16:9、9:16、1:1、3:4、4:3、21:9、2:3、3:2\n- auto:表示与首张输入图保持相同比例" }, "resolution": { "type": "string", "description": "分辨率参数,不同模型支持的分辨率不同:\nviduq1:默认1080p,可选项:1080p\nviduq2:默认1080p,可选项:1080p、2K、4K" }, "payload": { "type": "string", "description": "透传参数\n不做任何处理,仅数据传输\n注:最多 1048576个字符" }, "callback_url": { "type": "string", "description": "Callback 协议\n需要您在创建任务时主动设置 callback_url,请求方法为 POST,当视频生成任务有状态变化时,Vidu 将向此地址发送包含任务最新状态的回调请求。回调请求内容结构与查询任务API的返回体一致\n回调返回的“status”包括以下状态:\n- processing 任务处理中\n- success 任务完成(如发送失败,回调三次)\n- failed 任务失败(如发送失败,回调三次)\nVidu采用回调签名算法进行认证,详情见:回调签名算法" } }, "required": [ "model", "prompt" ], "x-apifox-orders": [ "model", "images", "prompt", "seed", "aspect_ratio", "resolution", "payload", "callback_url" ] }, "required": false, "mediaType": "", "examples": [ { "mediaType": "application/json", "value": "{\r\n \"model\": \"viduq1\",\r\n \"prompt\": \"一只可爱的小猫坐在窗台上,阳光洒在它的身上,温馨的画面\"\r\n}" } ], "oasExtensions": "" }
响应
[ { "id": 755089939, "name": "成功", "code": 200, "contentType": "json", "jsonSchema": { "type": "object", "properties": { "task_id": { "type": "string" }, "state": { "type": "string" }, "model": { "type": "string" }, "prompt": { "type": "string" }, "images": { "type": "array", "items": { "type": "string" } }, "seed": { "type": "integer" }, "aspect_ratio": { "type": "string" }, "callback_url": { "type": "string" }, "payload": { "type": "string" }, "cus_priority": { "type": "integer" }, "credits": { "type": "integer" }, "created_at": { "type": "string" }, "watermark": { "type": "boolean" } }, "required": [ "task_id", "state", "model", "prompt", "images", "seed", "aspect_ratio", "callback_url", "payload", "cus_priority", "credits", "created_at", "watermark" ], "x-apifox-orders": [ "task_id", "state", "model", "prompt", "images", "seed", "aspect_ratio", "callback_url", "payload", "cus_priority", "credits", "created_at", "watermark" ] }, "itemSchema": {}, "description": "", "mediaType": "", "headers": [], "oasExtensions": "" } ]
响应示例
[ { "name": "成功示例", "responseId": 755089939, "data": "{\r\n \"task_id\": \"911092490931552256\",\r\n \"state\": \"created\",\r\n \"model\": \"viduq2\",\r\n \"prompt\": \"一只可爱的小猫坐在窗台上,阳光洒在它的身上,温馨的画面\",\r\n \"images\": [],\r\n \"seed\": 616519648,\r\n \"aspect_ratio\": \"auto\",\r\n \"callback_url\": \"\",\r\n \"payload\": \"\",\r\n \"cus_priority\": 0,\r\n \"credits\": 6,\r\n \"created_at\": \"2026-01-20T07:08:12.262592985Z\",\r\n \"watermark\": false\r\n}", "description": "", "oasKey": "", "oasExtensions": "", "id": 671652211 } ]