Sam Austin on October 12, 2026

Best LLM APIs for Building Agents (Pricing and Performance)

Best LLM APIs for Building Agents (Pricing and Performance)
Contents

Figure 1: List prices are abstract — per-run arithmetic is what the bill actually looks like

Per-token prices, cache savings, real per-run math, and the router pattern that keeps costs sane

Your agent demo cost four cents. Your production agent, running 10,000 times a day, costs real money. That gap is where most model choices go wrong.

Agents differ from chatbots because they loop. Every step re-sends the growing conversation, calls tools, and generates more text. So the right API isn't the one with the best headline benchmark. It's the one that finishes your task reliably at a price you can live with. Below, I compare the major options on both counts, with prices checked on October 12, 2026. If you're new to what an agent loop costs token-wise, the build-an-agent-from-scratch guide in this series shows where the tokens go.

What Actually Matters for Agents

Before the price table, a few things decide whether an API suits agent work:

  • Tool-calling reliability: Does the model pick the right tool, fill arguments correctly, and recover when a tool fails?
  • Long-horizon stamina: Can it keep a 30-step plan straight without drifting?
  • Caching: Agents resend the same prefix over and over, so prompt caching can cut input costs dramatically.
  • Output price: Output tokens cost several times more than input tokens, and reasoning counts as output.
  • Latency: Ten sequential calls turn a slow model into a very slow agent.

Per-token price alone is a trap. A cheap model that needs three retries can cost more than an expensive one that nails the task.

The Price List (USD per Million Tokens)

I pulled these from each vendor's pricing page. Standard tier, short-context rates.

Model Input Cached input Output
Claude Fable 5.1 $10 $0.25 $50
GPT-6 Astra $10 $1.00 $50
Claude Opus 5.5 $4 $0.20 $20
Claude Sonnet 5.5 $2 $0.10 $10
GPT-5.6 Terra $2 $0.20 $12
Gemini 3.1 Pro (≤200k prompt) $2 $0.20 $12
Gemini 3.1 Flash-Lite $0.25 $0.025 $1.50
GPT-5.6 Luna $0.20 $0.02 $1.20
Claude Haiku 5.5 (≤100k prompt) $0.10 $0.01 $0.50

A few caveats before you copy this into a spreadsheet:

  • OpenAI's pages disagree on GPT-5.6 Sol. The main pricing page showed $5 input and $30 output. The developer docs showed $4 and $20, with promotional pricing "at least through November 21, 2026." I left Sol out of the table for that reason. Check the live page.
  • Google's Flash prices are promotional. Gemini 3.8 and 3.6 Flash cost $0.75 input and $3.75 output through December 31, 2026, then double. Gemini 3.1 Pro charges more for prompts over 200k tokens.
  • Anthropic's Haiku 5.5 changes price with prompt length. Over 100k tokens, rates jump to $0.50 input and $2.50 output.
  • Tokenizers differ. Anthropic notes that Claude 4.7+ tokenizers produce about 30% more tokens for the same text. Per-token prices don't compare perfectly across vendors.

What One Agent Run Really Costs

List prices are abstract. So I computed the cost of one hypothetical run: 12 LLM calls, 120,000 input tokens in total, 6,000 output tokens, and 75% of input served from cache. This is arithmetic on published rates, not a measurement.

Model Cost per run Per 10,000 runs
Claude Haiku 5.5 $0.007 $69
GPT-5.6 Luna $0.015 $150
Gemini 3.1 Flash-Lite $0.019 $188
Claude Sonnet 5.5 $0.129 $1,290
GPT-5.6 Terra $0.150 $1,500
Gemini 3.1 Pro $0.150 $1,500
Claude Opus 5.5 $0.258 $2,580
Claude Fable 5.1 $0.623 $6,225
GPT-6 Astra $0.690 $6,900

Two lessons jump out. The gap between the cheapest and priciest model is about 100x. And caching matters a lot: for Sonnet 5.5 in this scenario, cost falls from $0.30 per run with no caching to $0.095 at a 90% hit rate. One more assumption to flag: I ignored cache-write surcharges, which Anthropic bills at a premium. Real bills will run a bit higher.

Performance: What the Benchmarks Say (and Don't)

Benchmarks for agents are messy. Different sites test different things, and vendors report their own numbers. Here's what I found, with the appropriate skepticism:

  • BenchLM's agentic leaderboard (October 10) ranked Claude Opus 5.5 first, followed by Claude Fable 5.1, Claude Opus 5, and Google's Gemini 4 Argon. It's a blended score across many benchmarks, and the site says its uncertainty ranges haven't been validated.
  • LLM-Stats' tool-calling ranking (October 12) put GPT-6 Astra first at 35.2, with Claude Sonnet 5.5 at 34.3 and Opus 5.5 at 32.8. The page doesn't explain the scale, so treat the gap as small.

The two rankings disagree on the winner — and that's normal. Both agree on the useful part: the top models sit close together, and price differs far more than capability. That's the real story of 2026.

The Contenders, One by One

Anthropic Claude. Claude gives you the clearest ladder: Haiku 5.5 for cheap steps, Sonnet 5.5 as the default workhorse, Opus 5.5 for harder planning, and Fable 5.1 at the top. Strengths for agents:

  • Cache reads cost a tenth of base input on most models.
  • Batch processing takes 50% off, and it stacks with caching.
  • Models from 4.6 up include the full 1M-token window at standard pricing (Haiku 5.5 excepted).

Sonnet 5.5 is the value pick here. It ranked second on tool calling while costing half of Opus.

OpenAI. OpenAI's ladder runs from Luna (cheap) to Terra (balanced) to Sol and GPT-6 Astra (flagship). Astra's $10/$50 price matches Claude Fable 5.1, but its cached-input rate is four times higher, which hurts agents that resend long contexts. Luna is among the cheapest major-lab options listed.

Google Gemini. Gemini's draw is price and a free tier on several models, handy for prototyping. Gemini 3.1 Pro matches Sonnet and Terra on input price, though its output costs a bit more than Sonnet's. Remember the prompt-length tiers and the promotional Flash pricing that ends in January. Budget for the post-promo number, not the intro number.

Open-weight and budget options. DeepSeek V4.1 Flash lists at roughly $0.22 input and $0.66 output, with open weights under an MIT license. One aggregator noted a data-residency concern, so check where your data goes before you send anything sensitive. Other open options include GLM-5.3 and Mistral Small 4. For running open models on your own hardware instead, see the local LLM tools comparison in this series. I couldn't read DeepSeek's own pricing page, so verify these numbers at the source.

How to Pick

Follow this order:

  1. Start with a mid-tier model like Sonnet 5.5, Terra, or Gemini 3.1 Pro. Get the agent working first.
  2. Measure on your own tasks. Build 30 to 50 realistic test cases and count completions, retries, and cost — the same discipline the evaluation guide preaches.
  3. Downshift where you can. Route simple steps, like classification or formatting, to Haiku, Luna, or Flash-Lite.
  4. Upshift only where it pays. Use Opus or Astra-class models for planning steps that fail on cheaper ones.
  5. Turn on caching early. Put stable content (system prompt, tool definitions) at the front.
  6. Cap steps and budgets. A runaway loop on a $50-per-million model hurts — the guardrails guide covers the mechanics.

This router pattern, with a cheap model for most steps and a strong one for the hard ones, usually beats any single model. And once you're running at scale, trace the token counts per step — the observability guide shows how to see exactly where the spend goes.

CoverBookDescriptionGet it
Cover of “AI Engineering” AI Engineering - model selection, cost engineering, and routing strategies for LLM apps. View on Amazon
Cover of “Designing Agentic AI Systems” Designing Agentic AI Systems - architecture choices that decide your token bill before you pick a model. View on Amazon
Cover of “AI Agents in Action” AI Agents in Action - agent builds where model choice and cost tradeoffs show up per step. View on Amazon

Unlock AI That Actually Works

Get lifetime access to GPT-6 Astra, Claude Fable 5.1, Gemini 3.5, Grok 4.5, and more — all in one platform. Build websites, apps, videos, content, and digital products from a single command. No monthly fees. No tool-hopping.

Click here to get GPTAstra Max now — one-time payment, lifetime access.

Frequently Asked Questions

What is the cheapest LLM API for building agents?

On published rates, the cheapest tier is Claude Haiku 5.5 at $0.10 input and $0.50 output per million tokens, followed by GPT-5.6 Luna at $0.20/$1.20 and Gemini 3.1 Flash-Lite at $0.25/$1.50. In the worked example (12 calls, 120,000 input tokens, 6,000 output tokens, 75% cache hits), that's about $0.007 per run versus $0.69 for the flagship tier — roughly 100x. But per-token price alone is a trap: a cheap model that needs three retries can cost more than an expensive one that nails the task.

Why does prompt caching matter so much for agent cost?

Agents resend the same prefix over and over — system prompt, tool definitions, and the growing conversation — so cached input is where the savings live. Cached reads cost a tenth of base input on most Claude models, and in the worked scenario, caching takes Claude Sonnet 5.5 from $0.30 per run with no caching to $0.095 at a 90% hit rate. Turn caching on early and put stable content at the front of the prompt. One caveat: cache-write surcharges are billed at a premium, so real bills run a bit higher than cache-only arithmetic.

How do I estimate what an agent run will cost?

Multiply your expected call count by input, cached input, and output tokens per run, then apply each vendor's rates — the worked example uses 12 LLM calls, 120,000 total input tokens, 6,000 output tokens, and a 75% cache hit rate to get $0.129 per run on Claude Sonnet 5.5, or about $1,290 per 10,000 runs. Remember that reasoning counts as output tokens, which cost several times more than input. Then validate with your own traced runs before committing, since tokenizers differ across vendors (Anthropic notes Claude 4.7+ tokenizers produce about 30% more tokens for the same text).

Should I pick the model with the best benchmark score?

No — pick the model that finishes your task reliably at a price you can live with. Benchmarks for agents are messy: different sites test different things, vendors report their own numbers, and the rankings disagree on the winner (BenchLM's October 10 agentic leaderboard put Claude Opus 5.5 first; LLM-Stats' October 12 tool-calling ranking put GPT-6 Astra first). Both agree the top models sit close together while price differs far more than capability. Measure on 30 to 50 of your own realistic test cases instead.

Conclusion

No single LLM API wins for every agent. Top models are close on capability, so price, caching, and reliability on your own tasks decide the winner. Start mid-tier, measure honestly, and route work to cheaper models wherever they hold up.

Fifteen minutes of math beats a month of guessing. Grab a cost calculator, plug in your own token counts and cache-hit rate, and run it against three models. Then test those three on your real tasks.

What are You Looking For?

esc