Molta is a lightweight HTTP gateway that forwards OpenAI-style v1/chat/completions requests to a local OpenClaw (ClawdBot) gateway over WebSocket and returns compatible responses, so you can use MoltBot in existing clients.
- OpenAI-style endpoints:
/v1/chat/completions,/v1/models - Built-in auth: Bearer token via
TOKEN - Streaming responses (SSE)
- Session reuse + quick new-session command
Requires Node.js 20+ (for local dev or npm install)
npm i -g molta
moltadocker run --rm -p 8090:8090 \
-e TOKEN="<Your token>" \
-e CLAWD_TOKEN="<Your Clawd Token>" \
-e CLAWD_HOST="<Clawd host>" \
-e CLAWD_PORT=<Clawd port> \
ghcr.io/ve-ria/molta:latestyarn install
yarn devDefault listening address: http://127.0.0.1:8090.
Molta reads .env in the current directory and validates it (see schema.json).
Required:
TOKEN: HTTP auth tokenCLAWD_TOKEN: OpenClaw gateway auth token
Optional:
HOST: bind host, defaultlocalhostPORT: bind port, default8090CLAWD_HOST: OpenClaw gateway host, defaultlocalhost- Both Molta and OpenClaw in Docker: use OpenClaw container name or IP
- Molta in Docker, OpenClaw on host: use
host.docker.internal - Both on host: use
localhost
CLAWD_PORT: OpenClaw gateway port, default18789
Example:
TOKEN="<Your token>"
HOST="127.0.0.1"
PORT=8090
CLAWD_HOST="127.0.0.1"
CLAWD_PORT=18789
CLAWD_TOKEN="<Your Clawd Token>"GET /v1/models
Example response (created is current time):
{
"object": "list",
"data": [
{
"id": "molta",
"object": "model",
"created": "2025-01-01T00:00:00.000Z",
"owned_by": "molta"
}
]
}POST /v1/chat/completions
Request body (OpenAI-compatible):
{
"model": "molta",
"messages": [
{ "role": "user", "content": "Hello" }
],
"stream": false
}Auth:
Authorization: Bearer <TOKEN>
Streaming: set stream=true to receive SSE.
- Session ID is derived from
userorid(falls back tohttp) - Send
/clawd-neworclawd-newto force a new session
yarn build
yarn startRequires Node.js 20+ (22+ recommended)
yarn build:seaOutput: dist/molta-sea (append .exe on Windows). Intermediate files in dist-sea/.
src/router/chat/completions.ts: main API logicsrc/services/gateway.ts: Clawd gateway WebSocket clientschema.json: env validation schema