You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Docs: Add image and file upload handling guide for n8n workflows
- Document how clients send images (base64-encoded in messages)
- Explain token management with detail parameter (low/high/auto)
- Provide 3 common approaches for processing images in n8n
- Add practical code example for setting detail parameter
- Clarify that bridge passes through, n8n handles processing
Related to: #46
Copy file name to clipboardExpand all lines: docs/N8N_SETUP.md
+83Lines changed: 83 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -150,6 +150,89 @@ Webhook → Extract Chat Body → AI Agent → (Response)
150
150
151
151
The Webhook node receives the entire HTTP request in `$json`, with the actual chat data nested in `$json.body`. The "Extract Chat Body" node (a Set node) extracts this nested data and flattens it, making fields like `chatInput` and `sessionId` directly accessible to the AI Agent.
152
152
153
+
## Handling Images and File Uploads
154
+
155
+
The bridge passes file uploads and images through to n8n as-is. Your workflow must handle image extraction and processing.
156
+
157
+
### How Clients Send Images
158
+
159
+
Clients like LibreChat and Open-webUI send images embedded in the message content as base64-encoded data:
160
+
161
+
```json
162
+
{
163
+
"messages": [
164
+
{
165
+
"role": "user",
166
+
"content": [
167
+
{"type": "text", "text": "What's in this image?"},
The `detail` parameter controls how many tokens the image uses:
184
+
185
+
-`"low"` - 65 tokens per image (recommended)
186
+
-`"high"` - 65-765 tokens depending on image size
187
+
-`"auto"` - LLM provider decides (default, usually "high")
188
+
189
+
**Important:** If clients don't set `detail`, images may consume 500+ tokens and cause "too many tokens" errors. You can add the `detail` parameter in your n8n workflow before passing to the LLM.
190
+
191
+
### Processing Images in n8n
192
+
193
+
Your workflow needs to extract and handle images from the `messages` array. Common approaches:
194
+
195
+
**Option 1: Pass through to LLM (if supported)**
196
+
- Extract entire `messages` array
197
+
- Forward to LLM that supports vision (GPT-4V, Claude 3, etc.)
198
+
- Ensure `detail: "low"` is set to avoid token issues
199
+
200
+
**Option 2: Upload to storage**
201
+
- Extract base64 image data
202
+
- Upload to S3, Cloudinary, or similar
203
+
- Replace base64 with public URL
204
+
- Forward modified messages to LLM
205
+
206
+
**Option 3: Process locally**
207
+
- Extract image for analysis
208
+
- Use separate vision API/service
209
+
- Combine results with chat response
210
+
211
+
### Example: Setting detail Parameter in n8n
212
+
213
+
Use a Code node to ensure all images use `detail: "low"`:
0 commit comments