Free AI with text and vision driven from n8n

    Shared 11/15/2025

    12 views

    Visual Workflow

    JSON Code

    {
      "id": "fFHBEZ8uAsH809FS",
      "meta": {
        "instanceId": "3be2cd5d529060b43e6442ab28cc06e233c68dbf9b52947f101f866a0608d320"
      },
      "name": "My workflow",
      "tags": [],
      "nodes": [
        {
          "id": "b9ff7285-059c-40b5-887e-6e59ae4c28d9",
          "name": "When clicking ‘Execute workflow’",
          "type": "n8n-nodes-base.manualTrigger",
          "position": [
            -32,
            -64
          ],
          "parameters": {},
          "typeVersion": 1
        },
        {
          "id": "b44989ba-338b-4333-aff1-b9b78c64a84c",
          "name": "HTTP Request",
          "type": "n8n-nodes-base.httpRequest",
          "position": [
            800,
            -64
          ],
          "parameters": {
            "url": "http://anythingllm:3001/api/v1/openai/chat/completions",
            "method": "POST",
            "options": {},
            "jsonBody": "={\n  \"messages\": [\n    {\n      \"role\": \"user\",\n      \"content\": [\n        {\n          \"type\": \"text\",\n          \"text\": \"The image is a receipt. Extract from it the total, taxes, storeName and also based on the receipt assign a category to the receipt. Return a JSON object with these fields [total, taxes, storeName, category]\"\n        },\n        {\n          \"type\": \"image_url\",\n          \"image_url\": {\n            \"url\": \"data:image/jpg;base64,data:image/png;base64,{{ $json.data }}\"\n          }\n\n\n        }\n      ]\n    }\n  ],\n  \"model\": \"anythingllm\",\n  \"stream\": false,\n  \"temperature\": 0.7\n}",
            "sendBody": true,
            "sendHeaders": true,
            "specifyBody": "json",
            "headerParameters": {
              "parameters": [
                {
                  "name": "accept",
                  "value": "*/*"
                },
                {
                  "name": "Authorization",
                  "value": "Bearer 2VD0PVT-QM7M3QK-PAJXBRC-R0SZ4A2"
                }
              ]
            }
          },
          "typeVersion": 4.2
        },
        {
          "id": "89be95b9-e506-46d3-9781-033749affe48",
          "name": "Read/Write Files from Disk",
          "type": "n8n-nodes-base.readWriteFile",
          "position": [
            240,
            -64
          ],
          "parameters": {
            "options": {
              "mimeType": ""
            },
            "fileSelector": "/data/shared/*.jpg"
          },
          "typeVersion": 1,
          "alwaysOutputData": false
        },
        {
          "id": "5a07fd32-51d4-4ff1-97bd-ea902608e691",
          "name": "Extract from File",
          "type": "n8n-nodes-base.extractFromFile",
          "position": [
            528,
            -64
          ],
          "parameters": {
            "options": {},
            "operation": "binaryToPropery",
            "binaryPropertyName": "=data"
          },
          "typeVersion": 1
        },
        {
          "id": "256f1604-ef0f-46e0-8743-1a52e07fc3d3",
          "name": "Convert to File",
          "type": "n8n-nodes-base.convertToFile",
          "position": [
            1248,
            -64
          ],
          "parameters": {
            "options": {},
            "operation": "xlsx",
            "binaryPropertyName": "=data {{ $json.choices[0].message.content }}"
          },
          "typeVersion": 1.1
        },
        {
          "id": "2f4aad16-ca46-4906-a547-4faa2b412279",
          "name": "Code in JavaScript",
          "type": "n8n-nodes-base.code",
          "position": [
            1024,
            -64
          ],
          "parameters": {
            "jsCode": "let response = []\n// Get the input value (assuming the string is in the 'data' field)\nfor (const item of $input.all()) {\n  const jsonString = item.json.choices[0].message.content;\n  $input.first().json.choices\n  // 1. Clean the string: Remove the leading/trailing \"```json\\n\" and \"\\n```\"\n  const cleanedString = jsonString\n    .replace(\"```json\\n\", \"\")\n    .replace(\"\\n```\", \"\");\n\n  // 2. Parse the cleaned string into a proper JSON object\n  const parsedObject = JSON.parse(cleanedString);\n  response.push(parsedObject)\n}\n\n// 3. Return the parsed object as the output item\nreturn response;"
          },
          "typeVersion": 2
        }
      ],
      "active": false,
      "pinData": {},
      "settings": {
        "executionOrder": "v1"
      },
      "versionId": "79eb64e4-b94a-448c-8f26-2126271fe171",
      "connections": {
        "HTTP Request": {
          "main": [
            [
              {
                "node": "Code in JavaScript",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Convert to File": {
          "main": [
            []
          ]
        },
        "Extract from File": {
          "main": [
            [
              {
                "node": "HTTP Request",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Code in JavaScript": {
          "main": [
            [
              {
                "node": "Convert to File",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "Read/Write Files from Disk": {
          "main": [
            [
              {
                "node": "Extract from File",
                "type": "main",
                "index": 0
              }
            ]
          ]
        },
        "When clicking ‘Execute workflow’": {
          "main": [
            [
              {
                "node": "Read/Write Files from Disk",
                "type": "main",
                "index": 0
              }
            ]
          ]
        }
      }
    }