Guide

Use Aider with a free LLM API

Aider is an open-source pair programmer for the terminal. It edits files in your git repository and makes commits. This guide connects Aider to free models through FreeLLMAPI. It also shows the Aider settings that are important for free models: edit format, weak model and repo map size.

Step 1: Install FreeLLMAPI

FreeLLMAPI is an open-source gateway. It runs on your computer in Docker. It pools the free tiers of 45 providers behind one OpenAI-compatible key.

Install on macOS or Linux

curl -fsSL https://freellmapi.co/install.sh | bash

Open http://localhost:3001. Add at least two free provider keys on the Keys page. Copy your unified key from the same page.

Step 2: Connect Aider

The setup command writes ~/.aider.conf.yml. It makes a backup of the existing file first.

One command

npx freellmapi setup-aider --url http://localhost:3001 --api-key <unified-key> --dry-run
npx freellmapi setup-aider --url http://localhost:3001 --api-key <unified-key>
aider

The file that the command writes looks like this:

~/.aider.conf.yml

openai-api-base: "http://localhost:3001/v1"
openai-api-key: "<unified-key>"
model: "openai/auto"

The openai/ prefix is required. It tells Aider to send the model name to an OpenAI-compatible API. To use environment variables and no file, do this:

Environment variables only

export OPENAI_API_BASE=http://localhost:3001/v1
export OPENAI_API_KEY=<unified-key>
aider --model openai/auto

Aider looks for .aider.conf.yml in your home directory, then in the root of your git repository, then in the current directory. The file that loads last has priority. A project file can therefore change the model for one repository.

Step 3: Choose models

Aider sends your files and a repo map in each request. It does not need tool calling for its main edit loop, because it reads edits from the model's text. A large context window and good instruction following are more important. The table shows free models with at least 128K context today.

Free models for Aider: 128K+ context, by intelligence
ModelFree onContextFree limits (best offer)ToolsVision
GLM 5.3APINex, UnoRouter1M5 req/min
10M weighted tokens/day shared across APINex free routes; 4x token multiplier; 5 requests/minute/account
YesNo
GLM 5.3 FlashAPINex, BlazeAPI, NVIDIA NIM +1 more1M40 req/min
40 RPM
YesYes
Gemini 3.8 FlashAPINex, Google AI Studio1M5 req/min
10M weighted tokens/day shared across APINex free routes; 3x token multiplier; 5 requests/minute/account
YesYes
Qwen3.8 Flash NextAMD Radeon Cloud, BlazeAPI, ElectronHub262KRecurring daily account allowanceYesNo
Qwen3.8 FlashElectronHub1M$0.25/week shared recurring creditYesYes
Deepseek V4.1 FlashAPINex1M5 req/min
10M weighted tokens/day shared across APINex free routes; 3x token multiplier; 5 requests/minute/account
NoNo
Gemini 3.7 FlashGoogle AI Studio1M10 req/min
20 req/day
250,000 tokens/min
~3M
YesYes
GPT-5.6 LunaElectronHub1M$0.25/week shared recurring creditYesYes
Dots3 Note PreviewKilo Gateway, OpenRouter512K20 req/min
50 req/day
50 req/day account-wide (1,000 after a $10 purchase)
YesYes
DeepSeek V4 FlashAMD Radeon Cloud, BazaarLink, ElectronHub1M10 req/min
50 req/day
Shared rate limit
YesNo
DeepSeek V4 Flash 0731ElectronHub, Router91M10,000 credits/month (~$1), shared; account-anniversary resetNoNo
Qwen3.8 27BBlazeAPI, ElectronHub, Gizmo +3 more262K30 req/min
250 req/day
70,000 tokens/min
~6M
YesYes

Showing 12 of 184 matching free models. See all models.

Live data from the FreeLLMAPI catalog (version 2026.11.19, checked 19 November 2026). Free limits change often. The catalog is checked every day.

Use openai/auto to let the router select a model. Use openai/auto:smart to prefer the models with the highest intelligence. To pin one model, use openai/ and a catalog id from GET /v1/models.

You can also set the models for one session on the command line. This example uses the strongest models for edits. It uses fast models for commit messages and chat history summaries:

Models for one session

aider --model openai/auto:smart --weak-model openai/auto:fast

For a planned profile, make a fallback chain on the FreeLLMAPI dashboard, for example a chain named coding. Then use --model openai/auto:coding. An unknown profile name returns a 400 error, so the request does not go to a different chain without notice.

Aider settings for free models

Aider knows the settings for well-known models. A gateway model such as auto is not known, so set these values yourself.

SettingWhat it doesRecommended value for free models
edit-formatThe format that the model uses to send edits: whole, diff, diff-fenced or udiffdiff for strong models. whole for weak models, because it is simpler but sends more tokens.
weak-modelThe model for commit messages and chat history summariesopenai/auto:fast, so small tasks do not use your strong model's quota
map-tokensThe number of tokens for the repo map. 0 turns it off.1024 or less on small free tiers
architectOne model plans the change and an editor model writes the editsOptional. It doubles the number of requests.

~/.aider.conf.yml with settings for free models

openai-api-base: "http://localhost:3001/v1"
openai-api-key: "<unified-key>"
model: "openai/auto"
weak-model: "openai/auto:fast"
edit-format: diff
map-tokens: 1024

To give Aider the context window of a gateway model, add a .aider.model.metadata.json file. The key is the full model name. Aider looks for this file in the same places as the config file.

~/.aider.model.metadata.json

{
  "openai/auto": {
    "max_input_tokens": 128000,
    "max_output_tokens": 8192,
    "litellm_provider": "openai",
    "mode": "chat"
  }
}

Rate limits and failover

Free tiers have limits per minute and per day. FreeLLMAPI counts each key's use. When a provider sends a 429 error, the router sends the request to the next model in your chain. Aider does not see the error and continues.

  • Add keys from four or more providers. More providers give more requests per day.
  • Add only the files that you want to change with /add. Each file is in every request.
  • Use /clear between tasks to send a shorter chat history. A short history also lowers the tokens per minute.
  • Use /drop to remove files that you do not need any more.

Troubleshooting

ProblemCauseFix
"Model openai/auto: Unknown context window size and costs, using sane defaults."Aider does not know the gateway modelThis warning is usually harmless. To remove it, add .aider.model.metadata.json.
The edit did not applyThe model did not follow the edit formatUse --edit-format whole, or a stronger model
401 "Invalid API key"Aider sends a different key, for example from another config fileCheck the config files in the home directory, git root and current directory
Aider calls api.openai.comThe openai/ prefix is used, but the base URL is not setSet openai-api-base or OPENAI_API_BASE
"All models rate-limited after N attempts"All keys are at their limitAdd keys from more providers, or reduce map-tokens
Use every one of these through one key. FreeLLMAPI is an open-source, self-hosted router that puts all these free tiers behind a single OpenAI-compatible endpoint and fails over when one is rate-limited. Browse the catalog or go live.

Frequently asked questions

Can I use Aider for free?

Yes. Aider is open source. Point it at FreeLLMAPI with openai-api-base and the openai/ model prefix. The gateway uses free provider tiers, so inference costs $0.

How do I use Aider with an OpenAI-compatible API?

Set OPENAI_API_BASE and OPENAI_API_KEY, then run aider --model openai/. The openai/ prefix is required. You can put the same values in .aider.conf.yml.

Which edit format should I use with free models?

Use diff for strong models, because it sends fewer tokens. If edits fail to apply, use whole. It is simpler for weak models but sends the full file each time.

What does 'Unknown context window size and costs, using sane defaults' mean?

Aider does not know the model name, so it uses default values. The warning is usually harmless. Add .aider.model.metadata.json with the context window to remove it.

Which free model is best for Aider?

Use a model with a large context window and good instruction following. The table on this page shows the strongest free models with 128K or more context today.

Sources

All guides · Browse all free models

Keep reading

All posts →
Guide

Best free LLM APIs 2026

Ten genuinely free LLM APIs worth using — ranked, with real limits.

Guide

Unlimited free AI tokens?

No free AI API is unlimited. The closest real thing: 10.1 billion free tokens a month behind one key.

Guide

How to get a free LLM API key

Get a working key in minutes — no credit card required.