Back to blog

Cost optimizationGuide

How much does Aider cost? What it sends and how to cut the bill

Aider is free; the model API is what you pay for. See what each request carries, estimate a session and run Aider on a cheaper model.

By CheapTokens TeamPublished Updated 5 min read

Aider terminal: /tokens shows repo map, files and history, then /clear
On this page
  1. What Aider sends on every request
  2. A session, in numbers
  3. Four habits that shrink the input
  4. Run Aider on a cheaper model
  5. Where the money goes: a checklist

Aider is free and open source, so the only thing you pay for is the model API behind it. And the bill is driven by input: every request carries the repo map, the files you added and the chat history, not just your one-line instruction. Trim those three and the cost drops; point Aider at a cheaper model and it drops again.

What Aider sends on every request#

Three things ride along with your message. The first is described in Aider's docs (checked 23 October 2026, aider-chat 0.86.2 on PyPI, released 12 February 2026); the other two are simply how a chat API works:

  • The repo map. Aider's repo map page says it sends the model a map of your repository: files plus the key symbols with their definition lines. Its size is set by --map-tokens, which defaults to 1k tokens. The map is resized dynamically and can grow significantly when no files have been added to the chat. The docs give no upper bound, so don't assume one.
  • Files you added. Everything you /add goes in full, every time. Files added with /read-only are reference only, but they still occupy context.
  • The chat history. Earlier messages and replies are resent with each new request. If that sounds familiar, it is the same mechanic as in why a long AI chat costs more.

The output side is usually small by comparison: a diff or an edited block. If the input-versus-output split is new to you, input vs output tokens covers it in a few minutes.

A session, in numbers#

Say you add two source files of about 3,000 tokens each and ask Aider to refactor a module. The first request is roughly the map (about 1,000 tokens), the files (about 6,000) and your message: around 7,000 input tokens. Nothing unusual yet.

Now keep going. Each follow-up ("also rename it in the tests", "that broke the import, fix it") resends all of that plus every earlier exchange. In a long session the history can outgrow the files. That is the catch: the tenth request costs more than the first one, though you typed fewer words.

For an estimate, take these assumptions: 30 requests in a session, an average of 15,000 input tokens per request (map, files and a growing history) and 800 output tokens per reply. One request on MiniMax-M2.7 through CheapTokens costs $0.00087. The whole 30-request session looks like this, with the OpenRouter column next to it:

Model Per request 30 requests OpenRouter, 30 requests
GLM-5.3-Flash $0.00033 $0.01 $0.0204
DeepSeek-V4-Flash $0.00031 $0.0092 $0.0251
MiniMax-M2.7 $0.00087 $0.0261 $0.164

15,000 input and 800 output tokens per request. Prices per 1M tokens are current and change together with our tariffs; the OpenRouter column shows reference prices for the same workload.

Change the assumptions to your own: if you work with one small file, your input will be nearer 5,000; with a big repo and no files added, the map alone may take more.

Four habits that shrink the input#

  1. Check before you guess. /tokens reports the tokens used by the current chat context. Run it when a session starts to feel heavy. (Aider's docs don't say it shows a cost, so read it as a size, not a price.)
  2. Drop what you're done with. /drop removes files from the chat and frees context. A file you added for the first task and forgot rides along on every later request.
  3. Clear the history between tasks. /clear wipes the chat history; /reset drops all files and clears history at once. A new task rarely needs the old conversation.
  4. Use /read-only for reference. Types, configs, an API spec the model should see but not edit.

A refactor is done, you start on a bug in another module, and you type /reset. The next request goes out with the map and the one new file instead of two old files and a long history:

Before and after /reset: map, two old files and a long history versus map and one new file
What the next request carries before and after /reset

Run Aider on a cheaper model#

Habits trim the input; the model price decides what each token costs. Aider talks to any OpenAI-compatible endpoint, per its docs: set OPENAI_API_BASE and OPENAI_API_KEY, then start Aider with --model openai/<model-name>. On Windows use setx and restart the shell.

bash
export OPENAI_API_BASE=https://api.cheaptokens.dev/v1
export OPENAI_API_KEY=YOUR_CHEAPTOKENS_KEY   # placeholder
aider --model openai/deepseek-ai/DeepSeek-V4-Flash-0731

The full gateway id goes after the openai/ prefix; the short id from price tables is not accepted by the API. For the step-by-step setup, see how to connect Aider to CheapTokens.

Which model for which work:

  • DeepSeek-V4-Flash (0731): the pick for long sessions and big edits. 380K context, up to 32,768 output tokens per answer, one price at any hour with no peak pricing, and in total, with input and output counted together, it is cheaper than OpenRouter. More on the DeepSeek page.
  • MiniMax-M2.7: the one for routine edits and renames. 180K context, up to 8,192 output tokens, and in total it is cheaper than OpenRouter too. See the MiniMax page.
  • GLM-5.3-Flash: when the repo is big and you want a 390K context window; output is cheaper than OpenRouter, up to 8,192 output tokens.

One balance covers all three, so switching is just a different --model value. Current prices are on the pricing page; the API details are in the docs.

Where the money goes: a checklist#

  • Repo map: 1k by default, but larger when no files are in the chat. Add the files you work on.
  • Files in chat: every one is resent every time. /drop the finished ones.
  • History: grows with every exchange. /clear between tasks.
  • Model: the same session costs different amounts on different models; the table above shows your numbers.

Start with /tokens on your current session, then swap the model and compare the table with what you spend now.