Route LLM requests with Anthropic, OpenAI, Gemini, Postgres, and Slack
Ready for 3.0What this workflow does
This workflow has 27 nodes and runs manually, when you click “Execute workflow” (plus 1 other trigger). Along the way it connects Postgres and Slack. It also calls api.anthropic.com and api.openai.com over HTTP.
How it runs
Trigger: Manually, when you click “Execute workflow” (plus 1 other trigger).
- Set - Fallback Config (Edit Fields (Set)): sets 14 fields: providerOrder, anthropicModel, openaiModel…
- JS - Normalize Request (Code): runs custom JavaScript code
- Postgres: run a query
- JS - Build Provider Chain (Code): runs custom JavaScript code
- JS - Select Provider (Code): runs custom JavaScript code
- Switch: routes items into 3 branches
- HTTP Request: calls api.anthropic.com (POST)
- HTTP Request: calls api.openai.com (POST)
- HTTP Request: calls an HTTP API (POST)
- JS - Normalize & Validate (Code): runs custom JavaScript code
…plus 15 more steps. See the full node list below.
Services it uses
HTTP calls to: api.anthropic.com, api.openai.com
Before you upgrade to n8n 3.0
Nothing in this workflow is removed in n8n 3.0, so it should import and run after the upgrade.
Nodes used (11)
- Manual Trigger
n8n-nodes-base.manualTrigger - Webhook
n8n-nodes-base.webhook - Edit Fields (Set)
n8n-nodes-base.set - Code
n8n-nodes-base.code - Postgres
n8n-nodes-base.postgres - Switch
n8n-nodes-base.switch - HTTP Request
n8n-nodes-base.httpRequest - If
n8n-nodes-base.if - Wait
n8n-nodes-base.wait - Slack
n8n-nodes-base.slack - Respond to Webhook
n8n-nodes-base.respondToWebhook
From the author
Quick overview This workflow exposes a POST webhook that sends a prompt through a resilient LLM fallback chain (Anthropic, OpenAI, then Google Gemini), validates outputs against deterministic rules/JSON schema, logs all attempts to Postgres with a circuit…