Dify Integration — Image Generation in AI Workflows
Generate images from HTML in Dify workflows using the HTTP Request node. Add image generation to any AI agent or chatflow.
Dify is an open-source platform for building AI agents and workflows. Use the HTTP Request node to call the RendShot API directly — no custom plugin needed.
Prerequisites
- A RendShot API key (get one free)
- A Dify workspace (cloud or self-hosted)
Step 1: Add HTTP Request Node
In your Dify workflow editor:
- Drag an HTTP Request node onto the canvas
- Configure it:
| Setting | Value |
|---|---|
| Method | POST |
| URL | https://api.rendshot.ai/v1/image |
| Auth Type | Bearer |
| Bearer Token | Your RendShot API key (rs_live_...) |
| Body Type | JSON |
Step 2: Configure the Request Body
Set the JSON body with your HTML template and dimensions:
{
"template_id": "blog-cover",
"variables": {
"title": "{{#node_id.title#}}",
"author": "{{#node_id.author#}}"
},
"width": 1200,
"height": 630,
"format": "png"
}Dify uses {{#node_id.field#}} syntax to reference variables from upstream nodes. Replace node_id with the actual ID of the node providing your data (e.g., a Start node, LLM node, or Code node).
Using raw HTML instead of templates
If you don't have a pre-saved template, pass HTML directly:
{
"html": "<div style=\"background:#1a1816;color:white;padding:40px;font-family:Inter\"><h1>{{#start.title#}}</h1><p>By {{#start.author#}}</p></div>",
"width": 1200,
"height": 630
}Step 3: Extract the Image URL
The RendShot API returns:
{
"url": "https://assets.rendshot.ai/img/abc123.png",
"id": "img_abc123",
"format": "png",
"width": 1200,
"height": 630
}In the HTTP Request node's output, access {{#http_node.body.url#}} to get the CDN image URL. Pass it to the next node in your workflow.
Example Workflows
AI blog cover generator
Start (user inputs title + topic)
→ LLM node: Generate a blog subtitle from the topic
→ HTTP Request: RendShot renders cover image with title + subtitle
→ Answer: Return the image URL to the userCustomer support with visual responses
User message
→ LLM classifies intent
→ IF "product question":
→ HTTP Request: RendShot renders product info card
→ Answer with image
→ ELSE:
→ Answer with textBatch content generation
Iteration node (loop over article list)
→ HTTP Request: RendShot generates OG image per article
→ HTTP Request: Update CMS with image URLURL Screenshots
To capture a live webpage instead of rendering HTML, use the screenshot endpoint:
| Setting | Value |
|---|---|
| URL | https://api.rendshot.ai/v1/screenshot |
| Body | {"url": "https://example.com", "width": 1280, "height": 720} |
Advanced: Error Handling
Dify's HTTP Request node supports error handling paths. Configure:
- Retry: Up to 10 attempts with configurable intervals
- Error branch: Route to an alternative path if the API returns an error
- Timeout: Set connect/read timeouts (default is usually sufficient for RendShot's sub-second rendering)
Troubleshooting
| Issue | Fix |
|---|---|
| 401 Unauthorized | Check Bearer token — must be the full rs_live_... key |
| Empty response body | Ensure Body Type is set to JSON, not Form Data |
| Variable not resolved | Verify {{#node_id.field#}} syntax — node ID must match exactly |
| Image not showing in chat | Use markdown image syntax in the Answer node:  |
Next steps
- API Reference — all endpoints and parameters
- Integrations Overview — other platforms
Windmill Integration — Image Generation in Scripts & Flows
Generate images from HTML in Windmill scripts using the RendShot Python SDK or TypeScript fetch. No extra setup needed.
Coze Integration — Image Generation for AI Bots
Add image generation to Coze bots using workflow HTTP nodes or custom plugins. Generate images from HTML with RendShot.