chore: Run pnpm format:fix.

This commit is contained in:
cpojer
2026-01-31 21:13:13 +09:00
parent dcc2de15a6
commit 8cab78abbc
624 changed files with 10729 additions and 7514 deletions

View File

@@ -3,6 +3,7 @@ summary: "Expose an OpenAI-compatible /v1/chat/completions HTTP endpoint from th
read_when:
- Integrating tools that expect OpenAI Chat Completions
---
# OpenAI Chat Completions (HTTP)
OpenClaws Gateway can serve a small OpenAI-compatible Chat Completions endpoint.
@@ -21,6 +22,7 @@ Uses the Gateway auth configuration. Send a bearer token:
- `Authorization: Bearer <token>`
Notes:
- 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`).
@@ -36,6 +38,7 @@ Or target a specific OpenClaw agent by header:
- `x-openclaw-agent-id: <agentId>` (default: `main`)
Advanced:
- `x-openclaw-session-key: <sessionKey>` to fully control session routing.
## Enabling the endpoint
@@ -47,10 +50,10 @@ Set `gateway.http.endpoints.chatCompletions.enabled` to `true`:
gateway: {
http: {
endpoints: {
chatCompletions: { enabled: true }
}
}
}
chatCompletions: { enabled: true },
},
},
},
}
```
@@ -63,10 +66,10 @@ Set `gateway.http.endpoints.chatCompletions.enabled` to `false`:
gateway: {
http: {
endpoints: {
chatCompletions: { enabled: false }
}
}
}
chatCompletions: { enabled: false },
},
},
},
}
```
@@ -87,6 +90,7 @@ Set `stream: true` to receive Server-Sent Events (SSE):
## Examples
Non-streaming:
```bash
curl -sS http://127.0.0.1:18789/v1/chat/completions \
-H 'Authorization: Bearer YOUR_TOKEN' \
@@ -99,6 +103,7 @@ curl -sS http://127.0.0.1:18789/v1/chat/completions \
```
Streaming:
```bash
curl -N http://127.0.0.1:18789/v1/chat/completions \
-H 'Authorization: Bearer YOUR_TOKEN' \