n8n’s AI Agent node makes it easy to build an assistant that reads email, looks up records and replies. It also makes it easy to spend more than you planned, because each run can call the model up to ten times, resending the full prompt each time. This post shows how to run AI Agent workflows on a low-cost OpenAI-compatible model, which model to choose for tool use, which settings cut tokens, and what a run costs. For the credential and node setup itself, follow our n8n setup guide.
How do you connect the AI Agent to a cheaper model?
- Create an OpenAI credential with your provider’s key and its Base URL, for example
https://inference.broadnet.ai/v1. - Add an AI Agent node and attach an OpenAI Chat Model sub-node with that credential.
- Enter the model by ID, not from the list, for example
broadnet/qwen3.8-27b. - Turn off Use Responses API if your provider serves chat completions, as BroadNet does.
- Attach at least one tool. n8n’s docs say you must connect at least one tool sub-node to an AI Agent.
When you set a non-OpenAI Base URL, n8n shows a notice that not every model supports tools or JSON response format. Take it seriously: it decides your model choice.
Which cheap model can handle n8n tools?
n8n’s docs say all AI Agent nodes now work as a Tools Agent. The model must emit tool calls reliably, or the agent loops or answers without using your tools.
| Model on BroadNet | Tools listed | Context | Best n8n use |
|---|---|---|---|
| Qwen3.8 27B | Yes | 262,144 | Default for AI Agent; image input, Arabic tested |
| GLM 5.3 | Yes | 1,048,576 | Agents over long documents |
| Gemma 4 VL 26B | Not listed | 32,768 | Basic LLM Chain: classify, extract, route |
| DeepSeek V4.1 Flash | Not listed | 1,048,576 | Long-document chains, image input; test before agent use |
Qwen3.8 27B is the cheaper of the two tool-capable models on input, and n8n agents are input-heavy. Start there and move to GLM 5.3 if your tests show it handles your tools better; GLM 5.3 vs Qwen3.8 27B compares the two.
Where does an n8n agent spend tokens?
Every iteration is a separate model call carrying:
- the System Message you wrote,
- the definition of every connected tool, including all tools from an MCP Client Tool node set to All,
- the memory window from Simple Memory,
- the user input, plus earlier tool calls and results in this run.
The output is usually short. So the bill is driven by input size times iterations. Our agent token budget post shows how to measure each part.
Which settings cut cost the most?
- Max Iterations. It defaults to 10. Most support-style agents finish in 2 to 4. Set it to 4 or 5 so a confused run stops early.
- Simple Memory’s Context Window Length. It sets how many previous interactions are kept. Every one is resent on every iteration. Keep it small, for example 5.
- Fewer tools. On an MCP Client Tool node, use Selected or All Except instead of All.
- Short tool output. Have HTTP Request tools return only the fields the agent needs, not whole API responses.
- Maximum Number of Tokens. Qwen3.8 27B and GLM 5.3 reason first, and reasoning counts toward the limit. Leave it at the default or set a few thousand. Too small gives empty output.
- Route before the agent. Put a Basic LLM Chain on Gemma 4 VL 26B in front to classify requests. Only the ones that need tools reach the agent.
For a fixed output shape, turn on Require Specific Output Format and attach a Structured Output Parser. It’s cheaper than asking the agent to reformat. More in structured output.
What does an n8n agent run cost?
Take a support agent: 3 iterations per run, about 4,000 input tokens and 300 output tokens per iteration. That’s 12,000 input and 900 output tokens per run. At 10,000 runs a month:
| Monthly tokens | Qwen3.8 27B | GLM 5.3 |
|---|---|---|
| 120M input | $0.175 per 1M | $0.78 per 1M |
| 9M output | $2.17 per 1M | $3.46 per 1M |
Multiply and add. At the prices synced on 2026-11-14, GLM 5.3 costs about 3 times more than Qwen3.8 27B for this workflow, before any cache discount. Halving iterations roughly halves the input line on either model; a shorter memory window cuts it by the share of each prompt that memory takes up.
A Gemma 4 VL 26B routing step adds little: 10,000 classifications at 800 input and 20 output tokens is 8M input at $0.10 per 1M and 0.2M output at $0.22 per 1M. If 40% of requests never reach the agent, that saves 40% of the agent line. For steady high volume on Gemma, BroadNet also sells a flat hourly key at $0.50 an hour: 120 requests a minute, one stream, 300,000 tokens a minute.
Run your own numbers in the LLM API cost calculator, and check how far 30 requests a minute stretches with the rate limit calculator.
What breaks with cheap models in n8n?
- Agent ignores tools. The model isn’t listed with tool support. Switch to Qwen3.8 27B or GLM 5.3.
- “Bad request”. Usually the Responses API toggle. The setup guide has the fixes.
- 429 in batches. A pay-as-you-go key allows 30 requests a minute and 4 at once. Use Loop Over Items with a Wait node. See errors and retries.
- MCP tools. The MCP Client Tool node lets the agent call an external MCP server. Read MCP with OpenAI-compatible models first.
Where BroadNet Inference fits
BroadNet Inference gives n8n one OpenAI-compatible credential for Qwen3.8 27B and GLM 5.3 with tools, Gemma 4 VL 26B for cheap routing, and a $0.50 hourly Gemma key for steady batches. New accounts get $5 of credit, which covers Gemma 4 VL 26B; the tool-capable models need a top-up. It doesn’t fit workflows that need OpenAI-only features such as the Responses API’s built-in tools. Create a key at inference.broadnet.ai.
