#setup openclaw to use librechat
16 messages · Page 1 of 1 (latest)
I'm checking the HTTP adapter behavior in source so I don't guess about tool calls or slash commands.
Yep, this should work through OpenClaw’s OpenAI-compatible Gateway surface.
Enable it in OpenClaw
{
gateway: {
http: {
endpoints: {
chatCompletions: { enabled: true },
// optional, only if you also want /v1/responses
responses: { enabled: true },
},
},
},
}
Main endpoint:
POST /v1/chat/completions
Also served on the same Gateway port:
GET /v1/modelsGET /v1/models/{id}POST /v1/embeddingsPOST /v1/responses
Docs:
- https://docs.openclaw.ai/gateway/openai-http-api
- https://docs.openclaw.ai/gateway/openresponses-http-api
- https://docs.openclaw.ai/gateway/configuration-reference
Auth
Use normal Gateway auth:
Authorization: Bearer <token-or-password>
- token from
gateway.auth.token/OPENCLAW_GATEWAY_TOKEN - password from
gateway.auth.password/OPENCLAW_GATEWAY_PASSWORD
Important caveat: this is effectively an operator-level endpoint, so keep it on private ingress only.
LibreChat side
LibreChat custom endpoints are the right fit. Point it at the OpenClaw /v1 base URL, not the full /chat/completions path.
Example librechat.yaml:
endpoints:
custom:
- name: "OpenClaw"
apiKey: "${OPENCLAW_GATEWAY_TOKEN}"
baseURL: "http://<gateway-host>:<port>/v1"
models:
default: ["openclaw/default"]
fetch: true
modelDisplayLabel: "OpenClaw"
Notes:
- LibreChat custom endpoint docs say it appends
/chat/completionsby default, so/v1is the right base. GET /v1/modelsshould returnopenclaw,openclaw/default, andopenclaw/<agentId>.- In OpenClaw, the OpenAI
modelfield is agent selection, not backend provider model selection.
So use:
openclaw/default, oropenclaw/<agentId>
How it behaves in practice
- LibreChat will most likely use
GET /v1/modelsplusPOST /v1/chat/completions.
- OpenClaw executes that as a normal agent run internally.
- So the selected agent can still use its own tools, policies, and routing.
But for your specific questions:
-
Slash commands?
Probably no, not as OpenClaw slash commands. Those are native OpenClaw/chat-surface features, not part of the OpenAI-compatible HTTP API. -
See tool calls?
ForPOST /v1/chat/completions, also probably no. The compat endpoint returns normal assistant text, not OpenClaw’s internal tool trace. So LibreChat should behave more like a standard chat frontend than an OpenClaw-native UI. -
What about
/v1/responses?
OpenClaw does support it, and that endpoint does support client-side function tools /function_callitems. But I did not find evidence that LibreChat custom endpoints use/v1/responsesby default. Their custom endpoint docs describe the/chat/completionsflow.
So my recommendation is:
- Enable
gateway.http.endpoints.chatCompletions.enabled: true
- Point LibreChat custom endpoint to
http://<gateway-host>:<port>/v1 - Use
openclaw/defaultas the model - Expect working chat through OpenClaw agents, but not native OpenClaw slash-command UX or full internal tool-call visibility
If you want, I can also sketch a complete OpenClaw + LibreChat config example for Docker or bare metal.
How about librechat params titleModel, if I have openrouter setup as another provider in librechat, can I use that instead of openclaw for titleModel?
I'll verify the titleModel / titleEndpoint behavior in LibreChat docs so I can give you the exact answer.
Yes, but not with titleModel alone.
If your OpenClaw custom endpoint is the chat endpoint, then:
titleModelby itself uses the same endpoint- so if you want titles generated by OpenRouter instead of OpenClaw, set
titleEndpointto your OpenRouter custom endpoint name, then settitleModelto an OpenRouter model
Example:
endpoints:
custom:
- name: "OpenClaw"
apiKey: "${OPENCLAW_GATEWAY_TOKEN}"
baseURL: "http://<gateway-host>:<port>/v1"
models:
default: ["openclaw/default"]
fetch: true
titleConvo: true
titleEndpoint: "OpenRouter"
titleModel: "openai/gpt-4o-mini"
- name: "OpenRouter"
apiKey: "${OPENROUTER_KEY}"
baseURL: "https://openrouter.ai/api/v1"
models:
fetch: true
default: ["openai/gpt-4o-mini"]
So the rule is:
- same endpoint for titles → just set
titleModel - different provider/endpoint for titles → set both
titleEndpoint+titleModel
LibreChat docs mention exactly this “use a different custom endpoint for titles” pattern:
https://www.librechat.ai/docs/configuration/librechat_yaml/object_structure/custom_endpoint
If you want, I can write the full LibreChat config block for:
- OpenClaw for chats
- OpenRouter for titles
- and optionally OpenRouter for summaries too