Update nexus wiki content
This commit is contained in:
44
wiki/concepts/HTTP-ChatCompletions.md
Normal file
44
wiki/concepts/HTTP-ChatCompletions.md
Normal file
@@ -0,0 +1,44 @@
|
||||
---
|
||||
title: "HTTP-ChatCompletions"
|
||||
type: concept
|
||||
tags: []
|
||||
---
|
||||
|
||||
## Definition
|
||||
HTTP-ChatCompletions 是通过 HTTP 协议调用 AI 模型 Chat Completions 接口的模式,是 [[OpenAI-Compatible-API]] 的底层传输机制。
|
||||
|
||||
## Architecture
|
||||
```
|
||||
Client (n8n HTTP Request)
|
||||
│
|
||||
▼
|
||||
POST /v1/chat/completions
|
||||
Content-Type: application/json
|
||||
Authorization: Bearer <token>
|
||||
│
|
||||
▼
|
||||
{
|
||||
"model": "openclaw:main",
|
||||
"messages": [...]
|
||||
}
|
||||
│
|
||||
▼
|
||||
AI Gateway (OpenClaw Gateway)
|
||||
│
|
||||
▼
|
||||
Agent Response
|
||||
```
|
||||
|
||||
## Key Fields
|
||||
- `model`:指定要调用的 Agent ID
|
||||
- `messages`:对话历史,格式为 `[{role, content}]`
|
||||
- `Authorization`:Bearer Token 认证
|
||||
|
||||
## 与 WebSocket 的区别
|
||||
- HTTP:同步请求-响应,适合 n8n 等工作流工具
|
||||
- WebSocket:长连接双向通信,适合实时对话界面
|
||||
|
||||
## Related
|
||||
- [[OpenAI-Compatible-API]] 依赖此机制
|
||||
- [[OpenClaw]] Gateway 提供此端点
|
||||
- [[n8n]] 通过 HTTP Request 节点调用
|
||||
Reference in New Issue
Block a user