mirror of
https://github.com/openclaw/openclaw.git
synced 2026-03-30 04:55:44 +00:00
refactor: rename to openclaw
This commit is contained in:
@@ -5,14 +5,14 @@ read_when:
|
||||
---
|
||||
# OpenAI Chat Completions (HTTP)
|
||||
|
||||
Moltbot’s Gateway can serve a small OpenAI-compatible Chat Completions endpoint.
|
||||
OpenClaw’s Gateway can serve a small OpenAI-compatible Chat Completions endpoint.
|
||||
|
||||
This endpoint is **disabled by default**. Enable it in config first.
|
||||
|
||||
- `POST /v1/chat/completions`
|
||||
- Same port as the Gateway (WS + HTTP multiplex): `http://<gateway-host>:<port>/v1/chat/completions`
|
||||
|
||||
Under the hood, requests are executed as a normal Gateway agent run (same codepath as `moltbot agent`), so routing/permissions/config match your Gateway.
|
||||
Under the hood, requests are executed as a normal Gateway agent run (same codepath as `openclaw agent`), so routing/permissions/config match your Gateway.
|
||||
|
||||
## Authentication
|
||||
|
||||
@@ -21,22 +21,22 @@ Uses the Gateway auth configuration. Send a bearer token:
|
||||
- `Authorization: Bearer <token>`
|
||||
|
||||
Notes:
|
||||
- When `gateway.auth.mode="token"`, use `gateway.auth.token` (or `CLAWDBOT_GATEWAY_TOKEN`).
|
||||
- When `gateway.auth.mode="password"`, use `gateway.auth.password` (or `CLAWDBOT_GATEWAY_PASSWORD`).
|
||||
- When `gateway.auth.mode="token"`, use `gateway.auth.token` (or `OPENCLAW_GATEWAY_TOKEN`).
|
||||
- When `gateway.auth.mode="password"`, use `gateway.auth.password` (or `OPENCLAW_GATEWAY_PASSWORD`).
|
||||
|
||||
## Choosing an agent
|
||||
|
||||
No custom headers required: encode the agent id in the OpenAI `model` field:
|
||||
|
||||
- `model: "moltbot:<agentId>"` (example: `"moltbot:main"`, `"moltbot:beta"`)
|
||||
- `model: "openclaw:<agentId>"` (example: `"openclaw:main"`, `"openclaw:beta"`)
|
||||
- `model: "agent:<agentId>"` (alias)
|
||||
|
||||
Or target a specific Moltbot agent by header:
|
||||
Or target a specific OpenClaw agent by header:
|
||||
|
||||
- `x-moltbot-agent-id: <agentId>` (default: `main`)
|
||||
- `x-openclaw-agent-id: <agentId>` (default: `main`)
|
||||
|
||||
Advanced:
|
||||
- `x-moltbot-session-key: <sessionKey>` to fully control session routing.
|
||||
- `x-openclaw-session-key: <sessionKey>` to fully control session routing.
|
||||
|
||||
## Enabling the endpoint
|
||||
|
||||
@@ -91,9 +91,9 @@ Non-streaming:
|
||||
curl -sS http://127.0.0.1:18789/v1/chat/completions \
|
||||
-H 'Authorization: Bearer YOUR_TOKEN' \
|
||||
-H 'Content-Type: application/json' \
|
||||
-H 'x-moltbot-agent-id: main' \
|
||||
-H 'x-openclaw-agent-id: main' \
|
||||
-d '{
|
||||
"model": "moltbot",
|
||||
"model": "openclaw",
|
||||
"messages": [{"role":"user","content":"hi"}]
|
||||
}'
|
||||
```
|
||||
@@ -103,9 +103,9 @@ Streaming:
|
||||
curl -N http://127.0.0.1:18789/v1/chat/completions \
|
||||
-H 'Authorization: Bearer YOUR_TOKEN' \
|
||||
-H 'Content-Type: application/json' \
|
||||
-H 'x-moltbot-agent-id: main' \
|
||||
-H 'x-openclaw-agent-id: main' \
|
||||
-d '{
|
||||
"model": "moltbot",
|
||||
"model": "openclaw",
|
||||
"stream": true,
|
||||
"messages": [{"role":"user","content":"hi"}]
|
||||
}'
|
||||
|
||||
Reference in New Issue
Block a user