AI & BYOK
Cutting AI costs in automations: nine levers that work
How to reduce LLM API costs in automations: nine practical levers, from model choice per step to structured output and loops, plus how to read cost per node.

AI costs in automations creep for boring reasons: a big model doing a small job, a whole payload pasted into every prompt, an AI call inside a loop, an agent allowed to wander. None of these show up in a per-token calculator, because the calculator assumes you already know how many calls and tokens your workflow makes.
Short answer: to reduce LLM API costs, first measure which step spends the tokens, then pull these levers roughly in order of impact: pick the model per step, replace AI with deterministic steps where rules will do, batch instead of looping, retrieve instead of pasting, trim prompts and cap output, limit agent steps, use structured output, validate before re-asking, and test with Dry Run, which uses no tokens at all. The rest of this post explains each lever with the canvas setting it maps to, then a cost review routine you can run monthly.
Where AI cost actually comes from
Every AI call is billed as input tokens plus output tokens, each at its own rate per million tokens:
cost per call = input tokens ÷ 1,000,000 × input rate
+ output tokens ÷ 1,000,000 × output rateOutput is usually the pricier side. On Anthropic's pricing page, Claude Haiku 4.5 is listed at $1 per million input tokens and $5 per million output tokens, and Claude Sonnet 4.6 at $3 and $15 (checked October 4, 2026). Google's Gemini pricing also prices input and output separately per million tokens. OpenAI's rates are on its API pricing page. Rates change often; always check the current page before you budget.
A workflow's monthly bill is then: calls per run × tokens per call × runs per month. The levers below attack all three factors.
A worked example with those Anthropic list prices: a ticket classifier handles 2,000 tickets a month, sending 1,500 input tokens and getting 200 output tokens back per ticket.
- On Haiku 4.5: 3M input × $1 + 0.4M output × $5 = $3 + $2 = $5 a month.
- On Sonnet 4.6: 3M × $3 + 0.4M × $15 = $9 + $6 = $15 a month.
- On Haiku 4.5 with the prompt trimmed to 600 input tokens: 1.2M × $1 + $2 = $3.20 a month.
The numbers are small, which is the point: for most single-step workflows, AI cost is a rounding error until a multiplier (a loop, an agent, a retry) gets involved. Those multipliers are where the levers pay off.
The nine levers
1. Choose the model per step
The biggest lever, and the easiest. Classification, extraction and routing rarely need a frontier model; drafting customer-facing text sometimes does. In Fluxo Flow you pick the model on each AI step from the providers you've connected, so a workflow can classify on a small model and draft on a larger one. Test the smaller model on twenty real inputs, compare outputs side by side, and only pay for the bigger one where you can see the difference.
2. Don't use AI for rules
If a decision can be written as a condition (amount over 5,000, country is US, field is empty), it belongs in a Router, not a prompt. Reshaping data, renaming fields and building strings belong in a Transformer. Both cost nothing in tokens and never hallucinate. A common anti-pattern is an AI step asked to "decide whether this is high priority" when priority is a field on the ticket.
3. Batch instead of looping
An AI step inside a Loop runs once per item, and every call resends the instructions. Twenty line items with a 400-token instruction and 100 tokens of item data cost 20 × 500 = 10,000 input tokens. One call with all twenty items and the instruction once costs about 400 + 2,000 = 2,400. When items are small and independent, send them as one array and ask for an array back with a JSON schema. The trade-offs are real: one malformed item can spoil the batch, and long batches can hit the output limit, so cap the batch size and keep the Loop for items that need individual attention.
4. Retrieve, don't paste
Pasting a whole policy document or knowledge base into every prompt is the most expensive habit in AI automation. A Retriever step returns only the most relevant entries (top 5 by default) from memory or a dataset, and the AI step works from those. The same applies to emails: send the latest message, not the whole thread, unless the history matters.
5. Trim the prompt and cap the output
Templates often send {{input}}, which is everything: headers, metadata, fields the model never needs. Put a Transformer before the AI step that keeps only the fields the task uses, and you cut input tokens without touching quality. Then cap the other side: set Max Tokens on the step to what a good answer needs, and ask for short fields ("one-sentence reason") rather than paragraphs. Because output is the expensive side, a 150-token answer instead of a 600-token one matters more than it looks.
6. Cap agent steps
An Agent step reasons over several turns and can call tools, and each turn resends the growing context. That's why Anthropic's Building effective agents notes agents trade "higher costs, and the potential for compounding errors" for flexibility. The Agent step's Max Steps setting (3 by default) is your cost ceiling: estimate cost per turn × max steps, and raise it only when you can show the extra turns produce better results. If the path is predictable, a fixed sequence of AI steps is cheaper than an agent.
7. Use structured output
Invalid output is expensive output: you pay for the bad response, then for the retry. Switch AI steps to JSON output with a schema (on Agent steps, the Output Schema JSON field) and the model returns fields you can use directly. OpenAI's docs draw the distinction clearly: JSON mode guarantees valid JSON, while Structured Outputs also guarantees the response adheres to your schema (checked October 4, 2026). Keep the schema tight (enums instead of free text, short strings) and you also cap output tokens.
8. Validate before you re-ask
When a response fails a check, the reflex is to ask the model again. Put a Validator after the AI step instead: it checks the output against rules or a schema at zero token cost and sends failures down a separate branch, to a person or a fallback. Re-asking in a loop is how a single bad input turns into ten paid calls. AI steps also retry on errors by default (twice, with exponential backoff), and every retry is billed, so a step that fails often is a step that costs triple.
9. Build and test with Dry Run
Dry Run simulates AI steps with placeholder output and doesn't use your key, so iterating on structure, branches and data mapping costs nothing. Spend real tokens only on the live runs that test prompt quality, and run those on a handful of representative inputs rather than your whole backlog.
One more, outside the nine because it's about volume rather than tokens: don't process the same event twice. A dedupe step before the AI call (see stopping duplicate records) stops sender retries from buying the same answer again.
Reading cost per node in your run metrics
You can't cut what you can't see. After a live run, open the workflow's Metrics tab: it shows total tokens for the run (split into input and output), the estimated AI cost, and a per-node table you can sort by tokens. The top row is where to start. Then use Compare in the run history to put a run before and after a change side by side; it shows the cost difference per step, and you can export the deltas as CSV.
Two caveats. Estimates use list prices for popular models and are approximate for others, so your provider's console is the source of truth. And compare like with like: the same input before and after the change, or you're measuring the input, not the lever.
Guardrails: the run cap and provider limits
Levers reduce the typical cost; guardrails cap the worst case.
- Per-run cap. Every server run stops if its estimated AI cost passes $2. It's an estimate-based safety stop for runaway loops and agents, not a budget tool. Observer steps can set their own maximum cost too.
- A dedicated key with a spending limit. AI in Fluxo Flow runs on your own provider key, billed by the provider at its rates with no markup. Create a key just for automations and set a monthly limit on it in your provider's console. That's your hard ceiling.
- Watch for key problems. If a scheduled or webhook run finds the key rejected or out of credit, owners and admins are notified, so a spending limit doesn't fail silently.
A monthly cost review routine
Thirty minutes once a month keeps AI spend boring:
- Open your provider's usage page and note the month's spend for the automation key.
- For your three busiest workflows, open a recent live run's Metrics and note the top-token node.
- For each top node, ask in order: could a smaller model do this? Could a Router or Transformer do it? Is it inside a Loop? Is the prompt sending fields it doesn't use?
- Make one change per workflow, Dry Run it, then run the same input live and Compare.
- Check retry and failure counts in the run history; frequent AI step failures are paid failures.
- Re-read Max Tokens and Max Steps on every AI and Agent step; defaults chosen during building are often generous.
Write down what you changed and the before and after cost per run. After two or three months you'll have a short list of rules that fit your workflows, and that's worth more than any generic savings figure.
Live runs, and with them real AI calls, start on Basic ($39/mo); building and Dry Run are free. To see these numbers for your own workflows, connect a key under AI steps and open the Metrics tab after your first live run.
Frequently asked questions
What's the fastest way to reduce LLM API costs in a workflow?
Find the step that uses the most tokens (in Fluxo Flow, sort the run's Metrics tab by tokens) and move it to a smaller model if quality holds. Model choice usually moves the bill more than any prompt tweak.
Why are output tokens more expensive than input tokens?
Providers price them separately and output is usually the higher rate; on several of Anthropic's current models it's five times the input rate. Asking for short, structured answers instead of prose is a direct saving.
Does testing an AI workflow cost tokens?
In Fluxo Flow, Dry Run simulates AI steps with placeholder output and doesn't use your key, so structural testing is free. Live runs call your provider and are billed by it at its rates.
Is structured output cheaper?
Not per call, but it cuts waste: a response that matches your schema doesn't need a retry or a second call to fix it, and a schema with short fields keeps output tokens down.
Put this into practice
Build it on the canvas and Dry Run it on the Free plan, with no credit card. Run it live on a paid plan, on your own AI key.
- AI costs
- tokens
- BYOK
- workflow design


