The .aider.model.metadata.json file: the context and output of each model

Coding with AIAider·· 53 views· 3 min read

.aider.model.metadata.json tells Aider the context and answer size of the models it does not know. It is a plain JSON file, with one block per model. With it, the "Unknown context window size" warning no longer shows for those models.

An example with two models

{
"openai/moonshotai/kimi-k2.7-code": {
"max_tokens": 16000,
"max_input_tokens": 262144,
"max_output_tokens": 16000,
"input_cost_per_token": 0,
"output_cost_per_token": 0,
"litellm_provider": "openai",
"mode": "chat"
},
"openai/deepseek-ai/deepseek-v4-pro": {
"max_tokens": 16000,
"max_input_tokens": 1048576,
"max_output_tokens": 16000,
"input_cost_per_token": 0,
"output_cost_per_token": 0,
"litellm_provider": "openai",
"mode": "chat"
}
}

The Aider documentation uses the same format, with an entry for each model, and asks for the full name with the provider in front. For our models, the provider is openai, the same as in --model.

What goes in each field

Field What to put
The block key The name you pass in --model: openai/ plus the catalogue id, for example openai/moonshotai/kimi-k2.7-code.
max_input_tokens The model's context: the context_length from GET /v1/models.
max_output_tokens The most tokens in each answer. Our examples use 16000, which is enough for coding.
max_tokens In our examples, the same value as max_output_tokens.
input_cost_per_token and output_cost_per_token 0. Aider does not know AI credits or Coding Plan points.
litellm_provider openai, because the API is OpenAI-compatible.
mode chat.

The max_output_tokens in GET /v1/models is the most each model accepts. Do not put a higher value.

Adding another model

1 Find the id in the Models tab and the context_length in the API list (commands below).
2 Copy a whole block, change the key and the max_input_tokens.
3 Put a comma after the } of the block before it. The last block has no comma.
4 Save the file and open Aider again: it only reads the file when it starts.

The ids are in the Models tab of All in One AI or in the API list. On Linux and macOS:

curl "https://api.mozout.com/v1/models?type=text" -H "Authorization: Bearer $MOZOUT_API_KEY"

In Windows PowerShell:

curl.exe "https://api.mozout.com/v1/models?type=text" -H "Authorization: Bearer $env:MOZOUT_API_KEY"

Each model comes with its id (always with the slash), its context_length and its price in pricing. Listing the models spends no credits.

One comma too many or too few, or curly quotes instead of straight ones, and the file is no longer valid JSON. Write it in a plain text editor, not a word processor.
The full file, with every model that supports tools, is in Aider with All in One AI. On Windows, see also how to save the file without .txt.

Want our models in Aider with the right context? Visit the Coding with AI page.

See Coding with AI

SEE ALSO

Where Aider looks for .aider.model.metadata.json: home folder, repository and start folder

Saving .aider.model.metadata.json on Windows without the .txt ending

Aider's Unknown context window size warning: what it means

Aider with All in One AI: the two variables, the openai/ prefix and the context window

Coding with AI in All in One AI

RECOMMENDED PRODUCT

Web hosting with cPanel

Domain and SSL included, daily backups and the panel you already know. from $6.60/mo (3-year plan, with coupon)

See plans
Was this answer helpful? Your answer helps us improve this article.