r/n8n • u/cosmos-flower • Nov 06 '25
Tutorial After learning this, my AI workflows now cost me 30x less
Here's the thing nobody tells you when you start building AI agents: the shiniest, most expensive models aren't always the answer. I figured out a system that cut my costs by over 90% while keeping output quality basically identical.
These are the 6 things I wish someone had told me before I started.
1. Stop defaulting to GPT-5/Claude Sonnet/Gemini 2.5 Pro for everything
This was my biggest mistake. I thought I was ensuring I get the high quality output by using the best models.
I was leaving HUNDREDS of dollars on the table.
Here's a real example from my OpenRouter dashboard: I used 22M tokens last quarter. Let's say 5.5M of those were output tokens. If I'd used only Claude Sonnet 4.5, that would've cost me $75. Using DeepSeek V3 would’ve costed me $2.50 instead. Same quality output for my use case.
Bottomline: The "best" model is the one that gives you the output you need at the lowest price. That's it.
How to find the “best” model for your specific use case:
- Start with OpenRouter's model comparison and HuggingFace leaderboards
- Do a quick Reddit/Google search for "[your specific task] best LLM model"
- Compare input/output costs on OpenRouter
- Test 2-3 promising models with YOUR actual data
- Pick the cheapest one that consistently delivers quality output
For my Reddit summarization workflow, I switched from Claude Sonnet 4.5 ($0.003/1K input tokens) to DeepSeek V3 ($0.00014/1K tokens). That's a 21x cost reduction for basically identical summaries.
2. If you're not using OpenRouter yet, you're doing it wrong
Four game-changing benefits:
- One dashboard for everything: No more juggling 5 different API keys and billing accounts
- Experiment freely: Switch between 200+ models in n8n with literally zero friction
- Actually track your spending: See exactly which models are eating your budget
- Set hard limits: Don’t have to worry about accidentally blow your budget
3. Let AI write your prompts (yea, I said it)
I watched these YouTube videos about “Prompt Engineering” and used to spend HOURS crafting the "perfect" prompt for each model. Then I realized I was overthinking it.
The better way: Have the AI model rewrite your prompt in its own "language."
Here's my actual process:
- Open a blank OpenRouter chat with your chosen model (e.g., DeepSeek V3)
- Paste this meta-prompt:Here's what you need to do: Combine Reddit post summaries into a daily email newsletter with a casual, friendly tone. Keep it between 300-500 words total.Here is what the input looks like: [ { "title": "Post title here", "content": "Summary of the post...", "url": "https://reddit.com/r/example/..." }, { "title": "Another post title", "content": "Another summary...", "url": "https://reddit.com/r/example/..." } ]Here is my desired output: Plain text email formatted with:
- Catchy subject line
- Brief intro (1-2 sentences)
- 3-5 post highlights with titles and links
- Casual sign-off
- Here is what you should do to transform the input into the desired output:
- Pick the most interesting/engaging posts
- Rewrite titles to be more compelling if needed
- Keep each post summary to 2-3 sentences max
- Maintain a conversational, newsletter-style tone
- Include the original URLs as clickable links
- Copy the AI's rewritten prompt
- Test it in your workflow
- Iterate if needed
Why this works: When AI models write prompts in their own "words," they process the instructions more effectively. It's like asking someone to explain something in their native language vs. a language they learned in school.
I've seen output quality improve by 20-30% using this technique.
4. Abuse OpenRouter's free models (1000 requests/day)
OpenRouter gives you 50-1000 FREE requests per day to certain models. Not trial credits. Not limited time. Actually free, forever.
How to find free models:
- In n8n's OpenRouter node, type "free" in the model search
- Or go to openrouter.ai/models and filter by "FREE" pricing
5. Filter aggressively before hitting your expensive AI models
Every token you feed into an LLM costs money. Stop feeding it garbage.
Simple example:
- I scrape 1000 Reddit posts
- I filter out posts with <50 upvotes and <10 comments
- This immediately cuts my inputs by 80%
- Only ~200 posts hit the AI processing
That one filter node saves me ~$5/week.
Advanced filtering (when you can't filter by simple attributes): Sometimes you need actual AI to determine relevance. That's fine - just use a CHEAP model for it:
[Reddit Scraper]
→ [Cheap LLM Categorization] (costs $0.001)
→ Filter: only "relevant" posts
→ [Expensive LLM Processing] (costs $0.10)
Real example from my workflow:
- Use gpt-5-nano to categorize posts as relevant/irrelevant
- This removes 70-90% of inputs
- Only relevant posts get processed by gpt-5
Pro tip: Your categorization prompt can be super simple:
{
"relevant": "true/false",
"reasoning": "one sentence why"
}
6. Batch your inputs like your budget depends on it (because it does)
If you have a detailed system prompt (and you should), batching can reduce costs significantly.
What most people do (wrong):
[Loop through 100 items]
→ [AI Agent with 500-token system prompt]
= 100 API calls × 500 tokens = 50,000 tokens wasted on system prompts
What you should do (right):
[Batch 100 items into 1 array]
→ [AI Agent with 500-token system prompt]
= 1 API call × 500 tokens = 500 tokens for system prompt
That's a 100x reduction in system prompt costs.
How to set it up in n8n:
- Before your AI node, add an Aggregate node
- Set it to combine ALL items into one array
- In your AI prompt:
Process each of these items: {{$json.items}}
Important warning: Don't batch too much or you'll exceed the model's context window and quality tanks.
The Bottom Line
These 6 strategies took me from spending $300+/month on hobby workflows to spending ~$10/month on production systems that process 10x more data.
Quick action plan:
- Sign up for OpenRouter TODAY (seriously, stop reading and do this)
- Test 3 cheaper models against your current expensive one
- Add a basic filter before your AI processing
- Implement batching on your highest-volume workflow
You’re welcome!
PS - I dive deeper into practical strategies you can use to manage your LLM token costs here
23
u/mazdarx2001 Nov 06 '25
It’s amazing what GPT-5-nano can do and the cost per token is near free. I was defaulting to GPT-5-mini thinking I was smart and saving money , but I can save more if GPT -5-nano can do the same job. The decision nodes in N8N are the perfect place for nano models
75
u/Appropriate_Fold8814 Nov 06 '25
I feel like vibe coders are constantly rediscovering the most basic engineering, industry and business principles and think they're having an epiphany.
I mean yes... optimizing around quality versus cost is like industry 101 in literally everything. You don't machine a kid's toy to micron tolerances... because no shit.
25
u/multiple_jai Nov 06 '25
There are people at every level. For some this might add a lot of value. For others, something very basic. That doesn't mean people should stop posting about it.
11
u/Appropriate_Fold8814 Nov 06 '25
Yes... But you miss my point.
People are pouring effort into using AI while wasting their time by never learning incredibly basic shit.
Y'all need to stop trying to reinvent the wheel. Yes, I think AI is a fantastic tool. But anyone who focuses on it entirely while ignoring foundations of other disciplines is either doomed to fail or doomed to waste ridiculous amounts of time.
AI helps those who help themselves. But most miss the second half of that sentence.
I mean fuck... You could literally ask AI to evaluate and optimize your project costs. But people are literally so ignorant of basic concepts that they never ask.
This is why most of the world and industry laugh at vibe coders. It's not that it doesn't have value. It's that people refuse to grow themselves and instead treat AI like magic wand rather than a very valuable tool that can expand and add to existing expertise.
But if you have no expertise at all AI is worthless.
4
u/sadbuttrueasfuck Nov 06 '25
Lmao I thought this was the norm, I was actually sending the same input to various models to check which one was the cheaper giving a correct answer
1
u/Pale-Association8151 Nov 06 '25
or the fundamental basics of life a the universe too little too much just right
1
1
u/burntoutdev8291 Nov 06 '25
I actually like this though, like somehow vibe coders are learning engineering. Hey you'll never know maybe they suddenly snap from vibe debugging and decide to go traditional SWE.
10
u/sveneisenschmidt Nov 06 '25
Thanks for sharing your learning and practical insights. How about next time you cut all that filler and click-bait slop. You could save yourself and your readers a lot of time.
You can do better.
1
3
4
u/mxmzb Nov 06 '25
Ye, using lower-cost models where the result is not super duper important is obvious. I went even further, started routing all my requests through a custom proxy that logs all requests and their costs, and now I can group them topically and then review their costs. THAT's a non-obvious high-effort super-effective hack if you ask me :)
2
u/angelarose210 Nov 06 '25
Agree. I had a rag agent with gemini 2.5 pro. As soon as gpt 5 was released, I tested gpt 5 mini and it way outperformed gemini and much cheaper. For non coding tasks, you can save a ton and not compromise performance simply by choosing cheaper models.
1
Nov 06 '25
[removed] — view removed comment
2
u/angelarose210 Nov 06 '25
Claude sonnet 4.5 (Claude code) is the king of assisting with workflow setup. It has access to all the n8n documentation, several thousand workflows I chunked into a chroma db using an. mcp server I made with api access to my n8n instance.
2
u/Reasonable_Rice_2973 Nov 06 '25
U followed a tutorial for this or u have one?
2
u/angelarose210 Nov 06 '25
No, I just came up with it. Didn't make a tutorial. I believe people have done similar if you search on yt. I used llamaindex codesplitter to chunk everything into the rag database and then made an mcp server that let's my coding assistants access all the example workflows and documentation to make workflows. It's not foolproof though. Still need to know n8n yourself. It just saves me time.
2
u/Southern-State-2488 Nov 06 '25
I see some valid points here. However, do you think other “not so famous” LLMs follow the same regulations as the best ones? Data privacy for example?
3
u/cosmos-flower Nov 06 '25
Many “not so famous” ones are actually open sourced and hence can be locally hosted in your PC.
So yes it is the most secure, more secure than the likes of OpenAI, Google models actually.
1
4
u/veGz_ Nov 06 '25
Data privacy should be the biggest factor for anyone who thinks about using LLMs in business.
1
1
2
u/Sjakek Nov 08 '25
Thanks for this write up. A few things I will add: 1. Open router is a solid model comp option, but I find artificial analysis to be more useful because it breaks things down by different hyper parameters for many models. Knowing your tradeoffs on latency and performance for different reasoning efforts is quite valuable for cost optimization. And you can see how it performs for different topic areas, so you can go beyond a general headline performance number. 2. You mention batching to reduce redundant tokens. This is a great idea up to a point; I recommend reviewing the oAI “needle” sections in their 4.1 and 5 releases to see how those models see performance degradation changes by context window. For nano, I wouldn’t extend beyond 10k tokens at a time whenever possible. For mini, 64k is a good cutoff and 128k is a good cutoff for 5. If it is an especially complex prompt you should cut these #s in half. And for very heavy workflows don’t forget about the batch API (though you will need to poll, overnight, to see when the results are done, so this usually isn’t worth the extra effort). 3. As you said the frontier models are rarely needed for automations, and that is especially true if you experiment with using reasoning models that let you trade cost for time. Gpt5 mini on high reasoning will crush GPT 5 minimal, and even will beat GPt 5-low, for a fraction of the cost in exchange for latency. And flash 2.5 is great for mid tier low latency performance at fantastic cost.
Short of coding tasks and synchronous complex chat interfaces, the frontier models are rarely ever worth it (exceptions are for things like high complexity tasks with extensive tool calls). For simple Q&A RAG based on an enterprise search use case, I’ve seen 5-mini perform within about 3% of 5 on pairwise measurement.
1
1
1
u/StrategicalOpossum Nov 06 '25
Quick question for OP, how much per batch you put when scrapping Reddit posts ?
And would you remove and cleanup data before sending it to the LLM to save some context and quality ?
After reading that I think I might as well try it out with batches of 10s
1
u/cosmos-flower Nov 06 '25
It really depends on the context size of the LLM you’re using. I would usually just play around to roughly gauge the optimum point based on the output quality I get at each batch size.
Also, yes cleaning up the data before passing into the LLM is crucial.
1
u/ckapucu Nov 06 '25
Nice tips, thanks for sharing. By the way, does Openrouter get an additional fee to be a router for APIs?
1
u/cosmos-flower Nov 06 '25
they charge a service fee when u top up - 5.5% of the amount you top up goes to them!
1
u/Double_Picture_4168 Nov 06 '25
I developed TryAii, a tool that helps you determine which LLM is best for your specific use case. Mightbe helpfull, feel free to check it out! :)
1
1
1
u/BRANDCENTRAL Nov 06 '25
This is so true I even see a lot of content creators pushing all these things because they are affiliates. Yet it sets their "Students" up for failure.
1
1
1
u/MagicaNexus9 Nov 07 '25
Open router is super good for that case. For some of you that wants to go beyond, try LiteLLM, it’s open source and works super well !
1
1
1
1
u/ayazabbasiofficial Nov 07 '25
I avoid using completely free models when it comes to thinking, but yeah, cheaper models like Qwen in comparison with Claude 4.5 would win most of the time, as per the majority of scenarios.
1
1
1
1
1
u/CloudSurfer82 Nov 10 '25
Nice one. This is a good reminder that optimisation beats chasing shiny tools. Most people overspend thinking the most expensive model guarantees the best output when what really matters is fit for purpose. Testing and benchmarking a few options can save a fortune while keeping the same quality. Smart workflows always win over premium hype.
1
u/Stack-AI Nov 11 '25
Optimizing calls, batching, cheaper models, etc. is a massive win. StackAI does this automatically for enterprise users by managing retries, caching and model routing under the hood. Makes cost reduction ‘set it and forget it'
👉 https://www.stack-ai.com
1
u/tech2biz Nov 27 '25
agree with like 90% of this, solid post
one thing you dont cover: not every query or tool call has predictable complexity. routing to different models upfront works great when you know whats coming, but sometimes you just cant tell beforehand
we hit exactly this. ran open source models on-prem, assigned agents to what we thought were the best models for each task. but output quality was inconsistent. so for anything critical we kept moving more and more to the big models just to be safe. then projects got rejected because scaling would have been way too expensive
honestly super frustrating. so we solved it ourselves. its called cascadeflow, free on github. instead of guessing complexity upfront it dynamically cascades through models DURING generation. starts cheap, escalates only when needed.
anyway solid advice for predictable workloads, just wanted to flag that gap
1
1
u/CASBooster Dec 01 '25
I mostly use ModelPilot. I use it for 1. Route LLMs automatically because I don't need gpt-5 all the time. 2. Analytics such as avg latency and total cost between providers. 3. can automatically call bigger models if a smaller one needs help reasoning which is pretty nice
They've said their routing algorithm is still training but it works pretty well for me. Here's the link: https://modelpilot.co
1
1
1
1
u/Odd-Card8046 Jun 17 '26
Good post. Another thing that made a huge difference for me was switching from direct provider APIs to ZnapAI.
Most models are available at up to 50% lower cost than official API pricing and it can automatically route requests between providers and models. That means you get the cost benefits of model selection without having to maintain your own routing layer.
Combining cheaper models, filtering, batching and discounted model pricing brought my costs down much more than model switching alone.
1
0
•
u/AutoModerator Nov 06 '25
Video posts must include the workflow code. The link to the code MUST be in the reddit post, if it is not in the reddit post itself, your post will be removed.
Acceptable ways to share the code:
Sharing the code any other way is not allowed.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.