{"product_id":"n8n-llm-router-claude-primary-with-openai-fallback-webhook","title":"n8n LLM Router: Claude Primary with OpenAI Fallback Webhook","description":"\u003ch3\u003eRoute LLM requests through Claude—with automatic OpenAI fallback\u003c\/h3\u003e\n\u003cp\u003eThis n8n LLM Router workflow sends your prompt to \u003cstrong\u003eAnthropic Claude first\u003c\/strong\u003e, then seamlessly falls back to \u003cstrong\u003eOpenAI Chat Completions\u003c\/strong\u003e whenever Claude doesn’t return usable text. Ideal for n8n automation engineers who want reliability, not guesswork.\u003c\/p\u003e\n\n\u003ch3\u003eWhat this workflow does\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003e\n\u003cstrong\u003eReceives input\u003c\/strong\u003e via an \u003cem\u003eExecute Workflow\u003c\/em\u003e trigger or a POST request to the \u003cstrong\u003etest webhook\u003c\/strong\u003e (endpoint: \u003ccode\u003e\/model-router-test\u003c\/code\u003e).\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eNormalizes your payload\u003c\/strong\u003e into \u003ccode\u003eprompt\u003c\/code\u003e, \u003ccode\u003esystem\u003c\/code\u003e, \u003ccode\u003emode\u003c\/code\u003e, and \u003ccode\u003emax_tokens\u003c\/code\u003e using sensible defaults.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eCalls Anthropic Claude\u003c\/strong\u003e using the Anthropic Messages API to generate a response.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eValidates output\u003c\/strong\u003e by checking whether Claude returned \u003cem\u003eusable text content\u003c\/em\u003e (not just a successful HTTP response).\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eFalls back to OpenAI\u003c\/strong\u003e by sending the same prompt to \u003cstrong\u003eOpenAI Chat Completions\u003c\/strong\u003e (using \u003cstrong\u003egpt-4o-mini\u003c\/strong\u003e) when no usable content is found.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eReturns the first usable result\u003c\/strong\u003e, including:\n    \u003cul\u003e\n      \u003cli\u003e\u003ccode\u003etext\u003c\/code\u003e\u003c\/li\u003e\n      \u003cli\u003ethe responding \u003ccode\u003emodel\u003c\/code\u003e\n\u003c\/li\u003e\n      \u003cli\u003e\n\u003ccode\u003efallback_used\u003c\/code\u003e (true\/false)\u003c\/li\u003e\n    \u003c\/ul\u003e\n  \u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003ch3\u003eUse cases\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003eBuilding a production-ready \u003cstrong\u003eLLM routing layer\u003c\/strong\u003e inside n8n for customer-facing chat features.\u003c\/li\u003e\n  \u003cli\u003eProtecting automations from occasional provider failures by automatically switching from \u003cstrong\u003eClaude\u003c\/strong\u003e to \u003cstrong\u003eOpenAI\u003c\/strong\u003e.\u003c\/li\u003e\n  \u003cli\u003eTesting prompts quickly via webhook before wiring the router as a sub-workflow.\u003c\/li\u003e\n  \u003cli\u003eStandardizing prompt handling across multiple n8n projects with consistent \u003ccode\u003emax_tokens\u003c\/code\u003e and system context.\u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003ch3\u003eTechnical details\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003e\n\u003cstrong\u003eNodes \/ building blocks:\u003c\/strong\u003e if, code, merge, webhook, sticky note, http request\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eIntegrations:\u003c\/strong\u003e\n    \u003cul\u003e\n      \u003cli\u003e\n\u003cstrong\u003eAnthropic\u003c\/strong\u003e (Claude HTTP request via Anthropic Messages API)\u003c\/li\u003e\n      \u003cli\u003e\n\u003cstrong\u003eOpenAI\u003c\/strong\u003e (fallback via Chat Completions using \u003cstrong\u003egpt-4o-mini\u003c\/strong\u003e)\u003c\/li\u003e\n    \u003c\/ul\u003e\n  \u003c\/li\u003e\n\u003c\/ul\u003e\n\u003cp\u003eTo set up, add your \u003cstrong\u003eAnthropic\u003c\/strong\u003e and \u003cstrong\u003eOpenAI\u003c\/strong\u003e API credentials, then use the test webhook to POST \u003ccode\u003eprompt\u003c\/code\u003e (optionally \u003ccode\u003esystem\u003c\/code\u003e, \u003ccode\u003emode\u003c\/code\u003e, \u003ccode\u003emax_tokens\u003c\/code\u003e). When integrating as a sub-workflow, call it with an Execute Workflow node and pass the expected fields.\u003c\/p\u003e","brand":"N8N Commerce","offers":[{"title":"Default Title","offer_id":45814417588403,"sku":"N8N-18012","price":18.99,"currency_code":"GBP","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0749\/6279\/6723\/files\/gbTyp2G0gsn25FdkGtGUY_lr7KtCQm.png?v=1786439232","url":"https:\/\/buyflowscripts.com\/products\/n8n-llm-router-claude-primary-with-openai-fallback-webhook","provider":"N8N Commerce","version":"1.0","type":"link"}