SSE 流式对话。省略 session_id 会新建会话。传入的会话不存在时,在调用模型前返回 404。max_iterations 取 0 到 300,0 使用配置默认值。
| 字段 | 说明 |
|---|---|
message | 用户文本。插件命令写成 /plugin:command args 时,会在内置斜杠路由之前按原样展开。 |
session_id | 可选。已有会话必须存在。 |
stream | 这个端点本身就是 SSE。 |
max_iterations | 0–300。 |
auto_approve | 是否自动批准本轮工具。 |
metadata | 调用方附加对象,例如 {"source":"http"}。 |
attachments | 先用上传接口拿到附件对象,再放进这个数组。WebSocket 单帧上限 64 KiB,文件字节不要直接塞进消息。 |
curl -N http://127.0.0.1:9090/api/v1/chat \
-H 'Content-Type: application/json' \
-H 'X-API-Key: <key>' \
-d '{"message":"hello","max_iterations":8}'
run_id、event_id 和 id:。失败帧含字符串 error、error_code 和 status:"failed",后面不再跟成功的 complete。取消是 type:"cancelled"。只有完整结束的一轮才是 complete 且 status:"completed"。SSE 不重放持久游标,再次 POST 会开新一轮。