Advanced model settings
In most cases, you can safely ignore aider's warning about unknown context window size and model costs.
Overview
Advanced model settings
Context window size and token costs
In most cases, you can safely ignore aider's warning about unknown context window size and model costs.
{: .note } Aider never enforces token limits, it only reports token limit errors from the API provider. You probably don't need to configure aider with the proper token limits for unusual models.
But, you can register context window limits and costs for models that aren't known
to aider. Create a .aider.model.metadata.json file in one of these locations:
- Your home directory.
- The root if your git repo.
- The current directory where you launch aider.
- Or specify a specific file with the
--model-metadata-file <filename>switch.
If the files above exist, they will be loaded in that order. Files loaded last will take priority.
The json file should be a dictionary with an entry for each model, as follows:
{
"deepseek/deepseek-chat": {
"max_tokens": 4096,
"max_input_tokens": 32000,
"max_output_tokens": 4096,
"input_cost_per_token": 0.00000014,
"output_cost_per_token": 0.00000028,
"litellm_provider": "deepseek",
"mode": "chat"
}
}
{: .tip }
Use a fully qualified model name with a provider/ at the front
in the .aider.model.metadata.json file.
For example, use deepseek/deepseek-chat, not just deepseek-chat.
That prefix should match the litellm_provider field.
Contribute model metadata
Aider relies on litellm's model_prices_and_context_window.json file for model metadata.
Consider submitting a PR to that file to add missing models.
Model settings
Aider has a number of settings that control how it works with different models. These model settings are pre-configured for most popular models. But it can sometimes be helpful to override them or add settings for a model that aider doesn't know about.
Configuration file locations
You can override or add settings for any model by creating a .aider.model.settings.yml file in one of these locations:
- Your home directory.
- The root of your git repo.
- The current directory where you launch aider.
- Or specify a specific file with the
--model-settings-file <filename>switch.
If the files above exist, they will be loaded in that order. Files loaded last will take priority.
The YAML file should be a list of dictionary objects for each model.
Passing extra params to litellm.completion
The extra_params attribute of model settings is used to pass arbitrary
extra parameters to the litellm.completion() call when sending data
to the given model.
For example:
- name: some-provider/my-special-model
extra_params:
extra_headers:
Custom-Header: value
max_tokens: 8192
You can use the special model name aider/extra_params to define
extra_params that will be passed to litellm.completion() for all models.
Only the extra_params dict is used from this special model name.
For example:
- name: aider/extra_params
extra_params:
extra_headers:
Custom-Header: value
max_tokens: 8192
These settings will be merged with any model-specific settings, with the
aider/extra_params settings taking precedence for any direct conflicts.
Default model settings
Below are all the pre-configured model settings to give a sense for the settings which are supported.
You can also look at the ModelSettings class in
models.py
file for more details about all of the model setting that aider supports.
The first entry shows all the settings, with their default values. For a real model, you just need to include whichever fields that you want to override the defaults.
- name: (default values)
edit_format: whole
weak_model_name: null
use_repo_map: false
send_undo_reply: false
lazy: false
overeager: false
reminder: user
examples_as_sys_msg: false
extra_params: null
cache_control: false
caches_by_default: false
use_system_prompt: true
use_temperature: true
streaming: true
editor_model_name: null
editor_edit_format: null
reasoning_tag: null
remove_reasoning: null
system_prompt_prefix: null
accepts_settings: null
- name: anthropic.claude-opus-4-20250514-v1:0
edit_format: diff
weak_model_name: anthropic.claude-3-5-haiku-20241022-v1:0
use_repo_map: true
extra_params:
extra_headers:
anthropic-beta: prompt-caching-2024-07-31,pdfs-2024-09-25,output-128k-2025-02-19
max_tokens: 32000
cache_control: true
editor_model_name: anthropic.claude-sonnet-4-20250514-v1:0
editor_edit_format: editor-diff
accepts_settings:
- thinking_tokens
- name: anthropic.claude-sonnet-4-20250514-v1:0
edit_format: diff
weak_model_name: anthropic.claude-3-5-haiku-20241022-v1:0
use_repo_map: true
extra_params:
extra_headers:
anthropic-beta: prompt-caching-2024-07-31,pdfs-2024-09-25,output-128k-2025-02-19
max_tokens: 64000
cache_control: true
editor_model_name: anthropic.claude-sonnet-4-20250514-v1:0
editor_edit_format: editor-diff
accepts_settings:
- thinking_tokens
- name: anthropic/claude-3-5-haiku-20241022
edit_format: diff
weak_model_name: anthropic/claude-3-5-haiku-20241022
use_repo_map: true
extra_params:
extra_headers:
anthropic-beta: prompt-caching-2024-07-31,pdfs-2024-09-25
cache_control: true
- name: anthropic/claude-3-5-sonnet-20240620
edit_format: diff
weak_model_name: anthropic/claude-3-5-haiku-20241022
use_repo_map: true
examples_as_sys_msg: true
extra_params:
extra_headers:
anthropic-beta: prompt-caching-2024-07-31,pdfs-2024-09-25
max_tokens: 8192
cache_control: true
editor_model_name: anthropic/claude-3-5-sonnet-20240620
editor_edit_format: editor-diff
- name: anthropic/claude-3-5-sonnet-20241022
edit_format: diff
weak_model_name: anthropic/claude-3-5-haiku-20241022
use_repo_map: true
examples_as_sys_msg: true
extra_params:
extra_headers:
anthropic-beta: prompt-caching-2024-07-31,pdfs-2024-09-25
max_tokens: 8192
cache_control: true
editor_model_name: anthropic/claude-3-5-sonnet-20241022
editor_edit_format: editor-diff
- name: anthropic/claude-3-5-sonnet-latest
edit_format: diff
weak_model_name: anthropic/claude-3-5-haiku-20241022
use_repo_map: true
examples_as_sys_msg: true
extra_params:
extra_headers:
anthropic-beta: prompt-caching-2024-07-31,pdfs-2024-09-25
max_tokens: 8192
cache_control: true
editor_model_name: anthropic/claude-3-5-sonnet-20241022
editor_edit_format: editor-diff
- name: anthropic/claude-3-7-sonnet-20250219
edit_format: diff
weak_model_name: anthropic/claude-3-5-haiku-20241022
use_repo_map: true
overeager: true
examples_as_sys_msg: true
extra_params:
extra_headers:
anthropic-beta: prompt-caching-2024-07-31,pdfs-2024-09-25,output-128k-2025-02-19
max_tokens: 64000
cache_control: true
editor_model_name: anthropic/claude-3-7-sonnet-20250219
editor_edit_format: editor-diff
accepts_settings:
- thinking_tokens
- name: anthropic/claude-3-7-sonnet-latest
edit_format: diff
weak_model_name: anthropic/claude-3-5-haiku-20241022
use_repo_map: true
overeager: true
examples_as_sys_msg: true
extra_params:
extra_headers:
anthropic-beta: prompt-caching-2024-07-31,pdfs-2024-09-25,output-128k-2025-02-19
max_tokens: 64000
cache_control: true
editor_model_name: anthropic/claude-3-7-sonnet-latest
editor_edit_format: editor-diff
accepts_settings:
- thinking_tokens
- name: anthropic/claude-3-haiku-20240307
weak_model_name: anthropic/claude-3-haiku-20240307
examples_as_sys_msg: true
extra_params:
extra_headers:
anthropic-beta: prompt-caching-2024-07-31,pdfs-2024-09-25
cache_control: true
- name: anthropic/claude-opus-4-20250514
edit_format: diff
weak_model_name: anthropic/claude-3-5-haiku-20241022
use_repo_map: true
extra_params:
extra_headers:
anthropic-beta: prompt-caching-2024-07-31,pdfs-2024-09-25,output-128k-2025-02-19
max_tokens: 32000
cache_control: true
editor_model_name: anthropic/claude-sonnet-4-20250514
editor_edit_format: editor-diff
accepts_settings:
- thinking_tokens
- name: anthropic/claude-sonnet-4-20250514
edit_format: diff
weak_model_name: anthropic/claude-3-5-haiku-20241022
use_repo_map: true
extra_params:
extra_headers:
anthropic-beta: prompt-caching-2024-07-31,pdfs-2024-09-25,output-128k-2025-02-19
max_tokens: 64000
cache_control: true
editor_model_name: anthropic/claude-sonnet-4-20250514
editor_edit_format: editor-diff
accepts_settings:
- thinking_tokens
- name: azure/gpt-4.1
edit_format: diff
weak_model_name: azure/gpt-4.1-mini
use_repo_map: true
reminder: sys
editor_model_name: azure/gpt-4.1-mini
- name: azure/gpt-4.1-mini
edit_format: diff
use_repo_map: true
reminder: sys
- name: azure/gpt-5
edit_format: diff
weak_model_name: azure/gpt-5-nano
use_repo_map: true
use_temperature: false
accepts_settings:
- reasoning_effort
- name: azure/gpt-5-2025-08-07
edit_format: diff
weak_model_name: azure/gpt-5-nano-2025-08-07
use_repo_map: true
use_temperature: false
accepts_settings:
- reasoning_effort
- name: azure/gpt-5-chat
edit_format: diff
weak_model_name: azure/gpt-5-nano
use_repo_map: true
use_temperature: false
accepts_settings:
- reasoning_effort
- name: azure/gpt-5-chat-latest
edit_format: diff
weak_model_name: azure/gpt-5-nano
use_repo_map: true
use_temperature: false
accepts_settings:
- reasoning_effort
- name: azure/gpt-5-mini
edit_format: diff
weak_model_name: azure/gpt-5-nano
use_repo_map: true
use_temperature: false
accepts_settings:
- reasoning_effort
- name: azure/gpt-5-mini-2025-08-07
edit_format: diff
weak_model_name: azure/gpt-5-nano-2025-08-07
use_repo_map: true
use_temperature: false
accepts_settings:
- reasoning_effort
- name: azure/gpt-5-nano
edit_format: diff
weak_model_name: azure/gpt-5-nano
use_repo_map: true
use_temperature: false
accepts_settings:
- reasoning_effort
- name: azure/gpt-5-nano-2025-08-07
edit_format: diff
weak_model_name: azure/gpt-5-nano-2025-08-07
use_repo_map: true
use_temperature: false
accepts_settings:
- reasoning_effort
- name: azure/gpt-5-pro
edit_format: diff
weak_model_name: azure/gpt-5-mini
use_repo_map: true
examples_as_sys_msg: true
use_temperature: false
streaming: false
editor_model_name: azure/gpt-5
editor_edit_format: editor-diff
system_prompt_prefix: 'Formatting re-enabled. '
accepts_settings:
- reasoning_effort
- name: azure/gpt-5.1
edit_format: diff
weak_model_name: azure/gpt-5-nano
use_repo_map: true
use_temperature: false
accepts_settings:
- reasoning_effort
- name: azure/gpt-5.1-2025-11-13
edit_format: diff
weak_model_name: azure/gpt-5-nano-2025-08-07
use_repo_map: true
use_temperature: false
accepts_settings:
- reasoning_effort
- name: azure/gpt-5.1-chat
edit_format: diff
weak_model_name: azure/gpt-5-nano
use_repo_map: true
use_temperature: false
accepts_settings:
- reasoning_effort
- name: azure/gpt-5.1-chat-latest
edit_format: diff
weak_model_name: azure/gpt-5-nano
use_repo_map: true
use_temperature: false
accepts_settings:
- reasoning_effort
- name: azure/gpt-5.2
edit_format: diff
weak_model_name: azure/gpt-5-nano
use_repo_map: true
use_temperature: false
accepts_settings:
- reasoning_effort
- name: azure/gpt-5.2-2025-12-11
edit_format: diff
weak_model_name: azure/gpt-5-nano-2025-08-07
use_repo_map: true
use_temperature: false
accepts_settings:
- reasoning_effort
- name: azure/gpt-5.2-chat-latest
edit_format: diff
weak_model_name: azure/gpt-5-nano
use_repo_map: true
use_temperature: false
accepts_settings:
- reasoning_effort
- name: azure/gpt-5.3
edit_format: diff
weak_model_name: azure/gpt-5-nano
use_repo_map: true
use_temperature: false
accepts_settings:
- reasoning_effort
- name: azure/gpt-5.3-chat-latest
edit_format: diff
weak_model_name: azure/gpt-5-nano
use_repo_map: true
use_temperature: false
accepts_settings:
- reasoning_effort
- name: azure/gpt-5.3-pro
edit_format: diff
weak_model_name: azure/gpt-5-mini
use_repo_map: true
examples_as_sys_msg: true
use_temperature: false
streaming: false
editor_model_name: azure/gpt-5.3
editor_edit_format: editor-diff
system_prompt_prefix: 'Formatting re-enabled. '
accepts_settings:
- reasoning_effort
- name: azure/gpt-5.4
edit_format: diff
weak_model_name: azure/gpt-5-nano
use_repo_map: true
use_temperature: false
accepts_settings:
- reasoning_effort
- name: azure/gpt-5.4-chat-latest
edit_format: diff
weak_model_name: azure/gpt-5-nano
use_repo_map: true
use_temperature: false
accepts_settings:
- reasoning_effort
- name: azure/gpt-5.4-pro
edit_format: diff
weak_model_name: azure/gpt-5-mini
use_repo_map: true
examples_as_sys_msg: true
use_temperature: false
streaming: false
editor_model_name: azure/gpt-5.4
editor_edit_format: editor-diff
system_prompt_prefix: 'Formatting re-enabled. '
accepts_settings:
- reasoning_effort
- name: azure/o1
edit_format: diff
weak_model_name: azure/gpt-4o-mini
use_repo_map: true
use_temperature: false
streaming: false
editor_model_name: azure/gpt-4o
editor_edit_format: editor-diff
accepts_settings:
- reasoning_effort
- name: azure/o1-mini
weak_model_name: azure/gpt-4o-mini
use_repo_map: true
use_system_prompt: false
use_temperature: false
editor_model_name: azure/gpt-4o
editor_edit_format: editor-diff
- name: azure/o1-preview
edit_format: diff
weak_model_name: azure/gpt-4o-mini
use_repo_map: true
use_system_prompt: false
use_temperature: false
editor_model_name: azure/gpt-4o
editor_edit_format: editor-diff
- name: azure/o3
edit_format: diff
weak_model_name: azure/gpt-4.1-mini
use_repo_map: true
examples_as_sys_msg: true
streaming: false
editor_model_name: azure/gpt-4.1
editor_edit_format: editor-diff
system_prompt_prefix: 'Formatting re-enabled. '
accepts_settings:
- reasoning_effort
- name: azure/o3-mini
edit_format: diff
weak_model_name: azure/gpt-4o-mini
use_repo_map: true
use_temperature: false
editor_model_name: azure/gpt-4o
editor_edit_format: editor-diff
system_prompt_prefix: 'Formatting re-enabled. '
accepts_settings:
- reasoning_effort
- name: azure/o3-pro
edit_format: diff
weak_model_name: azure/gpt-4.1-mini
use_repo_map: true