# Aider (https://inference.net/docs/integrations/aider)

Connect Aider to Inference.net by exporting `OPENAI_API_BASE=https://api.inference.net/v1` and `OPENAI_API_KEY`, then passing any verified catalog model with the `openai/` prefix such as `--model openai/deepseek-v4.1-flash-1017`, `--model openai/moonshotai/kimi-k3`, or `--model openai/glm-5.3`.

## Quick configuration

Create a free account at [/register](/register/?model=deepseek-v4.1-flash-1017) and generate a project key in [API keys](/dashboard/api-keys/). Export these variables in your shell and start Aider:

```bash
export OPENAI_API_BASE="https://api.inference.net/v1"
export OPENAI_API_KEY="inf_sk_..."

# Fast, lowest-cost coding loop (DeepSeek V4.1 Flash 1017)
aider --model openai/deepseek-v4.1-flash-1017

# 1M-context architecture and multimodal coding (Kimi K3 or Kimi K3.1 Pro)
aider --model openai/moonshotai/kimi-k3
aider --model openai/moonshotai/kimi-k3.1-pro

# Deep reasoning and long-output synthesis (GLM-5.3)
aider --model openai/glm-5.3
```

| Aider setting | Value |
| --- | --- |
| `OPENAI_API_BASE` | `https://api.inference.net/v1` |
| US-only `OPENAI_API_BASE` (optional) | `https://us.api.inference.net/v1` |
| `OPENAI_API_KEY` | Your Inference.net API key (`inf_sk_...`) |
| Model flag format | `--model openai/<catalog-model-id>` |
| Live model list | `GET https://api.inference.net/v1/models` |

<Callout title="Keep both openai/ and owner prefixes" tone="info">

Aider routes through LiteLLM, which uses the leading `openai/` prefix to select the OpenAI-compatible provider. Keep any Inference.net catalog owner prefix immediately after it: pass `openai/moonshotai/kimi-k3` or `openai/moonshotai/kimi-k3.1-pro`, never `openai/kimi-k3`.

</Callout>

## Reusable `.aider.conf.yml` setup

Save a `.aider.conf.yml` file in your home directory (`~/.aider.conf.yml`) or repository root so every `aider` session uses Inference.net automatically. Keep your API key in the `OPENAI_API_KEY` environment variable rather than committing it to `.aider.conf.yml`.

```yaml
# ~/.aider.conf.yml
openai-api-base: https://api.inference.net/v1
model: openai/deepseek-v4.1-flash-1017
weak-model: openai/glm-5.3-flash
editor-model: openai/deepseek-v4.1-flash-1017
architect: false
model-metadata-file: ~/.aider.model.metadata.yml
stream: true
```

To use Aider's architect/editor workflow with a stronger planning model and a fast edit model, launch with `--architect`:

```bash
aider --architect \
  --model openai/moonshotai/kimi-k3.1-pro \
  --editor-model openai/deepseek-v4.1-flash-1017
```

## Exact `.aider.model.metadata.yml` for context and cost tracking

Because Inference.net serves 1M-context models under custom catalog IDs, Aider cannot infer context windows or per-token rates from LiteLLM's built-in table. Save `~/.aider.model.metadata.yml` with the exact per-token values verified from `GET https://api.inference.net/v1/models` on 2026-12-06:

```yaml
# ~/.aider.model.metadata.yml
openai/deepseek-v4.1-flash-1017:
  max_tokens: 393216
  max_input_tokens: 1040000
  max_output_tokens: 393216
  input_cost_per_token: 0.00000008
  output_cost_per_token: 0.000000635
  cache_read_input_token_cost: 0.000000007
  litellm_provider: openai
  mode: chat
  supports_vision: true
  supports_function_calling: true

openai/moonshotai/kimi-k3:
  max_tokens: 1048576
  max_input_tokens: 1048576
  max_output_tokens: 1048576
  input_cost_per_token: 0.000000245
  output_cost_per_token: 0.000015
  cache_read_input_token_cost: 0.000000224
  litellm_provider: openai
  mode: chat
  supports_vision: true
  supports_function_calling: true

openai/moonshotai/kimi-k3.1-pro:
  max_tokens: 1048576
  max_input_tokens: 1048576
  max_output_tokens: 1048576
  input_cost_per_token: 0.0000018
  output_cost_per_token: 0.000009
  cache_read_input_token_cost: 0.000000198
  litellm_provider: openai
  mode: chat
  supports_vision: true
  supports_function_calling: true

openai/glm-5.3:
  max_tokens: 943718
  max_input_tokens: 1048576
  max_output_tokens: 943718
  input_cost_per_token: 0.000000084
  output_cost_per_token: 0.000003
  cache_read_input_token_cost: 0.000000079
  litellm_provider: openai
  mode: chat
  supports_vision: false
  supports_function_calling: true

openai/glm-5.3-flash:
  max_tokens: 262144
  max_input_tokens: 1048576
  max_output_tokens: 262144
  input_cost_per_token: 0.0000001
  output_cost_per_token: 0.00000035
  cache_read_input_token_cost: 0.00000003
  litellm_provider: openai
  mode: chat
  supports_vision: true
  supports_function_calling: true
```

## Verified models for Aider

All models below are Inference.net-hosted US routes verified from `GET https://api.inference.net/v1/models` on 2026-12-06:

| Aider `--model` value | Context / max output | Fresh / Cached / Output ($/1M) | Caching mode | Family hub |
| --- | ---: | --- | --- | --- |
| `openai/deepseek-v4.1-flash-1017` | 1,040,000 / 393,216 | `$0.08` / `$0.007` / `$0.635` | Automatic implicit (no key) | [DeepSeek API](/models/deepseek/) |
| `openai/glm-5.3-flash` | 1,048,576 / 262,144 | `$0.10` / `$0.03` / `$0.35` | Requires `prompt_cache_key` | [GLM API](/models/glm/) |
| `openai/glm-5.3` | 1,048,576 / 943,718 | `$0.084` / `$0.079` / `$3.00` | Requires `prompt_cache_key` | [GLM API](/models/glm/) |
| `openai/moonshotai/kimi-k3.1-pro` | 1,048,576 / 1,048,576 | `$1.80` / `$0.198` / `$9.00` | Automatic implicit (no key) | [Kimi API](/models/kimi/) |
| `openai/moonshotai/kimi-k3` | 1,048,576 / 1,048,576 | `$0.245` / `$0.224` / `$15.00` | Automatic implicit (no key) | [Kimi API](/models/kimi/) |

## Prompt caching and Zero Data Retention notes

- **Automatic prefix caching on DeepSeek and Kimi:** `deepseek-v4.1-flash-1017`, `moonshotai/kimi-k3`, and `moonshotai/kimi-k3.1-pro` match identical leading prompt prefixes automatically without extra headers or cache-key fields. Avoid thrashing Aider's `/add` and `/drop` file list mid-task so the repository map and system prompt stay stable across turns. Do not send `prompt_cache_key` to DeepSeek V4.1 Flash routes.
- **Explicit `prompt_cache_key` on GLM-5.3:** `glm-5.3` and `glm-5.3-flash` rely on a stable `prompt_cache_key` body parameter for cache affinity. When running GLM through Aider, configure `extra_params` in `.aider.model.settings.yml` with a stable per-repo key (for example `prompt_cache_key: "aider-my-repo"`) and keep that setting scoped strictly to GLM models.
- **Zero Data Retention (ZDR) scope:** New teams start with [Zero Data Retention](/zero-data-retention/) enabled by default on eligible Inference.net-hosted routes (`deepseek-v4.1-flash-1017`, `glm-5.3`, `glm-5.3-flash`, `moonshotai/kimi-k3`, `moonshotai/kimi-k3.1-pro`), which also support US-only routing via `https://us.api.inference.net/v1`. Externally routed models (such as `deepseek-v4.1-flash`, `glm-5.2`, or `kimi-k2.6`) follow upstream provider retention terms, and ad-supported `-with-ads` models share request data with our advertising partner regardless of ZDR.
- **Estimate session spend:** Compare DeepSeek, Kimi, and GLM session costs in the [Prompt Cache Calculator](/tools/prompt-cache-calculator/) or read [DeepSeek V4.1 vs Kimi K3 vs GLM-5.3 for Coding Agents](/guides/deepseek-vs-kimi-vs-glm-coding-agents/).

## Verify connectivity with cURL

If Aider fails to connect, verify your API key and endpoint directly from your shell:

```bash
curl https://api.inference.net/v1/chat/completions \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "deepseek-v4.1-flash-1017",
    "messages": [{"role": "user", "content": "Reply with OK."}]
  }'
```

## Frequently asked questions

### Why does Aider require the `openai/` prefix in `--model`?

Aider dispatches requests through LiteLLM, which parses the first path segment to choose a provider adapter. Passing `openai/deepseek-v4.1-flash-1017` tells Aider to call your `OPENAI_API_BASE` endpoint and send `deepseek-v4.1-flash-1017` as the `model` field in the JSON payload.

### Why did Aider warn that my model is unknown or show `$0.00` cost?

LiteLLM's bundled pricing table does not include every Inference.net catalog ID. Adding `~/.aider.model.metadata.yml` with the snippet above gives Aider the exact context window, max output ceiling, and per-token pricing so repository maps and cost readouts stay accurate.

### Should I enable `--cache-prompts` in Aider?

Aider's `--cache-prompts` flag injects Anthropic-style `cache_control` markers that are ignored by OpenAI-compatible endpoints. On Inference.net, `deepseek-v4.1-flash-1017`, `moonshotai/kimi-k3`, and `moonshotai/kimi-k3.1-pro` cache repeated prefixes automatically without `--cache-prompts`, while `glm-5.3` and `glm-5.3-flash` use `prompt_cache_key` in the request body.

### Can I pin Aider requests to US-hosted GPUs?

Yes. Set `OPENAI_API_BASE="https://us.api.inference.net/v1"` (or `openai-api-base: https://us.api.inference.net/v1` in `.aider.conf.yml`) and choose any US-hosted model such as `deepseek-v4.1-flash-1017`, `glm-5.3`, or `moonshotai/kimi-k3.1-pro`.

Ready to start? [Create a free API key](/register/?model=deepseek-v4.1-flash-1017), explore the [DeepSeek](/models/deepseek/), [Kimi](/models/kimi/), and [GLM](/models/glm/) hubs, or browse all guides in the [Integrations hub](/docs/integrations/).