提交工作流运行
curl --request POST \
--url https://www.chenyu.cn/api/open/v2/workflow/run/submit \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"workflow_id": "<string>",
"revision_id": "<string>",
"inputs": {},
"inputs.contains_real_person_material": true,
"idempotency_key": "<string>",
"accept_external_cost_risk": true
}
'import requests
url = "https://www.chenyu.cn/api/open/v2/workflow/run/submit"
payload = {
"workflow_id": "<string>",
"revision_id": "<string>",
"inputs": {},
"inputs.contains_real_person_material": True,
"idempotency_key": "<string>",
"accept_external_cost_risk": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
workflow_id: '<string>',
revision_id: '<string>',
inputs: {},
'inputs.contains_real_person_material': true,
idempotency_key: '<string>',
accept_external_cost_risk: true
})
};
fetch('https://www.chenyu.cn/api/open/v2/workflow/run/submit', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://www.chenyu.cn/api/open/v2/workflow/run/submit",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'workflow_id' => '<string>',
'revision_id' => '<string>',
'inputs' => [
],
'inputs.contains_real_person_material' => true,
'idempotency_key' => '<string>',
'accept_external_cost_risk' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://www.chenyu.cn/api/open/v2/workflow/run/submit"
payload := strings.NewReader("{\n \"workflow_id\": \"<string>\",\n \"revision_id\": \"<string>\",\n \"inputs\": {},\n \"inputs.contains_real_person_material\": true,\n \"idempotency_key\": \"<string>\",\n \"accept_external_cost_risk\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://www.chenyu.cn/api/open/v2/workflow/run/submit")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"workflow_id\": \"<string>\",\n \"revision_id\": \"<string>\",\n \"inputs\": {},\n \"inputs.contains_real_person_material\": true,\n \"idempotency_key\": \"<string>\",\n \"accept_external_cost_risk\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.chenyu.cn/api/open/v2/workflow/run/submit")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"workflow_id\": \"<string>\",\n \"revision_id\": \"<string>\",\n \"inputs\": {},\n \"inputs.contains_real_person_material\": true,\n \"idempotency_key\": \"<string>\",\n \"accept_external_cost_risk\": true\n}"
response = http.request(request)
puts response.read_body{
"code": 123,
"msg": "<string>",
"data": {
"run_order_id": "<string>",
"workflow_id": "<string>",
"revision_id": "<string>",
"quote_currency": "<string>",
"quote_amount": "<string>",
"freeze_status": "<string>",
"run_status": "<string>",
"task_id": "<string>",
"prompt_id": "<string>",
"billing_run_id": "<string>",
"idempotent_replay": true
},
"data.error": {
"reason": "<string>",
"detail": "<string>",
"engine_code": "<string>",
"status_code": 123
}
}运行管理
提交工作流运行
提交一次工作流运行任务
POST
/
api
/
open
/
v2
/
workflow
/
run
/
submit
提交工作流运行
curl --request POST \
--url https://www.chenyu.cn/api/open/v2/workflow/run/submit \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"workflow_id": "<string>",
"revision_id": "<string>",
"inputs": {},
"inputs.contains_real_person_material": true,
"idempotency_key": "<string>",
"accept_external_cost_risk": true
}
'import requests
url = "https://www.chenyu.cn/api/open/v2/workflow/run/submit"
payload = {
"workflow_id": "<string>",
"revision_id": "<string>",
"inputs": {},
"inputs.contains_real_person_material": True,
"idempotency_key": "<string>",
"accept_external_cost_risk": True
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
workflow_id: '<string>',
revision_id: '<string>',
inputs: {},
'inputs.contains_real_person_material': true,
idempotency_key: '<string>',
accept_external_cost_risk: true
})
};
fetch('https://www.chenyu.cn/api/open/v2/workflow/run/submit', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://www.chenyu.cn/api/open/v2/workflow/run/submit",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'workflow_id' => '<string>',
'revision_id' => '<string>',
'inputs' => [
],
'inputs.contains_real_person_material' => true,
'idempotency_key' => '<string>',
'accept_external_cost_risk' => true
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://www.chenyu.cn/api/open/v2/workflow/run/submit"
payload := strings.NewReader("{\n \"workflow_id\": \"<string>\",\n \"revision_id\": \"<string>\",\n \"inputs\": {},\n \"inputs.contains_real_person_material\": true,\n \"idempotency_key\": \"<string>\",\n \"accept_external_cost_risk\": true\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://www.chenyu.cn/api/open/v2/workflow/run/submit")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"workflow_id\": \"<string>\",\n \"revision_id\": \"<string>\",\n \"inputs\": {},\n \"inputs.contains_real_person_material\": true,\n \"idempotency_key\": \"<string>\",\n \"accept_external_cost_risk\": true\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://www.chenyu.cn/api/open/v2/workflow/run/submit")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"workflow_id\": \"<string>\",\n \"revision_id\": \"<string>\",\n \"inputs\": {},\n \"inputs.contains_real_person_material\": true,\n \"idempotency_key\": \"<string>\",\n \"accept_external_cost_risk\": true\n}"
response = http.request(request)
puts response.read_body{
"code": 123,
"msg": "<string>",
"data": {
"run_order_id": "<string>",
"workflow_id": "<string>",
"revision_id": "<string>",
"quote_currency": "<string>",
"quote_amount": "<string>",
"freeze_status": "<string>",
"run_status": "<string>",
"task_id": "<string>",
"prompt_id": "<string>",
"billing_run_id": "<string>",
"idempotent_replay": true
},
"data.error": {
"reason": "<string>",
"detail": "<string>",
"engine_code": "<string>",
"status_code": 123
}
}提交工作流运行
提交一次工作流运行任务。系统会先按工作流报价进行预扣费,任务完成后按实际消耗结算,多退少补以实际账单为准。idempotency_key 必填。同一用户、相同工作流、相同幂等键的重复请求会返回同一笔运行记录,避免网络重试造成重复提交。图片、视频、音频等普通媒体字段直接传资源字符串:公网 URL、
data:image/<format>;base64,<data> 或 asset://asset_xxx。需要声明素材角色或在提示词中引用素材时,使用 { "uri": "...", "role": "reference_image", "label": "人物A" }。本地文件建议先调用 上传工作流资源,再把返回的 asset_uri 字段值放入 inputs。请求参数
工作流 ID
工作流版本 ID。建议使用详情接口返回的
revision_id,不传时使用当前已发布版本工作流输入参数。key 来自详情接口的
editable_parameter_manifest幂等键,由调用方生成。建议使用业务订单号、请求流水号或 UUID
是否确认接受第三方模型费用风险。工作流可能产生外部模型费用时应传
true响应参数
响应码,
0 表示成功响应信息
运行提交结果
Show data
Show data
运行订单 ID。后续查询运行记录、进度、日志和输出均使用此 ID
工作流 ID
本次运行使用的版本 ID
报价币种
预扣费参考报价
预扣费状态,如
frozen运行状态,如
queued、running、succeeded、failed执行引擎任务 ID
执行引擎 prompt ID
计费运行 ID
是否为幂等重放结果
错误响应
当提交阶段调用执行引擎失败时,接口会返回一个简单原因和详细错误信息,便于定位输入参数、文件获取、实例调度或工作流执行器问题。非
0 表示失败简单失败原因
代码示例
import uuid
import requests
url = "https://www.chenyu.cn/api/open/v2/workflow/run/submit"
headers = {
"Authorization": "Bearer your_api_key",
"Content-Type": "application/json"
}
payload = {
"workflow_id": "wf_861ef31e94dcfb10e6e7",
"revision_id": "wfr_f9f2a2dcb99d73b0c3aa",
"inputs": {
"generation_category": "reference_to_video",
"model": "doubao-seedance-2-0-fast-260128",
"prompt": "@人物A cinematic portrait video",
"images": [
{
"uri": "asset://asset_reference_image",
"label": "人物A",
"role": "reference_image"
}
],
"contains_real_person_material": true,
"resolution": "720p",
"duration": "5"
},
"idempotency_key": str(uuid.uuid4()),
"accept_external_cost_risk": False
}
response = requests.post(url, headers=headers, json=payload)
print(response.json())
const axios = require('axios');
const crypto = require('crypto');
axios.post('https://www.chenyu.cn/api/open/v2/workflow/run/submit', {
workflow_id: 'wf_861ef31e94dcfb10e6e7',
revision_id: 'wfr_f9f2a2dcb99d73b0c3aa',
inputs: {
generation_category: 'reference_to_video',
model: 'doubao-seedance-2-0-fast-260128',
prompt: '@人物A cinematic portrait video',
images: [{
uri: 'asset://asset_reference_image',
label: '人物A',
role: 'reference_image'
}],
contains_real_person_material: true,
resolution: '720p',
duration: '5'
},
idempotency_key: crypto.randomUUID(),
accept_external_cost_risk: false
}, {
headers: {
Authorization: 'Bearer your_api_key',
'Content-Type': 'application/json'
}
}).then((response) => {
console.log(response.data);
});
curl -X POST "https://www.chenyu.cn/api/open/v2/workflow/run/submit" \
-H "Authorization: Bearer your_api_key" \
-H "Content-Type: application/json" \
-d '{
"workflow_id": "wf_861ef31e94dcfb10e6e7",
"revision_id": "wfr_f9f2a2dcb99d73b0c3aa",
"inputs": {
"generation_category": "reference_to_video",
"model": "doubao-seedance-2-0-fast-260128",
"prompt": "@人物A cinematic portrait video",
"images": [
{
"uri": "asset://asset_reference_image",
"label": "人物A",
"role": "reference_image"
}
],
"contains_real_person_material": true,
"resolution": "720p",
"duration": "5"
},
"idempotency_key": "run_20260508_001",
"accept_external_cost_risk": false
}'
提示词引用素材
历史 Seedance 工作流或外部视频模型工作流支持在inputs 的资源对象中传 label,并在 inputs.prompt 中使用 @label 指向该素材。
{
"workflow_id": "wf_xxx",
"revision_id": "wfr_xxx",
"idempotency_key": "run_20260613_ref_001",
"inputs": {
"generation_category": "reference_to_video",
"model": "doubao-seedance-2-0-fast-260128",
"prompt": "@阿九 携手 @沈渡 跳舞",
"images": [
{
"uri": "asset://asset_a252553f9364ad0fa635cb7c48793491",
"label": "阿九",
"role": "reference_image"
},
{
"uri": "asset://asset_cf7584e3e836a2b3ee65ef072a71fdd6",
"label": "沈渡",
"role": "reference_image"
}
],
"duration": 5,
"resolution": "720p",
"ratio": "16:9"
}
}
label建议直接写显示名,例如阿九,不需要带@prompt中写@阿九,也兼容{{阿九}}和{{ 阿九 }}- 同一个请求里
label不能重复 - 服务端会把自定义标签绑定到当前请求中的资源顺序,例如图片会映射为上游需要的
@图1、@图2
响应示例
{
"code": 0,
"msg": "提交成功",
"data": {
"run_order_id": "wfrun_314ff7d8b7a5beff1388",
"workflow_id": "wf_861ef31e94dcfb10e6e7",
"revision_id": "wfr_f9f2a2dcb99d73b0c3aa",
"quote_currency": "CNY",
"quote_amount": "0.03000000",
"freeze_status": "frozen",
"run_status": "queued",
"task_id": "task_1778147626528703038_eb84d292e0851c08",
"prompt_id": "prompt_1778147626528707364_b0c0687e49d1f72f",
"billing_run_id": "wfbill_1778147626528703038",
"idempotent_replay": false
}
}
错误示例
{
"code": 1,
"msg": "Workflow input content is invalid.",
"data": {
"error": {
"reason": "Workflow input content is invalid.",
"detail": "input n4_video must be an uploaded file URL or file id",
"engine_code": "INVALID_WORKFLOW_INPUT",
"status_code": 400
}
}
}
⌘I