Heabsy Code from $20/mo · See plans →

Aider on Qwen3.8 27B: Setup, Temperature 0 and What a Fix Cost

by

Published:

Aider talks to any OpenAI-compatible API through LiteLLM: set OPENAI_API_BASE to https://api.heabsy.com/v1 and OPENAI_API_KEY to your key, run aider --model openai/qwen38, and give it the window and prices in .aider.model.metadata.json. On a small Python task Aider 0.86.2 with Qwen3.8 27B fixed the code in one edit and two model calls, for $0.009 to $0.057 at our catalog prices on 12 November 2026. The spread comes from reasoning: Aider sends temperature 0, and at that setting one answer took 16,473 reasoning tokens.

Aider is a terminal tool for editing code with a language model. It works differently from Cline, OpenCode or Kilo: there are no tool calls, you name the files on the command line, and the model answers with edits that Aider applies and commits to git. It reaches any OpenAI-compatible API through LiteLLM, so it runs on an open-weight model such as Qwen3.8 27B.

This tutorial sets Aider up on Qwen3.8 27B through our API, shows the two files that tell Aider what the model is, explains why its default temperature costs money with a reasoning model, and runs one small task three times with every model call logged.

How do you connect Aider to an OpenAI-compatible API?

Install Aider in its own virtual environment (we used Python 3.12) and point it at the API with two environment variables:

python3.12 -m venv ~/.venvs/aider && ~/.venvs/aider/bin/pip install aider-chat
export OPENAI_API_BASE=https://api.heabsy.com/v1
export OPENAI_API_KEY="$HEABSY_API_KEY"
~/.venvs/aider/bin/aider --model openai/qwen38 durations.py tests/test_durations.py

The openai/ prefix tells LiteLLM to use the OpenAI format against OPENAI_API_BASE. Aider edits only the files you name, so list the code and its tests.

LiteLLM’s model list does not include custom endpoints, so Aider does not know the window or the price of openai/qwen38. Give them to it in .aider.model.metadata.json in the project or your home directory (or pass any file with --model-metadata-file):

{
  "openai/qwen38": {
    "max_input_tokens": 1048576,
    "max_output_tokens": 32768,
    "input_cost_per_token": 0.00000105,
    "cache_read_input_token_cost": 0.00000008,
    "output_cost_per_token": 0.00000315,
    "litellm_provider": "openai",
    "mode": "chat"
  }
}

Prices are per token here, not per million: $1.05 per million input tokens becomes 0.00000105.

How do you run it without the chat?

For a script or a CI job, give Aider the task with --message and let it answer every question with yes. To have it run the tests and fix what fails, add a test command:

aider --model openai/qwen38 --yes-always \
  --test-cmd "python -m pytest -q" --auto-test \
  --message "Make all tests pass without changing them; add error handling for invalid input and one new test for it." \
  durations.py tests/test_durations.py

Aider applies the edit, commits it, runs the test command and, if tests fail, sends the output back to the model for another try.

What did one task cost?

The task was a small Python module of our own, not an issue from a public project: durations.py turns strings like "2h30m" into seconds, and 5 of its 8 pytest tests failed (days, spaces between number and unit, upper-case units, a bare number, all of them together). We ran Aider 0.86.2 with Qwen3.8 27B three times on 4 November 2026: twice in the default whole edit format and once with --edit-format diff. Afterwards we ran pytest ourselves and checked that the original tests were untouched.

Whole, run 1 Whole, run 2 Diff
Result 9 passed, 1 new test 9 passed, 1 new test 9 passed, 1 new test
Model calls 2 2 2
Input tokens 3,479 2,694 4,538
Output tokens billed 1,569 17,112 7,795
Cost at catalog prices $0.0086 $0.0567 $0.0293
Wall-clock time 57 s 101 s 41 s

Each run made one edit that passed the tests on the first try, plus a second call for the commit message. Nothing came from the prompt cache: requests this short have little to repeat.

The same task cost from $0.009 to $0.057. Input was a few thousand tokens every time; the difference is output, and almost all of it is reasoning. In the second run 16,473 of the 17,112 output tokens were reasoning, in the diff run 7,191 of 7,795.

Get an API key and run Aider on your own code: Qwen3.8 27B is free for 7 days, no card. After that you pay per token, and your first top-up gets $5 extra. Free requests run at lower priority at peak times.

Why does temperature 0 cost money here?

Aider sends temperature: 0 with every request. For a reasoning model that is greedy decoding, and Qwen3.8 27B then tends to think for a long time before it answers: in one of our runs a single answer carried 16,473 reasoning tokens, and in another the reasoning went in circles before the answer came. Qwen recommends temperature 1.0 for Qwen3.8 27B in thinking mode (model card).

Aider’s model settings file, .aider.model.settings.yml, can change what it sends for a given model. We have not measured runs with a different temperature, so test it on your own tasks before counting on a saving.

Why is Aider’s cost line lower than the bill?

Aider prints a Cost: line after each answer, computed from the text it receives and the prices in the metadata file. Reasoning tokens are billed as output but are not part of that text, so the line comes out 6 to 18 times below the billed amount in our runs: in the second run it showed about $0.003 for a request billed at $0.057. Aider also does not ask for usage figures in the streamed response, so it cannot correct itself. The Logs page of the Heabsy console shows what each request was billed.

Whole or diff?

For a model it does not know, Aider uses the whole format: the model sends back the complete file with every edit. That is simple and worked in both runs, but on a large file every small change costs the whole file in output. --edit-format diff asks for search-and-replace blocks instead; it applied cleanly on our module and was the fastest of the three runs. For anything bigger than a small module, start with diff.

What goes wrong, and how do you fix it?

Symptom Fix
Warning about an unknown model, no cost shown Add .aider.model.metadata.json with the window and prices, or pass --model-metadata-file.
404 Not Found OPENAI_API_BASE must be exactly https://api.heabsy.com/v1, and the model name needs the openai/ prefix.
401 Unauthorized OPENAI_API_KEY is empty in the shell that runs Aider.
An answer takes minutes and costs more than expected Long reasoning at temperature 0; see above. Keep the task small or test a different temperature in the model settings.
The model edits files you did not expect, or none Aider only edits files named on the command line or added with /add.

Where does your code go?

From Aider on your machine straight to api.heabsy.com. Qwen3.8 27B runs on GPUs we operate in the European Economic Area, and prompts and completions are not stored; we keep what billing needs: the model, the token counts and the time. The same task in Cline, OpenCode and Kilo Code is measured the same way.

Method

  • Prices: our model catalog on 12 November 2026 (Qwen3.8 27B): $1.05 input, $0.08 cached input, $3.15 output per million tokens. No input in these runs came from the cache.
  • Runs: Aider 0.86.2, model openai/qwen38 on https://api.heabsy.com/v1, three runs on clean copies of the same module (two whole, one diff), in parallel with other coding agents on 4 November 2026 between 10:02 and 10:13 UTC.
  • Counting: every request went through a logging proxy to our API; tokens are from the usage block of each response, cost is tokens times catalog prices. Aider was also checked directly against the API without the proxy.
  • Checks: pytest after each run and a comparison of the original tests before and after.

FAQ

How do I use Aider with an OpenAI-compatible API?+
Set OPENAI_API_BASE to the API's base URL (for Heabsy https://api.heabsy.com/v1) and OPENAI_API_KEY to your key, then start Aider with --model openai/<model-id>, for example --model openai/qwen38. The openai/ prefix tells LiteLLM, which Aider uses underneath, to speak the OpenAI format to that base URL.
Why does Aider not know the context window of my model?+
Aider takes model limits and prices from LiteLLM's list, which does not include custom endpoints. Put them in .aider.model.metadata.json (or pass a file with --model-metadata-file): max_input_tokens, max_output_tokens and the per-token prices. Without it Aider warns about an unknown model and cannot estimate cost.
Why is the cost Aider shows lower than my bill?+
Aider computes its Cost line from the text it sees, and the model's reasoning is not part of that text. In our runs the line was 6 to 18 times below the billed amount; in one run it said about $0.003 where the API billed $0.057. The Logs page of the Heabsy console shows the billed amount per request.
Should I use whole or diff edit format with Qwen3.8 27B?+
Both worked in our runs. Aider defaults to whole for an unknown model, which resends the full file in every edit; --edit-format diff sends only search-and-replace blocks and is cheaper on large files. On our small module the diff run finished in 41 seconds for $0.029.