969 B
969 B
title, type, tags
| title | type | tags |
|---|---|---|
| HTTP-ChatCompletions | concept |
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 IDmessages:对话历史,格式为[{role, content}]Authorization:Bearer Token 认证
与 WebSocket 的区别
- HTTP:同步请求-响应,适合 n8n 等工作流工具
- WebSocket:长连接双向通信,适合实时对话界面
Related
- OpenAI-Compatible-API 依赖此机制
- OpenClaw Gateway 提供此端点
- n8n 通过 HTTP Request 节点调用