Short answer: Use one OpenAI credential in n8n with Base URL https://api.ezkielyna.store/v1. A first chain with deepseek-v4.1-flash answers one word, simple or complex. A Switch node sends complex messages to a chain with deepseek-v4-pro and everything else to deepseek-v4.1-flash. On 4 December 2026 the stronger model cost about 48× more per input token and 16× more per output token, so sorting first keeps most of the traffic on the low price.
What you build
- Trigger (Telegram, Webhook, Form or Manual) with the customer text in
message. - Sort: Basic LLM Chain + OpenAI Chat Model
deepseek-v4.1-flash, Maximum Number of Tokens 5, temperature 0. - Route: Switch node on the word the sorter returned.
- Reply: two Basic LLM Chains, one with
deepseek-v4-profor complex messages, one withdeepseek-v4.1-flashfor the rest. - Guards: Retry On Fail, an error output that falls back to the cheap model, and a token limit on every model node.
The two models
| Model | Role | Input | Output |
|---|---|---|---|
deepseek-v4.1-flash | sort + simple replies | $0.0468 | $0.4178 |
deepseek-v4-pro | complex replies | $2.234 | $6.703 |
1. One credential for both models
Create the credential once. Every OpenAI Chat Model node in the workflow uses it; only the model ID changes.
n8n
n8n → Credentials → Add credential → OpenAI
API Key: sk-... (your Ezkielyna API key, Standard group)
Base URL: https://api.ezkielyna.store/v1
2. The sorter
Add a Basic LLM Chain, attach an OpenAI Chat Model sub-node, pick the credential and set the model by ID to deepseek-v4.1-flash. In Options set Maximum Number of Tokens to 5 and Sampling Temperature to 0, so the answer is one short word. Use this prompt:
Prompt
Classify the customer message below.
Answer with exactly one word: simple or complex.
simple = greeting, price, opening hours, order status, a question with one clear answer.
complex = complaint, refund, several questions at once, anything that needs reasoning.
Message: {{ $json.message }}
3. The Switch
The chain returns its answer in text. Trim it and compare it, and send anything that is not exactly complex to the cheap branch, so an odd answer never reaches the expensive model.
Switch
Switch → Mode: Rules
Value: {{ $json.text.trim().toLowerCase() }}
Rule 1: is equal to complex → output 0 (strong model)
Fallback: Extra Output → output 1 (cheap model)
4. The two reply chains
- Output 0: Basic LLM Chain + OpenAI Chat Model
deepseek-v4-pro, Maximum Number of Tokens 600. - Output 1: Basic LLM Chain + OpenAI Chat Model
deepseek-v4.1-flash, Maximum Number of Tokens 600. - Give both the same system prompt (your shop data, tone, what not to promise) so customers do not notice which model replied.
- Refer to the original text with
{{ $('Trigger').item.json.message }}, because after the sorter$jsonholds the one-word label.
5. Retries and a fallback
- On the strong reply chain open Settings and turn on Retry On Fail (Max Tries 2, Wait Between Tries 5000 ms).
- Set On Error to Continue (using error output) and connect the error output to the cheap reply chain, so a customer still gets an answer if the strong model is busy.
- While testing, pin the output of the trigger and the sorter so you do not pay for the same call again and again.
Without AI nodes: one HTTP Request
If you prefer plain HTTP Request nodes, keep the sorter and choose the model in the body with an expression. The answer is in {{ $json.choices[0].message.content }}.
HTTP Request
HTTP Request · POST https://api.ezkielyna.store/v1/chat/completions
Authentication: Header Auth (Authorization: Bearer sk-...)
{
"model": "{{ $json.text.trim().toLowerCase() === 'complex' ? 'deepseek-v4-pro' : 'deepseek-v4.1-flash' }}",
"max_tokens": 600,
"messages": [{ "role": "user", "content": {{ JSON.stringify($('Trigger').item.json.message) }} }]
}
Check it works
- Send "jam buka toko?" or "what time do you open?": the sorter should answer simple and the cheap branch should reply.
- Send a complaint with two questions: the sorter should answer complex and the strong branch should reply.
- Open Executions and compare the model name in each run. The usage log on api.ezkielyna.store shows the tokens and the cost of each call.
Prices on this page were checked against the live list when it was written; the pricing page always shows the current list. Model availability depends on your key group.