Commercial vs free models for tool-using agents: long-context economics
None of that changes what a completed task costs, and that's the number nobody prints on the pricing page.
"Commercial versus free" hides three deals. A paid API bundles inference with a billed service. A free tier is that same service with a smaller invoice and a rate limit instead of a card on file. An open-weight checkpoint is an artifact, license aside, and somebody still paid for the training run. Run it yourself and you've swapped a token invoice for hardware, power, and maintenance hours.
the unit you're actually buying
A tool-using agent isn't billing you for tokens, it's billing you for a completed task whose tool calls stay inside policy. The input is an objective, tool schemas, recent tool results, and job state. The failure mode is a loop that won't stop calling tools, a malformed call the parser rejects, or a correct call made without authority. A cheap generation that fails validation, burns a retry, or eats a reviewer's ten minutes costs more than a pricier call that finishes once.
why bucket size beats window size
Raw context size is the wrong headline number; what matters is how much of the window is load-bearing for the next decision. Bucket prompts by length, measure time-to-first-token and answer quality per bucket, and run retrieval-or-compression against sending the whole document under the same evidence and acceptance bar. Count the integration tax if one side gets a native tool the other has to fake.
model + exact revision
input / cached / reasoning / output tokens
queue, first token, completion, timeout rate
pass, retry, abstain, human takeover
license, privacy, fallback constraints
Label every failure: missing evidence, ignored instruction, malformed structure, bad reasoning, tool error, or an unsafe action taken anyway. A small local model can be flawless on routine cases and fail only once context or ambiguity crosses a threshold you can find.
where each side is worth defending
Commercial earns its keep on tasks that genuinely need a huge window, where owning hardware for something occasional makes no sense. That's not license to route everything to the priciest model: put a cheaper tier in the comparison and cap reasoning effort before your budget gets capped for you. Managed capacity is worth paying for when it removes real work, not because a dashboard exists.
Free or open-weight earns its keep on routine, narrow, repeatable prompts fitting a controlled window after retrieval and a reused prefix. That edge compounds with steady utilization and vanishes once the model barely fits, reloads constantly, or needs a runtime one person understands. Spare hardware isn't free if another job loses its slot. The recurring mistake is dumping every document in because the model accepts it: tie every number to a workload and a time window, since price per token is a diagnostic input, not an outcome.
keep the exit door unlocked
Put provider handling behind one narrow adapter, keep prompts and schemas in version control, and store job state outside any vendor's thread object. Contract-test streaming, tool calls, structured output, errors, and token accounting for every route you support.
Fallback is a decision, not an accident. Routing to a local model when the commercial API is down is fine, so long as users know capability changed. If local capacity runs out, quietly shipping sensitive data to a remote provider is worse than the task failing; privacy checks run before routing logic gets a vote. Re-run the comparison whenever traffic, prices, or model versions shift enough to matter.
There's no universal winner. "Free" and "commercial" are procurement labels; a local-first cascade and a subscription that's wrong for the job are both routing decisions wearing a billing costume. Before touching the architecture, pull last month's failed tool calls, tag each with its failure mechanism, and count how many were a context problem versus a validation problem no bigger window would have fixed.