by sawyer-shi · v0.0.1
Connect your OpenClaw for text, skill, image and file interaction, with persistent context retention supporting both user-level and session-level conversation.【Click Details for configuration instructions】
This community listing does not yet include every recommended support, privacy, pricing, and permission disclosure. Review the available package permissions before installing.
Available inside your emploidai workspace after installation.
Available inside your emploidai workspace after installation.
A Dify tool plugin that connects Dify to a self-hosted OpenClaw Gateway through OpenClaw's OpenResponses-compatible HTTP API. It supports text chat, conversation-level and user-level context retention, Dify direct file uploads, image/document URL inputs, and interaction with OpenClaw agents and skills.
Simplified Chinese documentation is provided through Dify Marketplace multilingual README support.
GET /v1/models/v1/responses tool invocationinput_image / input_fileEdit ~/.openclaw/openclaw.json and add or merge the following gateway configuration. Replace YOUR_OPENCLAW_GATEWAY_TOKEN with your own token:
{
"gateway": {
"port": 18789,
"mode": "local",
"bind": "custom",
"customBindHost": "0.0.0.0",
"auth": {
"mode": "token",
"token": "YOUR_OPENCLAW_GATEWAY_TOKEN"
},
"http": {
"endpoints": {
"chatCompletions": { "enabled": true },
"responses": {
"enabled": true,
"maxBodyBytes": 20000000,
"maxUrlParts": 8,
"files": {
"allowUrl": true,
"allowedMimes": [
"text/plain",
"text/markdown",
"text/html",
"text/csv",
"application/json",
"application/pdf"
],
"maxBytes": 5242880
},
"images": {
"allowUrl": true,
"allowedMimes": [
"image/jpeg",
"image/png",
"image/gif",
"image/webp",
"image/heic",
"image/heif"
],
"maxBytes": 10485760
}
}
}
}
}
}
Start OpenClaw Gateway:
openclaw gateway run
Install the plugin package in Dify.
Configure provider credentials in Dify:
Base URL: OpenClaw Gateway base URLAPI Key: OpenClaw Gateway tokenModel: OpenClaw agent target such as openclaw/default or openclaw/mainTimeout: optional request timeout, default 600Choose a tool:
openclaw_chat: conversation-level contextopenclaw_user_chat: user-level contextPOST /v1/responses to interact with OpenClaw agents.GET /v1/models.files objects and forwards them as base64 inputs.session_key, conversation_id, or user_id as LLM-controllable tool parameters.openclaw_chat)Conversation-level OpenClaw context retention.
messageupload_files, image_urls, file_urlsopenclaw_user_chat)User-level OpenClaw context retention across Dify conversations.
messageupload_files, image_urls, file_urlsinput_textinput_imageinput_fileinput_imageinput_fileBefore using this plugin, enable OpenClaw Gateway HTTP endpoints.
Required endpoint:
POST /v1/responsesRecommended endpoint for Dify credential validation:
GET /v1/modelsOptional compatibility endpoint:
POST /v1/chat/completionsRecommended config for Docker Desktop or controlled private-network access:
{
"gateway": {
"port": 18789,
"mode": "local",
"bind": "custom",
"customBindHost": "0.0.0.0",
"auth": {
"mode": "token",
"token": "YOUR_OPENCLAW_GATEWAY_TOKEN"
},
"http": {
"endpoints": {
"chatCompletions": { "enabled": true },
"responses": {
"enabled": true,
"maxBodyBytes": 20000000,
"maxUrlParts": 8,
"files": {
"allowUrl": true,
"allowedMimes": [
"text/plain",
"text/markdown",
"text/html",
"text/csv",
"application/json",
"application/pdf"
],
"maxBytes": 5242880
},
"images": {
"allowUrl": true,
"allowedMimes": [
"image/jpeg",
"image/png",
"image/gif",
"image/webp",
"image/heic",
"image/heif"
],
"maxBytes": 10485760
}
}
}
}
}
}
If Dify and OpenClaw run in the same host process environment, loopback is enough:
{
"gateway": {
"port": 18789,
"mode": "local",
"bind": "loopback",
"auth": {
"mode": "token",
"token": "YOUR_OPENCLAW_GATEWAY_TOKEN"
}
}
}
Do not set gateway.bind to raw values such as "127.0.0.1", "0.0.0.0", or a LAN IP. OpenClaw accepts only these values:
"auto""lan""loopback""custom""tailnet"Use "bind": "custom" plus "customBindHost": "0.0.0.0" when Docker or another private-network runtime needs to reach the host gateway.
JSON5 still requires commas between properties. This is invalid:
{
"gateway": {
"bind": "custom",
"customBindHost": "0.0.0.0"
"auth": { "mode": "token", "token": "..." }
}
}
Use this instead:
{
"gateway": {
"bind": "custom",
"customBindHost": "0.0.0.0",
"auth": { "mode": "token", "token": "..." }
}
}
| Field | Required | Example | Description |
|---|---|---|---|
Base URL | Yes | http://127.0.0.1:18789 | OpenClaw Gateway base URL. It may include /v1; the plugin normalizes it internally. |
API Key | Yes | YOUR_OPENCLAW_GATEWAY_TOKEN | OpenClaw Gateway bearer token. |
Model | Yes | openclaw/default | OpenClaw agent target, such as openclaw/default or openclaw/main. |
Timeout | No | 600 | Request timeout in seconds. Valid range is 1-600; invalid values fall back to 600. |
Base URL examples by deployment:
| Deployment | Dify Base URL | Required OpenClaw bind |
|---|---|---|
| Same host, no Docker | http://127.0.0.1:18789 | "bind": "loopback" |
| Dify in Docker Desktop, OpenClaw on host | http://host.docker.internal:18789 | "bind": "custom", "customBindHost": "0.0.0.0" or "bind": "lan" |
| Dify on another LAN machine | http://<OpenClaw-host-LAN-IP>:18789 | "bind": "lan" or reachable "custom" bind |
| SSH tunnel | http://127.0.0.1:18789 from the tunnel endpoint | "bind": "loopback" |
If Dify reports Failed to establish a new connection or Connection refused, the Dify plugin runtime cannot reach the configured Base URL. The most common cause is using http://127.0.0.1:18789 inside Docker while OpenClaw is running on the host loopback address.
Both tools expose the same parameters.
| Parameter | Required | Form | Example | Description |
|---|---|---|---|---|
message | Yes | llm | Summarize this PDF. | Current user message sent to OpenClaw. |
upload_files | No | llm | Dify uploaded file objects | Uploaded images or documents. The plugin sends them as base64 OpenResponses parts. |
image_urls | No | llm | https://example.com/a.png | Optional image URLs, comma-separated or newline-separated. |
file_urls | No | llm | https://example.com/report.pdf | Optional document URLs, comma-separated or newline-separated. |
The plugin does not expose session routing parameters as tool inputs. OpenClaw session keys are derived from Dify runtime metadata and sent as both OpenResponses user and x-openclaw-session-key.
Supported image extensions:
.jpg.jpeg.png.gif.webp.heic.heifSupported uploaded image MIME types:
image/jpegimage/pngimage/gifimage/webpimage/heicimage/heifSupported document types:
| Extension | MIME type |
|---|---|
.txt | text/plain |
.md, .markdown | text/markdown |
.html | text/html |
.csv | text/csv |
.json | application/json |
.pdf | application/pdf |
URL validation before forwarding to OpenClaw:
http:// and https:// URLs.2048 characters.8 URLs per URL parameter.https://user:pass@example.com/file.pdf.localhost, 127.0.0.0/8, 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16, 169.254.0.0/16, ::1, and private IPv6 literals.Uploaded file validation before forwarding to OpenClaw:
8 uploaded files per tool call.size metadata before reading file bytes.10MB.5MB.12MB.Text:
message: Summarize what you can do in this OpenClaw workspace.
Image URL:
message: Analyze this screenshot.
image_urls: https://example.com/screenshot.png
Document URL:
message: Summarize this PDF and list action items.
file_urls: https://example.com/report.pdf
Direct Dify upload:
message: Summarize the uploaded files and extract action items.
upload_files: <Dify uploaded image/document files>
requirements.txtPackage from the project root:
stream=false for reliable tool execution.https://github.com/sawyer-shihttps://github.com/sawyer-shi/dify-plugins-openclaw_chatThis project is licensed under Apache License 2.0. See LICENSE file for full license text.
Ready to connect Dify with OpenClaw?