genmux API is now generally available. Read the docs →
genmux API

Blog

Aider with Qwen3-Max and DeepSeek: OPENAI_API_BASE and done

5 min readWritten by genmux API Team


Aider is the pair-programming CLI that edits files in your git repo and commits as it goes. It speaks to any OpenAI-compatible endpoint through LiteLLM, which makes genmux a two-variable change: set the base URL, set the key, prefix the model id with openai/. No tool calling is involved — aider has its own edit formats — so every text model on the platform works, and the interesting decisions are which model and which edit format.

Two variables and a prefix

bash
export OPENAI_API_BASE=https://api.genmux.tech/v1
export OPENAI_API_KEY=nb_live_...        # your genmux key
aider --model openai/deepseek-v4-flash

The openai/ prefix tells LiteLLM to use the OpenAI chat-completions dialect against whatever OPENAI_API_BASE points to; the part after the slash is passed through as model. Any id from the pricing table works: openai/qwen3-max, openai/deepseek-v4-pro, openai/doubao-seed-2-code.

If you would rather not export variables per shell, aider reads a .env in the repo root and a ~/.aider.conf.yml:

yaml
# ~/.aider.conf.yml
model: openai/deepseek-v4-flash
edit-format: whole

The "unknown model" warning is harmless

The first run prints something like:

Warning for openai/deepseek-v4-flash: Unknown context window size and costs, using sane defaults.

Aider keeps a local table of model metadata (context window, price per token) to show its own cost estimate and to decide when to warn you about a long chat. It does not know genmux's ids, so it falls back to conservative defaults. Nothing about the actual requests changes — the model still gets its full context — and the exact charge for each call is on your genmux dashboard, not in aider's estimate. If the warning bothers you, a .aider.model.metadata.json in the repo teaches aider the numbers:

json
{
  "openai/deepseek-v4-flash": {
    "max_input_tokens": 1000000,
    "max_output_tokens": 16384,
    "input_cost_per_token": 0.000000198,
    "output_cost_per_token": 0.000000594,
    "litellm_provider": "openai",
    "mode": "chat"
  }
}

The two cost fields are the per-token form of $0.198 / $0.594 per 1M — the same numbers the DeepSeek V4 Flash page shows.

--edit-format whole or diff

Aider asks the model to return edits in one of several formats and applies them itself. The two that matter here:

  • whole — the model returns the complete new content of each file it changes. Trivially robust: there is nothing to mis-apply. Costs more output tokens on large files.
  • diff — the model returns search/replace blocks. Cheaper on output, but a block whose "search" half does not match the file byte for byte is rejected, and aider re-asks.

Our recommendation from the release runs: start with --edit-format whole on deepseek-v4-flash and deepseek-v3, which never produce a mismatched block because there are no blocks. deepseek-v4-pro and qwen3-max handle diff well and it pays off on files over a few hundred lines. If aider reports "failed to apply edits" more than once in a session, switch to whole and move on — the model is not the problem, the exact-match rule is.

Aider's architect mode (--architect) splits planning and editing between two models. A good pairing on genmux is --model openai/deepseek-v4-pro --editor-model openai/deepseek-v4-flash: Pro decides what to change, Flash writes it out at a third of the price.

Which model

ModelFit for aiderPrice per 1M tokens (in / out)
deepseek-v4-flashDaily driver: fixes, tests, small features; 1M context absorbs a whole repo map$0.198 / $0.594
qwen3-maxStronger on ambiguous specs and larger refactors; 128K context$1.08 / $5.40
deepseek-v4-proHard multi-file changes, architect mode planner$0.594 / $1.782

Thinking is available on all three; aider does not turn it on by itself. --reasoning-effort high sends reasoning_effort, which genmux maps to thinking on for these models — reasoning tokens are billed as output, so use it for the planner, not the editor.

What a 200K-token session costs

A serious aider session — a feature across four or five files with a couple of test runs — lands around 200K tokens. Aider resends the repo map and the files in the chat on every message, so most of that is prompt; with whole edits the output share is larger than in a chat app. Call it 170K prompt and 30K completion tokens:

ModelPrompt (170K)Completion (30K)Session
deepseek-v4-flash$0.034$0.018≈ $0.05
deepseek-v4-pro$0.101$0.053≈ $0.15
qwen3-max$0.184$0.162≈ $0.35

In credits: 4.1 credits≈ $0.05Flash, 12.4 credits≈ $0.15Pro, 27.6 credits≈ $0.35Qwen3-Max at the Scale pack rate. Qwen3-Max's output price is what separates it: on whole edits, where the model retypes entire files, it is worth switching to diff or keeping Qwen for the thinking, not the typing.

Streaming and usage

Aider streams by default and genmux streams the same SSE shape the OpenAI SDK expects, so the diff appears as it is typed. The final chunk carries usage with cost in credits (cost_source: "estimated" on streams — see the streaming post for why). Every aider request is a genmux job: GET /v1/generations?capability=text.chat lists them, which is the reliable way to reconcile a day of aider against the balance.

Getting started

Two exports, an openai/ prefix, and aider is running on DeepSeek or Qwen3 through one genmux key. For OpenCode, which does need function calling, see the OpenCode setup; every supported client is summarised on the coding agents page, and the chat endpoint reference is in the docs.

About the author

Written by genmux API Team — genmux API.

More about us