Phase 0: AI Workflow Automation Fundamentals · 45 min · Zapier · n8n · OpenAI API
Cost Economics of AI Automation
If you can't estimate the cost per run, you can't estimate the ROI.
Hiring signal: In automation interviews, the question 'how would you estimate the monthly cost of this automation at 10,000 executions?' filters out candidates who've never owned a production budget. Being able to break down platform cost + API cost + infrastructure cost and calculate ROI is a skill that directly maps to the 'platform selection and ROI presentation' interview test.
What you will learn
- Calculate the total cost per workflow execution: platform cost + AI API cost + infrastructure cost
- Compare platform pricing models: Zapier (task-based), Make (operation-based), n8n (self-hosted infra only)
- Estimate AI API costs: per-token pricing for OpenAI and Anthropic, typical token usage per workflow
- Calculate automation ROI: manual process cost vs automation cost at various volumes
The Problem
A company builds an n8n workflow that processes customer emails with AI: classify, extract data, draft response. It works great at 100 emails/day. They scale to 5,000 emails/day and get a $4,200 OpenAI bill in one month. The CFO kills the project. The team didn't calculate the per-execution cost before scaling. They used GPT-4o for classification (which GPT-4o-mini could handle at 1/15th the cost), didn't cache common classifications, and didn't set token limits.
Cost economics isn't an afterthought — it's a design constraint that shapes which model you use, how many AI steps you include, and whether the automation is worth building at all.
Cost per run is the unit metric of automation economics
Every workflow has a cost per execution: platform cost + AI API cost + infrastructure cost. If you can't calculate it before building, you're flying blind. The formula is simple; the discipline is in tracking every token.
The Concept
The Three Cost Layers
┌─────────────────────────────────────────────────────────────┐
│ Total Cost per Execution = Platform + AI API + Infra │
│ │
│ Platform: Zapier ($0.012/task) or n8n ($0 self-hosted)│
│ AI API: OpenAI/Anthropic per-token pricing │
│ Infrastructure: VPS, database, vector store (amortized) │
└─────────────────────────────────────────────────────────────┘
AI API Pricing (2025)
| Model | Input ($/1M tokens) | Output ($/1M tokens) | Best For |
|---|
| GPT-4o | $2.50 | $10.00 | Complex reasoning, high-stakes |
| GPT-4o-mini | $0.15 | $0.60 | Classification, extraction, most workflows |
| Claude 3.5 Sonnet | $3.00 | $15.00 | Long context, careful analysis |
| Claude 3.5 Haiku | $0.80 | $4.00 | Fast, cost-effective |
| Llama 3.1 8B (Ollama) | $0 | $0 | Local, no API cost |
Cost per Execution: Worked Example
Workflow: Email → AI Classify → AI Extract → DB Lookup → AI Draft Response → Send
| Step | Model | Input Tokens | Output Tokens | Cost |
|---|
| Classify | GPT-4o-mini | 300 | 20 | $0.000057 |
| Extract | GPT-4o-mini | 500 | 100 | $0.000135 |
| Draft response | GPT-4o-mini | 800 | 200 | $0.000240 |
| Total AI cost | | | | $0.000432 |
| Platform (n8n self-hosted) | — | — | — | ~$0.001 |
| Infrastructure (amortized) | — | — | — | ~$0.0005 |
| Total per execution | | | | ~$0.002 |
At 5,000 emails/day: $0.002 × 5,000 = $10/day = $300/month
You're using GPT-4o ($2.50/$10.00 per 1M tokens) for email classification. Each email uses 300 input tokens and 20 output tokens. At 10,000 emails/day, what's the monthly AI cost? What if you switch to GPT-4o-mini ($0.15/$0.60)?
GPT-4o: (300/1M × $2.50 + 20/1M × $10) × 10,000 × 30 = ($0.00075 + $0.0002) × 300,000 = $0.00095 × 300,000 = $285/mo. Wait, let me recalculate: $0.00095 × 10,000/day × 30 days = $285/mo. Actually the closest answer is GPT-4o: ~$285/mo, GPT-4o-mini: ~$17/mo. The key insight is the 17x cost difference — always use the cheapest model that handles the task.
Platform Pricing Comparison
| Platform | Model | 1K exec/mo | 10K exec/mo | 100K exec/mo |
|---|
| Zapier | Per task | $20 | $103 | $799+ |
| Make | Per operation | $11 | $105 | $599+ |
| n8n (cloud) | Per execution | $20 | $50 | $200 |
| n8n (self-hosted) | Flat (infra only) | $30 | $30 | $50 |
| Dify (self-hosted) | Flat (infra only) | $30 | $30 | $50 |
ROI Calculation
ROI = (Manual Cost − Automation Cost) / Automation Cost × 100
Example:
Manual: 7 min/email × 5,000 emails/day = 583 hours/month
At $25/hour: $14,583/month in labor
Automation: $300/month (API) + $50/month (infra) = $350/month
ROI = ($14,583 − $350) / $350 × 100 = 4,066%
Cost Optimization Strategies
| Strategy | Savings | How |
|---|
| Model downgrading | 10–17x | Use GPT-4o-mini instead of GPT-4o for classification |
| Caching | 30–60% | Cache classification results for identical emails |
| Batch processing | 20% | Batch multiple items in one API call |
| Token limits | 15% | Set max_tokens to prevent runaway generation |
| Pre-filtering | 40% | Use deterministic rules before AI (regex, keywords) |
| Local models | 100% (API) | Use Ollama for simple tasks; pay only for infra |
Unlock the full lesson
You've read the first 2 sections. The rest of this lesson covers Build It, Use It, Ship It, Exercises, Key Terms, Common Pitfalls — plus a hands-on lab, quiz, and project artifact.
Create a free account to unlock Phase 0 and Phase 1 of every course — no credit card.
Browse all courses · View pricing · DeVenture Academy