Aider

Two environment variables, --model openai/<id>, one key for every model.

Checked 2026-10-28

·All guides·Models

At the end you have aider talking to https://api.uplinkswitch.com/v1 with one API key from the console and any model id on the list after --model openai/, Claude included. Each request bills per token to the prepaid balance behind that key; no subscription, and the live table below is the rate on each model today.

Before you start

You need aider installed (python -m pip install aider-install then aider-install, per its docs), an account on the console with credit on it, and one key created there. Create the key for aider alone, so its requests sit apart from any other tool on the Usage page. The base URL and the key are the whole configuration.

Where the settings are

Aider reads an OpenAI-compatible endpoint from two environment variables, OPENAI_API_BASE and OPENAI_API_KEY, and takes the model as --model openai/<id>. The same values can live in .aider.conf.yml or .env, which aider loads from your home directory, then the root of the git repo, then the current directory; later files win (aider docs, read 2026-10-28).

The config

The quick way is to export the two variables and run aider.

shell
export OPENAI_API_BASE=https://api.uplinkswitch.com/v1
export OPENAI_API_KEY=sk-uplink-live-...
cd /to/your/project
aider --model openai/claude-sonnet-5-5

To keep it, put the same values in .aider.conf.yml in your home directory for every project, or in the repo root for one.

~/.aider.conf.yml
model: openai/claude-sonnet-5-5
weak-model: openai/claude-haiku-5-5
openai-api-base: https://api.uplinkswitch.com/v1
openai-api-key: sk-uplink-live-...

Or a .env file in the same places, with the names from aider's sample file: AIDER_OPENAI_API_BASE for the base URL and OPENAI_API_KEY for the key.

.env
AIDER_OPENAI_API_BASE=https://api.uplinkswitch.com/v1
OPENAI_API_KEY=sk-uplink-live-...
AIDER_MODEL=openai/claude-sonnet-5-5

Which model id to use

Any chat id on the Models page, written as openai/<id>. The Claude ids answer the OpenAI format as well as the Anthropic one, so openai/claude-sonnet-5-5 goes in the same flag as openai/gpt-6.1-sol or openai/deepseek-v4-pro-0813. The ids in the table below are the ones that fit an editing agent: every one takes tool calls and long context.

weak-model handles commit messages and chat history summaries and editor-model the editor tasks; both take the same openai/<id> form, and their defaults follow the main model (aider docs, read 2026-10-28).

Price per token

ModelInput / 1MOutput / 1MCached / 1MList inputList outputUnder list
Claude Sonnet 5.5$1.20$3.00$0.075$2.00$10.0040% on input
Claude Opus 5.5$2.80$10.00$0.15$4.00$20.0030% on input
GPT-6.1 Sol$0.60$3.00$0.06$2.00$10.0070% on input
Gemini 3.1 Pro Preview$1.20$7.20$0.12$2.00$12.0040% on input
DeepSeek V4 Pro 0813$0.792$1.188$0.0625$1.32$3.9640% on input
Kimi K3$0.90$4.50$0.12$3.00$15.0070% on input

USD per million tokens, live from GET /v1/catalog. List: the developer’s own published price. Cached input bills at the cached rate by itself; aider has no switch to set for it here.

Aider sends a repo map along with each request (aider docs, read 2026-10-28), so the input column decides what a session costs. The Claude Code pricing post works an hour, a day and a month of agent turns at these rates.

Name the app in the usage log

Aider passes custom headers through extra_params.extra_headers in .aider.model.settings.yml, and the special name aider/extra_params applies them to every model (aider docs, read 2026-10-28). Two headers name the app on each request's usage record:

.aider.model.settings.yml
- name: aider/extra_params
  extra_params:
    extra_headers:
      HTTP-Referer: https://uplinkswitch.ai
      X-Title: Aider

The file goes in the same three places as .aider.conf.yml, or anywhere with --model-settings-file.

Model metadata, so aider knows the limits and costs

Aider does not know these ids, so it prints "Unknown context window size and costs, using sane defaults" and treats the model as free with unlimited context. Requests work either way. To give it the real figures, save this as .aider.model.metadata.json next to the config file. The costs are per token at today's live rate; the limits are the developer's published ones where the catalog has them.

.aider.model.metadata.json
{
  "openai/claude-sonnet-5-5": {
    "max_input_tokens": 1000000,
    "max_tokens": 128000,
    "max_output_tokens": 128000,
    "input_cost_per_token": 0.0000012,
    "output_cost_per_token": 0.000003,
    "litellm_provider": "openai",
    "mode": "chat"
  },
  "openai/claude-opus-5-5": {
    "max_input_tokens": 1000000,
    "max_tokens": 128000,
    "max_output_tokens": 128000,
    "input_cost_per_token": 0.0000028,
    "output_cost_per_token": 0.00001,
    "litellm_provider": "openai",
    "mode": "chat"
  },
  "openai/gpt-6.1-sol": {
    "max_input_tokens": 1050000,
    "max_tokens": 128000,
    "max_output_tokens": 128000,
    "input_cost_per_token": 6e-7,
    "output_cost_per_token": 0.000003,
    "litellm_provider": "openai",
    "mode": "chat"
  },
  "openai/gemini-3.1-pro-preview": {
    "max_input_tokens": 1048576,
    "max_tokens": 65536,
    "max_output_tokens": 65536,
    "input_cost_per_token": 0.0000012,
    "output_cost_per_token": 0.0000072000000000000005,
    "litellm_provider": "openai",
    "mode": "chat"
  },
  "openai/deepseek-v4-pro-0813": {
    "max_input_tokens": 1048576,
    "max_tokens": 393216,
    "max_output_tokens": 393216,
    "input_cost_per_token": 7.92e-7,
    "output_cost_per_token": 0.0000011879999999999999,
    "litellm_provider": "openai",
    "mode": "chat"
  },
  "openai/kimi-k3": {
    "max_input_tokens": 1048576,
    "max_tokens": 1048576,
    "max_output_tokens": 1048576,
    "input_cost_per_token": 9.000000000000001e-7,
    "output_cost_per_token": 0.0000045,
    "litellm_provider": "openai",
    "mode": "chat"
  }
}

With it in place, aider's own cost line after each turn uses the live rates, and it knows the context window of the model.

Check it

From a shell, the key should list the models:

shell
curl https://api.uplinkswitch.com/v1/models -H "Authorization: Bearer $OPENAI_API_KEY"

Then start aider and send one message. The request shows on the console Usage page within seconds, with its tokens and charge.

Errors you will see

  • 401 invalid_api_key: the key is wrong or revoked, or OPENAI_API_KEY is unset in this shell. Copy it again from the console.
  • 402 insufficient_balance: the balance does not cover the request. Top up in the console.
  • 402 monthly_limit_reached: the key hit the monthly spend limit you set on it. Raise it in the console, or wait for the first of the month.
  • 404 model_not_found: the part after openai/ is not on the Models page. Copy the id from the page rather than typing it: a dot, a dash or a date suffix out of place is enough.
  • 403 scope_denied: the key carries a model allowlist and this id is not on it.
  • 429 rate_limited: the key hit its per-minute or concurrency limit. The response carries retry-after in seconds.
  • "Missing these environment variables": aider could not find OPENAI_API_BASE or OPENAI_API_KEY. Export them, or put them in .env; on Windows restart the terminal after setx.
  • "Unknown context window size and costs": a warning, not an error. The metadata file above removes it.

The same key in other agents

Claude Code takes two environment variables; OpenCode and OpenClaw read a provider block; Cline and Kilo Code take the base URL and key in a settings panel. One balance serves all of them, and a key per tool keeps the spend apart in the console.

Questions

Yes. Set OPENAI_API_BASE to https://api.uplinkswitch.com/v1, OPENAI_API_KEY to your key, and run aider --model openai/claude-sonnet-5-5 or openai/claude-opus-5-5. The Claude ids answer the OpenAI chat completions format here, so aider needs no Anthropic variables.

Export OPENAI_API_BASE, or put openai-api-base in .aider.conf.yml, or AIDER_OPENAI_API_BASE in a .env file next to your project (aider docs, read 2026-10-28). All three take the same value, https://api.uplinkswitch.com/v1, with /v1 on the end.

It tells aider to send the request in the OpenAI format to whatever OPENAI_API_BASE points at. The part after the slash is sent as the model field, so it must be an id from the Models page, exactly as written there.

Aider prints "Unknown context window size and costs, using sane defaults" for any id it has no metadata for (aider docs, read 2026-10-28). The requests still work. The .aider.model.metadata.json block on this page gives aider the figures so the warning stops and its cost line uses the live rates.

Each request bills per token at the live rate in the table above, $1.20 in and $3.00 out per million on Claude Sonnet 5.5 today. Every request shows on the console Usage page within seconds with its tokens and its charge in dollars, filterable by key and model.

Aider uses the weak model for commit messages and chat history summaries, so a small fast id is enough. Any chat id on the Models page works; set it as openai/<id> in .aider.conf.yml or with --weak-model.

Get a key in the console: prepaid credit, no subscription, 30-day price lock.