---
title: "Aider with an OpenAI-compatible API (unlimited DeepSeek)"
description: "Connect the Aider coding agent to BroadNet Inference through its OpenAI-compatible setting and run it on a flat-price, unlimited DeepSeek V4.1 Flash plan."
url: https://broadrouter.com/guides/aider-unlimited-deepseek/
lang: en
updated: 2026-11-16
publisher: BroadRouter (a BroadNet site); API by BroadNet Inference, https://inference.broadnet.ai
---

# Run Aider on unlimited DeepSeek V4.1 Flash

Updated 2026-11-16

Aider connects to any OpenAI-compatible API. Set OPENAI\_API\_BASE to https://inference.broadnet.ai/v1 and OPENAI\_API\_KEY to your BroadNet key, then run aider --model openai/broadnet/deepseek-v4.1-flash. The openai/ prefix selects Aider's OpenAI-compatible route. On an unlimited plan key, DeepSeek V4.1 Flash tokens are not metered, so long repository sessions stay at a flat price.

Coding agents resend large parts of your repository on every turn, so per-token billing grows fast. An [unlimited plan session](https://broadrouter.com/guides/unlimited-llm-api-sessions/) removes the meter. These steps follow [Aider’s OpenAI-compatible setup](https://aider.chat/docs/llms/openai-compat.html).

## 1\. Install Aider

```bash
python -m pip install aider-install
aider-install
```

## 2\. Point it at BroadNet Inference

```bash
export OPENAI_API_BASE=https://inference.broadnet.ai/v1
export OPENAI_API_KEY='your-broadnet-plan-key'
```

On Windows, use `setx OPENAI_API_BASE https://inference.broadnet.ai/v1` and `setx OPENAI_API_KEY your-key`, then open a new terminal. Aider’s docs say to restart the shell after `setx`.

Keep the `/v1` at the end of the base URL. Aider adds the chat-completions path itself.

## 3\. Start it on your codebase

```bash
cd /path/to/your/project
aider --model openai/broadnet/deepseek-v4.1-flash
```

The `openai/` prefix tells Aider to use the OpenAI-compatible endpoint; the rest is BroadNet’s model ID. Aider will warn: “Unknown context window size and costs, using sane defaults.” That is expected for models outside its built-in list. Its [model warnings page](https://aider.chat/docs/llms/warnings.html) says the warning can usually be ignored.

## 4\. Optional: tell Aider about the model

To remove the warning and give the model room to reason, add two files to your home directory or the repository root. Aider reads both from either place, as described in its [advanced model settings docs](https://aider.chat/docs/config/adv-model-settings.html).

`.aider.model.metadata.json`:

```json
{
  "openai/broadnet/deepseek-v4.1-flash": {
    "max_input_tokens": 1048576,
    "litellm_provider": "openai",
    "mode": "chat"
  }
}
```

`.aider.model.settings.yml`:

```yaml
- name: openai/broadnet/deepseek-v4.1-flash
  edit_format: diff
  extra_params:
    max_tokens: 16000
```

Aider’s default edit format for unknown models is `whole`, which resends whole files. `diff` sends only the changed blocks. If edits fail to apply, remove the `edit_format` line to go back to `whole`.

## Tips

-   **One Aider window, one session.** If you run two Aider instances at the same time, buy two sessions or they queue behind each other.
-   **Reasoning uses tokens.** DeepSeek V4.1 Flash reasons before it answers, and BroadNet counts that toward `max_tokens`. [Why answers come back empty](https://broadrouter.com/guides/reasoning-tokens-empty-response/).
-   **Try an hour first.** A Meteor plan costs $1 for one hour, which is enough to judge it on a real task.

## Troubleshooting

-   **401 Unauthorized.** `OPENAI_API_KEY` is missing, wrong or expired. Check that the shell running Aider has the variable; on Windows, open a new terminal after `setx`.
-   **Requests go to OpenAI instead of BroadNet.** `OPENAI_API_BASE` isn’t set in this shell, or the model name lacks the `openai/` prefix. Run `echo $OPENAI_API_BASE` to check.
-   **Model not found.** The part after `openai/` must be `broadnet/deepseek-v4.1-flash` exactly. A plan key covers DeepSeek V4.1 Flash only; other BroadNet models need a pay-as-you-go key.
-   **Empty or cut-off replies.** Raise `max_tokens` in `.aider.model.settings.yml` as shown above.
-   **Edits don’t apply.** Switch `edit_format` back to `whole`, or try `--edit-format whole` on the command line.
-   **Slow replies or 429.** A plan session runs one request at a time; a second Aider window queues. A pay-as-you-go key allows 30 requests a minute and 4 at once. See [errors and retries](https://broadrouter.com/guides/errors-and-retries/).

Prefer an agent inside VS Code? See [the Cline setup guide](https://broadrouter.com/guides/cline-openai-compatible/), or compare them in [Cline vs Roo Code vs Aider](https://broadrouter.com/blog/cline-vs-roo-code-vs-aider/).

[Choose a plan on BroadNet Inference](https://inference.broadnet.ai/plans?utm_source=broadrouter&utm_medium=referral&utm_campaign=guides-aider-unlimited-deepseek&utm_content=body)

## Terms in this guide

[Pay-as-you-go](https://broadrouter.com/glossary/pay-as-you-go/)

Pay-as-you-go is a pricing model in which you pay only for what you use, metered per unit such as tokens, requests or audio minutes, with no subscription or minimum commitment. Most LLM APIs bill this way, from a prepaid balance or a periodic invoice.

[Token](https://broadrouter.com/glossary/token/)

A token is the unit of text a language model reads and writes: a word, part of a word, a punctuation mark or a byte sequence produced by the model's tokenizer. LLM APIs count, limit and usually bill usage in tokens.

[AI coding agent](https://broadrouter.com/glossary/coding-agent/)

An AI coding agent is a software tool in which a language model works on a codebase in a loop: it reads files, edits them, runs commands such as tests, reads the output and decides the next step until the task is done or a limit is reached.

[Base URL](https://broadrouter.com/glossary/base-url/)

A base URL is the fixed root address of an API, such as https://api.example.com/v1, that a client puts in front of every endpoint path, such as /chat/completions. In OpenAI-compatible SDKs, changing the base URL, together with the API key and model ID, points the same code at a different provider.

[Concurrency](https://broadrouter.com/glossary/concurrency/)

Concurrency is the number of requests a client has in flight at the same time. LLM APIs often cap it per key or plan, separately from requests per minute, because each open request holds GPU capacity until its response has finished.

[Context window](https://broadrouter.com/glossary/context-window/)

A context window is the maximum number of tokens a language model can work with in a single request. It covers the prompt, conversation history, tool definitions, images and the generated output, including any reasoning tokens. Anything that does not fit must be cut, summarised or split across several requests.

[Rate limit](https://broadrouter.com/glossary/rate-limit/)

A rate limit is a cap an API places on how much a client can use it in a time window, such as requests per minute or tokens per minute. Requests over the limit are refused, usually with HTTP 429 Too Many Requests, until usage falls back under it.

## Questions

### How do I use Aider with an OpenAI-compatible API?

Set OPENAI\_API\_BASE to the provider's base URL and OPENAI\_API\_KEY to its key, then start aider with --model openai/ followed by the provider's model ID. For BroadNet that is openai/broadnet/deepseek-v4.1-flash with base URL https://inference.broadnet.ai/v1.

### Why does Aider say "Unknown context window size and costs"?

Aider has no built-in metadata for BroadNet model IDs, so it assumes an unlimited context and zero cost. Aider's docs say the warning can usually be ignored. To remove it, add the model to .aider.model.metadata.json.

### Do I need the openai/ prefix if the model ID already starts with broadnet/?

Yes. Aider reads the first part as the provider route. openai/ sends the request to OPENAI\_API\_BASE, and broadnet/deepseek-v4.1-flash is the model ID BroadNet receives.

### Why does Aider get empty or cut-off replies from DeepSeek V4.1 Flash?

The model reasons before it answers, and BroadNet counts reasoning toward max\_tokens. Set a higher max\_tokens through extra\_params in .aider.model.settings.yml.

## Related guides

-   [How the unlimited LLM API plans work for agents](https://broadrouter.com/guides/unlimited-llm-api-sessions/)
-   [Why a reasoning model returns an empty answer](https://broadrouter.com/guides/reasoning-tokens-empty-response/)
-   [Use Cline with BroadNet Inference (OpenAI Compatible provider)](https://broadrouter.com/guides/cline-openai-compatible/)
-   [BroadNet Inference error codes and when to retry](https://broadrouter.com/guides/errors-and-retries/)
-   [All tools that work with BroadNet Inference](https://broadrouter.com/integrations/): SDKs, coding agents, chat UIs and automation tools, with exact settings for each

Try it on your real workload. New accounts start with $5 of credit for Gemma and transcription. DeepSeek, GLM and Qwen3.8 need a top-up.

[Get started](https://inference.broadnet.ai/account/?utm_source=broadrouter&utm_medium=referral&utm_campaign=guides-aider-unlimited-deepseek&utm_content=page-cta) ·

**Sources**

-   [Aider docs, OpenAI compatible APIs (checked 2026-11-14)](https://aider.chat/docs/llms/openai-compat.html)
-   [Aider docs, model warnings (checked 2026-11-14)](https://aider.chat/docs/llms/warnings.html)
-   [Aider docs, advanced model settings (checked 2026-11-14)](https://aider.chat/docs/config/adv-model-settings.html)
-   [BroadNet Inference API reference](https://inference.broadnet.ai/docs?utm_source=broadrouter&utm_medium=referral&utm_campaign=guides-aider-unlimited-deepseek&utm_content=sources)
-   [BroadNet Inference unlimited plans](https://inference.broadnet.ai/plans?utm_source=broadrouter&utm_medium=referral&utm_campaign=guides-aider-unlimited-deepseek&utm_content=sources)
