懂得AI

Command Palette

Search for a command to run...

Developer Docs

OpenClaw API Reference

OpenClaw provides an OpenAI-compatible REST API — use existing OpenAI SDKs directly

Quick Start

from openai import OpenAI

# OpenClaw 兼容 OpenAI SDK,只需修改 base_url
client = OpenAI(
    api_key="oc_sk_xxxxxxxxxxxx",
    base_url="https://your-openclaw.example.com/api/v1"
)

response = client.chat.completions.create(
    model="gpt-4o",
    messages=[
        {"role": "system", "content": "你是一个有帮助的助手。"},
        {"role": "user", "content": "用 Python 写一个快速排序"},
    ],
)

print(response.choices[0].message.content)

Base URL

All API endpoints are relative to your OpenClaw instance URL:

https://your-openclaw.example.com/api/v1

Authentication

All API requests require an API Key in the Authorization header.

Chat

Core chat endpoints supporting streaming and non-streaming responses.

Skills

Query, install, and manage OpenClaw skills.

Workflows

Create and manage automation workflows.

Webhooks

Configure webhooks to receive OpenClaw event notifications.

API docs are continuously being improved. More endpoints and SDK examples coming soon. For help, visit GitHub Discussions.