WORKFLOW · N8N
DaoXE Multi-Model Chat with Automatic Fallback
Prompts👁 0
WORKFLOW JSON
{
"meta": {
"templateCredsSetupCompleted": false
},
"name": "DaoXE Multi-Model Chat with Automatic Fallback",
"tags": [
{
"name": "DaoXE"
}
],
"nodes": [
{
"id": "11111111-0000-4000-8000-000000000001",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
-460,
-120
],
"parameters": {
"color": 4,
"width": 420,
"height": 460,
"content": "## DaoXE multi-model fallback (one API key)\n\n**What it does:** calls a primary model on DaoXE; if that request errors, it automatically retries the same prompt on a fallback model — all through **one** OpenAI-compatible key and **one** Base URL (`https://daoxe.com/v1`).\n\n### Setup (2 minutes)\n1. **Credentials → New → Header Auth** — Name: `Authorization`, Value: `Bearer <YOUR_DAOXE_API_KEY>`. Select it in both HTTP nodes.\n2. Open **Set inputs** and replace `YOUR_DAOXE_MODEL_ID` / `YOUR_DAOXE_FALLBACK_MODEL_ID` with two exact model IDs available to your account (from your DaoXE dashboard or `GET /v1/models` — do not hardcode a list from a blog post).\n3. Click **Test workflow**.\n\nDaoXE is a multi-model, multi-protocol gateway. Not available in mainland China.\nhttps://daoxe.com"
},
"typeVersion": 1
},
{
"id": "11111111-0000-4000-8000-000000000002",
"name": "When clicking 'Test workflow'",
"type": "n8n-nodes-base.manualTrigger",
"position": [
0,
120
],
"parameters": {},
"typeVersion": 1
},
{
"id": "11111111-0000-4000-8000-000000000003",
"name": "Set inputs",
"type": "n8n-nodes-base.set",
"position": [
220,
120
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "a0000000-0000-0000-0000-000000000001",
"name": "prompt",
"type": "string",
"value": "Give me three punchy blog-post titles about honest, no-swapping AI API gateways."
},
{
"id": "a0000000-0000-0000-0000-000000000002",
"name": "system",
"type": "string",
"value": "You are a concise, helpful assistant. Answer in plain text."
},
{
"id": "a0000000-0000-0000-0000-000000000003",
"name": "primary_model",
"type": "string",
"value": "YOUR_DAOXE_MODEL_ID"
},
{
"id": "a0000000-0000-0000-0000-000000000004",
"name": "fallback_model",
"type": "string",
"value": "YOUR_DAOXE_FALLBACK_MODEL_ID"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "11111111-0000-4000-8000-000000000004",
"name": "Primary model (DaoXE)",
"type": "n8n-nodes-base.httpRequest",
"onError": "continueErrorOutput",
"position": [
460,
120
],
"parameters": {
"url": "https://daoxe.com/v1/chat/completions",
"method": "POST",
"options": {},
"jsonBody": "={\n \"model\": {{ JSON.stringify($json.primary_model) }},\n \"messages\": [\n { \"role\": \"system\", \"content\": {{ JSON.stringify($json.system) }} },\n { \"role\": \"user\", \"content\": {{ JSON.stringify($json.prompt) }} }\n ]\n}",
"sendBody": true,
"sendHeaders": true,
"specifyBody": "json",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"headerParameters": {
"parameters": [
{
"name": "Content-Type",
"value": "application/json"
}
]
}
},
"credentials": {
"httpHeaderAuth": {
"id": "REPLACE_WITH_YOUR_CREDENTIAL_ID",
"name": "DaoXE (Header Auth)"
}
},
"typeVersion": 4.2
},
{
"id": "11111111-0000-4000-8000-000000000005",
"name": "Fallback model (DaoXE)",
"type": "n8n-nodes-base.httpRequest",
"position": [
680,
300
],
"parameters": {
"url": "https://daoxe.com/v1/chat/completions",
"method": "POST",
"options": {},
"jsonBody": "={\n \"model\": {{ JSON.stringify($('Set inputs').item.json.fallback_model) }},\n \"messages\": [\n { \"role\": \"system\", \"content\": {{ JSON.stringify($('Set inputs').item.json.system) }} },\n { \"role\": \"user\", \"content\": {{ JSON.stringify($('Set inputs').item.json.prompt) }} }\n ]\n}",
"sendBody": true,
"sendHeaders": true,
"specifyBody": "json",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"headerParameters": {
"parameters": [
{
"name": "Content-Type",
"value": "application/json"
}
]
}
},
"credentials": {
"httpHeaderAuth": {
"id": "REPLACE_WITH_YOUR_CREDENTIAL_ID",
"name": "DaoXE (Header Auth)"
}
},
"typeVersion": 4.2
},
{
"id": "11111111-0000-4000-8000-000000000006",
"name": "Answer (primary)",
"type": "n8n-nodes-base.set",
"position": [
680,
60
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "b0000000-0000-0000-0000-000000000001",
"name": "answer",
"type": "string",
"value": "={{ $json.choices[0].message.content }}"
},
{
"id": "b0000000-0000-0000-0000-000000000002",
"name": "served_model",
"type": "string",
"value": "={{ $json.model }}"
},
{
"id": "b0000000-0000-0000-0000-000000000003",
"name": "via",
"type": "string",
"value": "primary"
}
]
}
},
"typeVersion": 3.4
},
{
"id": "11111111-0000-4000-8000-000000000007",
"name": "Answer (fallback)",
"type": "n8n-nodes-base.set",
"position": [
900,
300
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "c0000000-0000-0000-0000-000000000001",
"name": "answer",
"type": "string",
"value": "={{ $json.choices[0].message.content }}"
},
{
"id": "c0000000-0000-0000-0000-000000000002",
"name": "served_model",
"type": "string",
"value": "={{ $json.model }}"
},
{
"id": "c0000000-0000-0000-0000-000000000003",
"name": "via",
"type": "string",
"value": "fallback"
}
]
}
},
"typeVersion": 3.4
}
],
"active": false,
"pinData": {},
"settings": {
"executionOrder": "v1"
},
"connections": {
"Set inputs": {
"main": [
[
{
"node": "Primary model (DaoXE)",
"type": "main",
"index": 0
}
]
]
},
"Primary model (DaoXE)": {
"main": [
[
{
"node": "Answer (primary)",
"type": "main",
"index": 0
}
],
[
{
"node": "Fallback model (DaoXE)",
"type": "main",
"index": 0
}
]
]
},
"Fallback model (DaoXE)": {
"main": [
[
{
"node": "Answer (fallback)",
"type": "main",
"index": 0
}
]
]
},
"When clicking 'Test workflow'": {
"main": [
[
{
"node": "Set inputs",
"type": "main",
"index": 0
}
]
]
}
}
}RELATED WORKFLOWS
COMMENTS
No comments yet — be the first.
