Best Cheap LLM API for Agent Loops

🔧 AI Tools 2026-11-24 6 min read

Agent loops get priced off a per-million-token rate card, while the actual turn is 79% tool result and 3% answer, so the model that looks affordable is not the one that is.

📜 Table of Contents

A single agent turn, counted with a tokenizer rather than guessed: 52 tokens of system prompt, 245 tokens of tool schema for two tools, 26 tokens of user question, 1,232 tokens of tool result, 42 tokens of answer. That is 1,555 input tokens and 42 output. Run a thousand of those turns and the bill ranges from 3 cents to 5.30 dollars depending only on which model sits behind the loop.

The 210x spread is real, and the ranking is not the one most teams assume. Every price below comes from the OpenRouter models endpoint on 2026-11-24, in dollars per million tokens. The token profile comes from the same measurement harness used for the format comparison published today.

What a turn actually costs in tokens

part of the turntokenswhat it was
system prompt52a release-tracking assistant, four sentences and two rules
tool schema245two function definitions with descriptions and parameters
user question26one sentence
tool result1,23212 repository records as compact JSON, 11 fields each
answer42a short table-free reply
total input1,555system, tools, question and result

The tool result is 79 percent of the input. Any agent loop that returns lists or records lives or dies on that one block, which is why the format rules are worth more than the model choice at small scale. Switching that result from compact JSON to a comma-separated table drops the turn to 1,316 input tokens and cuts every cost below by 15 percent.

Eleven models, one turn, ranked by cost

Cost per 1,000 turns uses 1,555 input and 42 output tokens. The monthly column is 300,000 turns, roughly 10,000 turns a day for 30 days, at the short-answer profile.

model (as listed)in $/Mout $/Mcontextper 1,000 turns300k turns
inclusionai/ling-3.0-tiny0.0150.045262,144$0.025$7.56
meta-llama/llama-3.1-8b-instruct0.0200.040131,072$0.033$9.83
mistralai/mistral-nemo0.0290.030131,072$0.046$13.91
qwen/qwen3.7-flash0.0300.1301,000,000$0.052$15.63
deepseek/deepseek-v4.1-flash-10170.0300.2001,048,576$0.055$16.51
z-ai/glm-5.3-flash0.0400.0741,048,576$0.065$19.55
openai/gpt-oss-120b0.0500.250131,072$0.088$26.47
openai/gpt-5-nano0.0500.400400,000$0.095$28.36
anthropic/claude-haiku-4.51.0005.000200,000$1.765$529.50
openai/gpt-5.11.25010.000400,000$2.364$709.13
anthropic/claude-sonnet-4.53.00015.0001,000,000$5.295$1,588.50

Fifteen more entries in the same endpoint list both prices as zero. That is a routing policy rather than a free lunch, it changes without notice, and none of them was measured here, so treat that list as a testing channel rather than a billing plan.

Where the 210x comes from

At 42 output tokens the input price decides almost everything: between 82 and 97 percent of each cost above is the 1,555 input tokens. A model with a cheap prompt price and an expensive completion price still lands low in this table, which is how qwen3.7-flash at 0.030 in and 0.130 out beats gpt-oss-120b at 0.050 and 0.250 despite a worse output rate.

Change the answer length and the ordering shifts. At 400 output tokens per turn the same eleven models cost $0.041, $0.047, $0.057, $0.099, $0.127, $0.092, $0.178, $0.238, $3.555, $5.944 and $10.665 per 1,000 turns, in the order listed above. glm-5.3-flash moves from sixth to fourth, deepseek-v4.1-flash from fifth to sixth, and claude-haiku-4.5 doubles from $1.765 to $3.555. The three cheapest hold their places because their input and output prices sit close together.

Batch variants cut the prices further and trade latency for it. In the same endpoint, glm-5.3-flash:batch lists 0.023 in and 0.068 out against 0.040 and 0.074; gpt-oss-120b:batch lists 0.0296 and 0.136 against 0.050 and 0.250; gpt-5-nano:batch lists 0.025 and 0.200 against 0.050 and 0.400. An agent that runs overnight evaluations rather than answering someone who is waiting should be priced on that row.

What the price sheet does not tell you

Four things decide whether a cheap model is usable in a loop, and none of them are in the models endpoint.

How to choose, in order

  1. Count your own turn first. The 1,555-token profile here is one shape; a loop that returns 50 rows instead of 12 will be dominated by that block and the model choice will matter less.
  2. Shrink the input before shopping. Compact JSON to a flat table cut 15 percent of this turn for free, and the tool schema is another 245 tokens that can often be trimmed.
  3. Set the output budget. At 42 output tokens, input price is 82 to 97 percent of the bill. At 400, half the ranking flips. Know which profile you are in.
  4. Shortlist by cost, then reject on tool-call reliability with a test that uses your actual schemas.
  5. Keep one expensive model for the turns that need it. Routing the hard 5 percent of turns to a model 200 times more expensive adds less to the bill than routing all of them to it.

The input side of the same bill is measured in the MCP tool schema count. The format change that cuts 15 percent of this turn has its own measurement in the eight-format comparison. What embedding calls cost at scale is in the embedding price table.

FAQ

Is the cheapest model always the right one? No. On this profile the four cheapest rows are within $0.03 per 1,000 turns of each other, which is noise next to the cost of one bad tool call. Pick inside that band on reliability.

Why is the spread 210x rather than thousands? Because the turn is input-heavy and short on output, and the cheapest rows are real small models rather than promotional credits. A long-answer profile widens the gap: the same table spans $0.041 to $10.665 at 400 output tokens.

Are these provider prices? They are the list prices served by OpenRouter on 2026-11-24, which routes to upstream providers and may add margin. Direct prices from each provider can differ, and the ordering between two close rows can flip.

Do the free models really cost nothing? Fifteen entries listed zero prompt and zero completion price that day. Free tiers carry their own rate limits, and this test did not measure them, so budget for the possibility that the free channel disappears or throttles.

Related Articles
2026-11-18
Clause Maps Cut Contract Review Tokens 83% and Lost 8 of 32 Clauses
2026-08-15
Best AI Meeting Notetaker for Consultants 2026: 7 Tools That Bill the Hours You Actually Worked
2026-07-11
OpenClaw 5.28: Security Fences Bolted Shut, Video Generation Built Right In
2026-08-23
Best AI Translation Tool in Leipzig 2026: 6 Tools for Trade Fair and Export Teams
2026-08-15
Free AI Video Script Generator 2026: 6 Tools That Write Your Next Video
2026-08-13
AI Mobile App Builder No Code 2026: 6 Tools That Ship to the App Store

Written by our editorial team; tools listed here are tested or verified against public sources. Links point to official sites or GitHub repos for reference only — no paid placements.

💬 Comments (0)

No comments yet. Be the first!

Login to comment