RendShot

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:

  1. Drag an HTTP Request node onto the canvas
  2. Configure it:
SettingValue
MethodPOST
URLhttps://api.rendshot.ai/v1/image
Auth TypeBearer
Bearer TokenYour RendShot API key (rs_live_...)
Body TypeJSON

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 user

Customer 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 text

Batch content generation

Iteration node (loop over article list)
  → HTTP Request: RendShot generates OG image per article
  → HTTP Request: Update CMS with image URL

URL Screenshots

To capture a live webpage instead of rendering HTML, use the screenshot endpoint:

SettingValue
URLhttps://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

IssueFix
401 UnauthorizedCheck Bearer token — must be the full rs_live_... key
Empty response bodyEnsure Body Type is set to JSON, not Form Data
Variable not resolvedVerify {{#node_id.field#}} syntax — node ID must match exactly
Image not showing in chatUse markdown image syntax in the Answer node: ![image]({{#http.body.url#}})

Next steps

On this page