AutomationFlowsAI & RAG › Gpt-oss-20b Huggingface

Gpt-oss-20b Huggingface

GPT-OSS-20B HuggingFace. Uses chatTrigger, httpRequest. Chat trigger; 7 nodes.

Chat trigger trigger★★★★☆ complexityAI-powered7 nodesChat TriggerHTTP Request
AI & RAG Trigger: Chat trigger Nodes: 7 Complexity: ★★★★☆ AI nodes: yes Added:

This workflow follows the Chat Trigger → HTTP Request recipe pattern — see all workflows that pair these two integrations.

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "id": "gptoss20bhf00001",
  "name": "GPT-OSS-20B HuggingFace",
  "nodes": [
    {
      "parameters": {
        "options": {}
      },
      "type": "@n8n/n8n-nodes-langchain.chatTrigger",
      "typeVersion": 1.4,
      "position": [
        0,
        0
      ],
      "id": "a1b2c3d4-chat-trig-0001-abcdef000001",
      "name": "When chat message received"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://router.huggingface.co/v1/chat/completions",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "httpHeaderAuth",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify({ model: 'openai/gpt-oss-20b:groq', messages: [{ role: 'system', content: 'You are a helpful AI assistant. Always respond in English, regardless of the language of the prompt.' }, { role: 'user', content: $json.chatInput }] }) }}",
        "options": {
          "response": {
            "response": {
              "neverError": true
            }
          },
          "timeout": 120000
        }
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.3,
      "position": [
        280,
        0
      ],
      "id": "a1b2c3d4-http-req-0002-abcdef000002",
      "name": "Call HuggingFace Inference API",
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "version": 2,
            "caseSensitive": true
          },
          "combinator": "or",
          "conditions": [
            {
              "id": "condition-503-check",
              "operator": {
                "type": "number",
                "operation": "equals"
              },
              "leftValue": "={{ $json.statusCode }}",
              "rightValue": 503
            },
            {
              "id": "condition-error-check",
              "operator": {
                "type": "string",
                "operation": "contains"
              },
              "leftValue": "={{ JSON.stringify($json) }}",
              "rightValue": "is currently loading"
            }
          ]
        }
      },
      "type": "n8n-nodes-base.if",
      "typeVersion": 2.2,
      "position": [
        540,
        0
      ],
      "id": "a1b2c3d4-if-node-0003-abcdef000003",
      "name": "Model Loading?"
    },
    {
      "parameters": {
        "amount": 30,
        "unit": "seconds"
      },
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1.1,
      "position": [
        800,
        -100
      ],
      "id": "a1b2c3d4-wait-nod-0004-abcdef000004",
      "name": "Wait 30s for Model"
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://router.huggingface.co/v1/chat/completions",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "httpHeaderAuth",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify({ model: 'openai/gpt-oss-20b:groq', messages: [{ role: 'system', content: 'You are a helpful AI assistant. Always respond in English, regardless of the language of the prompt.' }, { role: 'user', content: $('When chat message received').first().json.chatInput }] }) }}",
        "options": {
          "response": {
            "response": {
              "neverError": true
            }
          },
          "timeout": 120000
        }
      },
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.3,
      "position": [
        1060,
        -100
      ],
      "id": "a1b2c3d4-http-rt-0005-abcdef000005",
      "name": "Retry HuggingFace API",
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "jsCode": "// Parse the HuggingFace OpenAI-compatible API response\nconst data = $input.all();\nconst results = [];\n\nfor (const item of data) {\n  const json = item.json;\n\n  // Handle error responses\n  if (json.error) {\n    results.push({\n      json: {\n        output: `\u26a0\ufe0f HuggingFace API Error: ${json.error.message || JSON.stringify(json.error)}`,\n        model: 'openai/gpt-oss-20b:groq',\n        status: 'error'\n      }\n    });\n    continue;\n  }\n\n  let generatedText = '';\n  if (json.choices && json.choices.length > 0) {\n    generatedText = json.choices[0].message.content;\n  } else {\n    generatedText = JSON.stringify(json, null, 2);\n  }\n\n  results.push({\n    json: {\n      output: generatedText.trim(),\n      model: 'openai/gpt-oss-20b:groq',\n      status: 'success'\n    }\n  });\n}\n\nreturn results;"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        800,
        100
      ],
      "id": "a1b2c3d4-code-nd-0006-abcdef000006",
      "name": "Parse Response"
    },
    {
      "parameters": {
        "jsCode": "// Parse the retry response (same logic)\nconst data = $input.all();\nconst results = [];\n\nfor (const item of data) {\n  const json = item.json;\n\n  if (json.error) {\n    results.push({\n      json: {\n        output: `\u26a0\ufe0f Model still unavailable after retry: ${json.error.message || JSON.stringify(json.error)}`,\n        model: 'openai/gpt-oss-20b:groq',\n        status: 'error'\n      }\n    });\n    continue;\n  }\n\n  let generatedText = '';\n  if (json.choices && json.choices.length > 0) {\n    generatedText = json.choices[0].message.content;\n  } else {\n    generatedText = JSON.stringify(json, null, 2);\n  }\n\n  results.push({\n    json: {\n      output: generatedText.trim(),\n      model: 'openai/gpt-oss-20b:groq',\n      status: 'success_after_retry'\n    }\n  });\n}\n\nreturn results;"
      },
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        1320,
        -100
      ],
      "id": "a1b2c3d4-code-rt-0007-abcdef000007",
      "name": "Parse Retry Response"
    }
  ],
  "connections": {
    "When chat message received": {
      "main": [
        [
          {
            "node": "Call HuggingFace Inference API",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Call HuggingFace Inference API": {
      "main": [
        [
          {
            "node": "Model Loading?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Model Loading?": {
      "main": [
        [
          {
            "node": "Wait 30s for Model",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Parse Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait 30s for Model": {
      "main": [
        [
          {
            "node": "Retry HuggingFace API",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Retry HuggingFace API": {
      "main": [
        [
          {
            "node": "Parse Retry Response",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "tags": [
    {
      "createdAt": "2026-07-16T15:55:54.254120+00:00",
      "updatedAt": "2026-07-16T15:55:54.254132+00:00",
      "id": "558f1e5fcbd7f1ca",
      "name": "Data Transformation"
    },
    {
      "createdAt": "2026-07-16T15:55:54.254140+00:00",
      "updatedAt": "2026-07-16T15:55:54.254143+00:00",
      "id": "3506c721492cc987",
      "name": "Agentic AI"
    },
    {
      "createdAt": "2026-07-16T15:55:54.254148+00:00",
      "updatedAt": "2026-07-16T15:55:54.254151+00:00",
      "id": "dac03ba206f3bfe0",
      "name": "Event-Driven Architecture"
    },
    {
      "createdAt": "2026-07-16T15:55:54.254156+00:00",
      "updatedAt": "2026-07-16T15:55:54.254159+00:00",
      "id": "87703e16953f8b2e",
      "name": "Data Pipeline"
    },
    {
      "createdAt": "2026-07-16T15:55:54.254164+00:00",
      "updatedAt": "2026-07-16T15:55:54.254166+00:00",
      "id": "89f5bd6077773f30",
      "name": "Production Automation"
    },
    {
      "createdAt": "2026-07-16T15:58:23.793245+00:00",
      "updatedAt": "2026-07-16T15:58:23.793258+00:00",
      "id": "332aea2c3b181c28",
      "name": "Event-Driven"
    }
  ]
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

GPT-OSS-20B HuggingFace. Uses chatTrigger, httpRequest. Chat trigger; 7 nodes.

Source: https://github.com/Sohila-Khaled-Abbas/n8n-workflow-gpt-oss-20b-huggingface/blob/main/workflow.json — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

AI & RAG

This workflow allows users to ask portfolio-related questions in a simple format (). It validates the input, fetches client data and holdings from Google Sheets, retrieves live market prices via API,

Chat Trigger, Google Sheets, HTTP Request +2
AI & RAG

This workflow is for: People who want to quickly launch simple landing pages without paying monthly fees to landing page creators. It’s ideal for rapid prototyping, generation of large amounts of land

Google Gemini, OpenAI, Chat Trigger +3
AI & RAG

This n8n template demonstrates how to automatically download an Instagram Reel, analyze its content using AI video understanding, and regenerate a similar video using AI video generation models. The w

Chat Trigger, HTTP Request
AI & RAG

Automate the creation of high-performing YouTube Shorts in minutes! Content Creators: Generate engaging short videos effortlessly. Marketing Agencies: Produce client-ready content quickly. Business Ow

Chat Trigger, HTTP Request, OpenAI
AI & RAG

I prepared a comprehensive guide demonstrating how to build a multi-level retrieval AI agent in n8n that smartly narrows down search results first by file descriptions, then retrieves detailed vector

Tool Code, Chat Trigger, OpenAI +2