Install
openclaw skills install coze-workflow-api在 OpenClaw 中调用 Coze Workflow API (stream_run)。 **使用场景:** 1. 用户需要调用 Coze workflow 执行特定任务 2. 需要提供 workflow_id、parameters、PAT Key 3. 处理流式响应结果 **触发关键词:** coze workflow、调用 workflow、运行 workflow、coze 工作流
openclaw skills install coze-workflow-api直接在 OpenClaw 中调用 Coze Workflow API。
设置 PAT Key 环境变量:
export COZE_PAT_KEY="your_pat_token_here"
curl -s --location --request POST 'https://api.coze.com/v1/workflow/stream_run' \
--header "Authorization: Bearer $COZE_PAT_KEY" \
--header 'Content-Type: application/json' \
--data-raw '{
"workflow_id": "your_workflow_id",
"parameters": {
"key": "value"
}
}' \
--max-time 120
curl -s --location --request POST 'https://api.coze.com/v1/workflow/stream_run' \
--header "Authorization: Bearer $COZE_PAT_KEY" \
--header 'Content-Type: application/json' \
--data-raw '{
"workflow_id": "your_workflow_id",
"parameters": {
"key": "value"
}
}' \
--max-time 120 > /tmp/coze_result.txt
| 参数 | 位置 | 说明 |
|---|---|---|
workflow_id | data-raw | Coze Workflow ID |
parameters | data-raw | Workflow 输入参数 (JSON 对象) |
COZE_PAT_KEY | header | PAT Token,通过环境变量传入 |
export COZE_PAT_KEY="your_pat_token_here"
curl -s --location --request POST 'https://api.coze.com/v1/workflow/stream_run' \
--header "Authorization: Bearer $COZE_PAT_KEY" \
--header 'Content-Type: application/json' \
--data-raw '{
"workflow_id": "7566546276516642834",
"parameters": {
"id": "1859150663345201",
"id_type": "creative"
}
}' \
--max-time 120
流式响应,每行一个事件:
id: 0
event: PING
data: {...}
id: 1
event: Message
data: {"content":"...","node_type":"End",...}
id: 2
event: Done
data: {"debug_url":"..."}
关键字段:
event: Message - 包含 workflow 执行结果event: Done - 执行完成node_type: End - 结束节点--max-time 120