# Aider through Nexus Gateway

> Point Aider at Nexus Gateway with a Nexus API key, so its model calls are metered and recorded on your organization's key.

> **Status: unclaimed.** A recorded run, aider-2026-10-28-1 on 2026-10-28, Aider 0.86.2 and nexus 0.14.0+69e1c09, reached a first call in 5m 47s, but no claims register backs this page yet, so it makes no claim about the tool.

## Read this first

- Nexus has no launcher for Aider. You set two variables in your terminal, and Aider sends its calls to Gateway's OpenAI compatible API, `/v1/chat/completions`, with a Nexus API key: reserved, metered, checked against your organization's policy and attributed to you.
- Gateway cannot tell Aider's calls from any other call on that key. `nexus spend` lists them under Nexus Gateway, direct API calls (`core`), not under `agents`, and no agent session groups them.
- These calls run on a provider key your person, team or organization stored. Nexus credit never pays for them: without a key, Gateway refuses the call with `403`.
- Aider writes the model as `openai/` followed by Gateway's model id, so `openai/gpt-6-luna` becomes `openai/openai/gpt-6-luna`. `nexus models` lists the ids you may use. A call that names no output limit reserves the model's own, so name a small model.
- The API key works until you revoke it in Nexus UI, and anyone holding it spends as you. Keep it out of files and shell history.

## Set up and run

1. Install the nexus CLI. It needs Node.js 22.6 or later and curl. If the installer says its folder is not on your PATH, add the line it prints to your shell's profile, then open a new terminal.

   ```sh
   curl -fsSL https://api.nexus.inc/install.sh | bash
   ```

2. Sign in to Nexus and approve the code in Nexus UI. The code expires after ten minutes.

   ```sh
   nexus auth login
   ```

3. In Nexus UI, open Settings, then Keys, and create a key named `aider`. It is shown once: copy it.

4. Install Aider with its own installer. Nexus never installs it for you. If `aider` is not found afterwards, open a new terminal.

   ```sh
   curl -LsSf https://aider.chat/install.sh | sh
   ```

5. **Owner or admin.** If `nexus keys list` shows no OpenAI key, add the organization's key, once.

   ```sh
   nexus keys add openai <key>
   ```

6. Point Aider at Gateway for this terminal only. After the second line, paste the API key and press Enter: nothing shows, and the key stays out of your shell history.

   ```sh
   export OPENAI_API_BASE=https://api.nexus.inc/v1
   read -rs OPENAI_API_KEY && export OPENAI_API_KEY
   ```

7. Run one prompt through Gateway on a small model. It runs from any folder.

   ```sh
   aider --model openai/openai/gpt-6-luna --no-git --yes-always --message "Reply with the single word pong"
   ```

## Check it worked

The call shows in your spend under Nexus Gateway, direct API calls, and first in its recent calls.

```sh
nexus spend
```

## What Nexus changes for the run

Nexus changes nothing on your computer. You set `OPENAI_API_BASE` to your Gateway's `/v1` and `OPENAI_API_KEY` to your Nexus API key, in one terminal only, and Aider sends its calls there. To go back, close that terminal or run `unset OPENAI_API_BASE OPENAI_API_KEY`, and revoke the key in Nexus UI when you no longer use it.

## How it is tested

- One prompt through Gateway's `/v1/chat/completions` by the steps above, recorded in `nexus spend` under direct API calls

| Run | Date | Aider | nexus | First call | Steps skipped | Result |
| --- | --- | --- | --- | --- | --- | --- |
| aider-2026-10-28-1 | 2026-10-28 | 0.86.2 | 0.14.0+69e1c09 | 5m 47s | `provider_key` | pass |

Each run is a record in `eng/factory/kit/recipes/runs/`, with its steps' times, the call and what got in the way.
