Route AI prompts between Anthropic, Google Gemini, Mistral and OpenAI
Ready for 3.0What this workflow does
This workflow has 12 nodes and runs when another workflow calls it. It uses only n8n's built-in nodes. It also calls api.anthropic.com, api.mistral.ai and api.openai.com over HTTP.
How it runs
Trigger: When another workflow calls it.
- CONFIG (Edit Fields (Set)): sets 8 fields: DEFAULT_PROVIDER, DEFAULT_ANTHROPIC_MODEL, DEFAULT_GOOGLE_MODEL…
- Normalize Input (Code): runs custom JavaScript code
- Validate Token Budget (Code): runs custom JavaScript code
- Which Provider? (Switch): routes items into 4 branches
- Anthropic Chat (HTTP Request): calls api.anthropic.com (POST)
- Google Chat (HTTP Request): calls an HTTP API (POST)
- Mistral Chat (HTTP Request): calls api.mistral.ai (POST)
- OpenAI Chat (HTTP Request): calls api.openai.com (POST)
- Merge Provider Response (Code): runs custom JavaScript code
- Cost Tracking (Code): runs custom JavaScript code
…plus 1 more step. See the full node list below.
HTTP calls to: api.anthropic.com, api.mistral.ai, 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 (5)
- Execute Workflow Trigger
n8n-nodes-base.executeWorkflowTrigger - Edit Fields (Set)
n8n-nodes-base.set - Code
n8n-nodes-base.code - Switch
n8n-nodes-base.switch - HTTP Request
n8n-nodes-base.httpRequest
From the author
Quick overview A reusable sub-workflow that routes text prompts to Anthropic Claude, Google Gemini, Mistral, or OpenAI and returns a normalised response - including estimated token usage and cost - regardless of the provider. Drop it into any workflow via…