Flint

Why AI agent token costs grow, and how to keep them down in Flint

You have seen the receipt after a long agent task, and the AI agent token costs were higher than the work seemed to justify. Nothing failed. The shape of an agent run is what produced that number.

Short answer: An agent run is not one model call: it is many, and each call sends the full conversation again. The context grows with every step, so cost is not flat across a task. Flint gives you four levers: context swap, which moves old content off the live context without losing it; spend mode, which sets how early swap and compression start; turn limits, which cap what a turn or a session can spend; and model choice, including free models that cost nothing per token.

Why each step costs more than the last

A turn in Flint is one request from you and everything the agent does to answer it. That is many steps, and each step is a call to the model plus the tools the model asked for.

Every one of those calls sends the conversation again. The model keeps no memory between calls, so Flint hands it the whole history each time. The first call in a turn carries a small context. The tenth carries everything the first nine produced: file contents, command output, search results, tool results.

That is the whole mechanism behind compounding cost. A task with twenty steps is not twenty times one step, because the prompt itself grows as the task goes.

Flint shows you the evidence where it matters. Each turn ends with a receipt: the tools used, the files changed, the tokens in and out, the time and the cost. It prints once, when the turn ends, not after each step, and it lists the files changed rather than the files read. /budget shows the running total for the session.

Context swap shrinks the live context without losing anything

Context swap is on by default, and it is the reason a long session does not carry every byte it has ever produced.

When a tool result is large, or when a turn is old enough that the agent is unlikely to need it soon, Flint moves it out of the live conversation and into the session folder on disk. One line stays in its place, so the shape of the conversation is intact. If the agent needs the content later, it reads it back from disk.

Nothing is discarded. With swap on, a tool result is never cut: it is either whole in the live context, or whole in swap. The content sits in the session folder until the agent needs it again, and the prompt stays close to the size of the work in front of you.

Spend mode sets when the controls start

Compression is one of three mechanisms Flint uses to keep context size down, alongside tool search and swap. /spend is the single switch that decides how early those mechanisms begin.

SettingWhen the controls startSuited for
economyearliestlong tasks or tight budgets
normalmid-session (the default)most tasks
generouslatershort tasks

Choose by expected session length, not by how much you like the model. A task you expect to run for an hour with many steps belongs on economy. A quick question, where you want the agent to keep as much as possible in front of it, can afford generous.

Turn limits and session budgets set hard ceilings

A turn is bounded by default. A cost limit per message and a step limit per turn apply to every turn unless you change them, so one turn cannot run or spend without end. You configure nothing to get that.

A budget for the whole session is separate, and it is off unless you set it. It matters most for long runs and for anything unattended: /auto has its own step and cost limits, and a headless run takes a budget on the command line. /budget shows cumulative spending.

The distinction is worth keeping straight. Spend mode changes how fast the context grows. Limits stop a turn or a run when it reaches a ceiling. Spend mode is a dial; limits are a stop.

Free models: zero cost per token, with trade-offs

/model free lists the free models on OpenRouter that can call tools, with speed and uptime taken from OpenRouter's public stats. /model free auto picks the best one and sets two fallbacks from other vendors, so a busy model passes the request to the next instead of failing the turn. The footer counts the day's free requests.

It fits when:

  • The task is exploratory, or the output does not need frontier-model quality.
  • You want to confirm a workflow runs end to end before spending on a paid model.
  • Speed and consistent availability are not requirements.

It does not fit when:

  • The task needs reliable, fast responses across a long session.
  • The work needs the reasoning depth of a frontier model.
  • Rate limits would stall or break a multi-step session.

Free models are weaker than paid frontier models and are often rate-limited. The list of free models also changes without notice, so a model that worked last week may be gone. Free mode works, it is slower and less capable, and it is not a way to run a large task for nothing.

What to watch while a session runs

You do not have to leave the terminal to see what a run is costing.

The footer carries the current model, the session cost, the context size, the care level and the spend level. Read together, those tell you whether the session is behaving the way you planned: a context size that keeps climbing while the cost climbs with it is the compounding effect in real time.

At the end of every turn, the receipt closes the loop with tokens in and out, time, cost, and the files changed.

Warning: The same tool line appearing again and again in the scrollback means the agent is repeating steps without progress, and every repeat adds to the context the next call sends. Press Esc to stop the running turn before the cost compounds further. Pressing Esc again stops background processes.

Before you start a large task

  • Set the spend mode for the length you expect: /spend economy for long tasks, and generous only for short ones.
  • Set a session budget if the task runs unattended or through /auto.
  • Check the /auto step and cost limits and confirm you are comfortable with them.
  • Run /budget before continuing a resumed session, so you know what has already been spent.
  • Run /model test on an unfamiliar model before a long task, to see how it handles small tool-calling tasks.

Frequently asked questions

Why does the second message in a session cost more than the first?

Because the second call sends everything the first exchange produced. The model has no memory of the earlier call, so Flint includes that history in the prompt. The first message sends a short conversation, the second sends a longer one, and the tokens billed follow the prompt.

Does context swap delete or lose any of my earlier work?

No. Swap moves large or old content to the session folder on disk, leaves one line where it was, and the agent reads it back when it needs it. With swap on, a tool result is never cut: it is whole in the live context or whole in swap.

What is the difference between spend mode and a turn cost limit?

Spend mode decides how early swap, tool search and compression start, so it shapes how quickly the context grows. A turn cost limit is a ceiling that stops the turn when spending reaches it. One changes the rate, the other sets the stop.

Can I stop a turn that is already running and spending?

Yes. Press Esc to stop the running turn. Press it again to stop background processes.

Are free models reliable enough for real work?

They are good enough for exploratory work and for confirming that a workflow runs, and they are weaker and more often rate-limited than paid frontier models. For a long session that needs steady, fast responses, treat free mode as a way to try things rather than a way to depend on them.

How do I see the total cost of a finished session?

Each turn prints a receipt with the cost of that turn, and /budget shows the cumulative total for the session. Sessions are saved as you go, so you can resume one later and check the total again.

Can I switch to a cheaper model mid-session without losing my context?

/provider and /model switch the provider and the model in the middle of a conversation. Running /model free auto picks the best available free model and sets two fallbacks from other vendors, so an exploratory session can keep going at no token cost.

If you would rather set the defaults before the next long run than after it, the setup walkthrough takes you from the install command to a first task with the care level and spend mode you want: Set up Flint.