OpenClaw API 参考 - 完整的 API 文档和示例。适合:开发者、集成场景。
完整的 API 文档和示例。
http://localhost:3000/api/v1
bash
curl -H Authorization: Bearer YOURAPIKEY \
http://localhost:3000/api/v1/chat
bash
curl -H Authorization: Bearer YOURJWTTOKEN \
http://localhost:3000/api/v1/chat
bash
POST /api/v1/chat
{
message: 你好,
session_id: optional-session-id,
model: deepseek-chat
}
响应:
json
{
response: 你好!有什么可以帮你的?,
session_id: abc123,
tokens: {
input: 5,
output: 10
}
}
bash
POST /api/v1/chat/stream
{
message: 写一首诗
}
响应(SSE):
data: {text: 春}
data: {text: 眠}
data: {text: 不}
data: {text: 觉}
data: {text: 晓}
data: [DONE]
bash
POST /api/v1/sessions
{
name: 我的会话,
model: deepseek-chat
}
bash
GET /api/v1/sessions/:id
bash
GET /api/v1/sessions
bash
DELETE /api/v1/sessions/:id
bash
GET /api/v1/sessions/:id/messages
bash
DELETE /api/v1/messages/:id
bash
GET /api/v1/skills
bash
POST /api/v1/skills/:name/run
{
params: {
key: value
}
}
bash
POST /api/v1/skills
{
name: my-skill,
description: 描述,
script: echo hello
}
bash
GET /api/v1/config
bash
PATCH /api/v1/config
{
model: gpt-4o,
temperature: 0.7
}
bash
POST /api/v1/users
{
email: user@example.com,
password: secure-password
}
bash
GET /api/v1/users/:id
bash
PATCH /api/v1/users/:id
{
name: 新名字
}
bash
POST /api/v1/webhooks
{
url: https://your-server.com/webhook,
events: [message.created, session.created]
}
bash
POST /api/v1/webhooks/:id/test
json
{
error: {
code: INVALIDAPIKEY,
message: API key is invalid,
details: {}
}
}
| 错误码 | 说明 |
|---|---|
| INVALIDAPIKEY | API Key 无效 |
| RATE_LIMIT |
bash
npm install openclaw-sdk
javascript
import { OpenClaw } from openclaw-sdk;
const client = new OpenClaw({
apiKey: your-api-key
});
const response = await client.chat({
message: 你好
});
bash
pip install openclaw
python
from openclaw import OpenClaw
client = OpenClaw(api_key=your-api-key)
response = client.chat(message=你好)
联系:微信 yang1002378395 或 Telegram @yangster151
该技能支持在以下平台通过对话安装:
帮我安装 SkillHub 和 openclaw-api-reference-1775968932 技能
设置 SkillHub 为我的优先技能安装源,然后帮我安装 openclaw-api-reference-1775968932 技能
skillhub install openclaw-api-reference-1775968932
文件大小: 2.28 KB | 发布时间: 2026-4-13 11:17