proxy-playbook/docs/WORKBUDDY_PROTOCOL.md

43 lines
1018 B
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# WorkBuddy 上游协议
## 端点
| 地区 | 主机 |
|---|---|
| CN | https://copilot.tencent.com/v2/chat/completions |
| INTL | https://www.workbuddy.ai(同路径 /v2/chat/completions) |
## 请求头
Authorization: Bearer <accessToken>
Origin: https://www.codebuddy.cn // CN
Content-Type: application/json
Accept: text/event-stream // stream 时
## Body
基本就是 OpenAI 兼容格式透传,这也是 WorkBuddy 适配器比 Trae 简单很多的原因:
{
"model": "glm-5.2",
"stream": true,
"messages": [
{"role": "user", "content": "你好"}
],
"max_tokens": 4096
}
## SSE 响应
上游返回的就是 OpenAI 风格的 SSE:
data: {"choices":[{"delta":{"content":"你"}}]}
data: {"choices":[{"delta":{"content":"好"}}]}
data: {"choices":[{"delta":{},"finish_reason":"stop"}],"usage":{...}}
data: [DONE]
所以 WorkBuddy 可以直接字节流透传,客户端能直接解析。