CH·02CLI reference

deeprelay setup aider

Point Aider at deeprelay

Point Aider at deeprelay

Synopsis

Points Aider at deeprelay. After it runs, aider sends its requests to deeprelay's OpenAI-compatible /v1/chat/completions endpoint and starts on a deeprelay model.

What it writes

Setup edits two files in your home directory and leaves everything else in them alone.

In Aider's global config, ~/.aider.conf.yml, it sets two top-level keys. Every comment, blank line and other setting stays exactly as it was:

openai-api-base: https://api.deeprelay.ai/v1
model: openai/deeprelay/deepseek-v4.1-flash

openai-api-base is the API base setup runs against (--api-base, or DEEPRELAY_API_BASE), always ending in /v1.

model carries an openai/ prefix in front of the full deeprelay model ID. Aider hands the name to LiteLLM, and the openai/ prefix tells LiteLLM to send the request to the OpenAI-compatible endpoint in openai-api-base. Without it, Aider would not know where to send the model.

In Aider's model metadata file, ~/.aider.model.metadata.json, setup adds one entry so that Aider knows the model's context window and does not warn that the model is unknown:

{
  "openai/deeprelay/deepseek-v4.1-flash": {
    "max_tokens": 8192,
    "max_input_tokens": 131072,
    "max_output_tokens": 8192,
    "litellm_provider": "openai",
    "mode": "chat"
  }
}

The limits come from the deeprelay catalog. Setup leaves a limit out when the catalog does not list it. Other entries in the file are kept.

Your key never lands in a file

Neither file holds your key, and setup never writes a .env file. Aider reads the key from OPENAI_API_KEY in its environment. That name is shared by every OpenAI tool in a shell, so set it only where you run Aider. Setup and --print print both forms with the absolute path of your deeprelay binary. The shell function below goes in your shell rc (~/.zshrc, ~/.bashrc) and gives the deeprelay key to aider alone:

aider() { OPENAI_API_KEY="$('/usr/local/bin/deeprelay' auth token)" command aider "$@"; }

Or set it in the shell where you start Aider:

export OPENAI_API_KEY="$('/usr/local/bin/deeprelay' auth token)"

Each run calls deeprelay auth token, which reads your key from the deeprelay credentials file (deeprelay login). The key is never stored in your rc file, the Aider files, the setup record or a backup. If you rotate the key, the next run picks up the new one. If OPENAI_API_KEY is not set when you run setup, setup warns.

Setup points Aider's openai-api-base at deeprelay for every Aider run. If OPENAI_API_KEY already holds a key that is not a deeprelay key (an OpenAI key, say), Aider would send that key to deeprelay. Setup checks for this and warns loudly, without printing the value, and prints the line that fixes it. Use the shell function above so your other OpenAI tools keep their own key.

An OpenAI key can also sit in an Aider config file, as openai-api-key: … or as an openai=… entry of api-key. Aider uses that key ahead of OPENAI_API_KEY, so it would go to deeprelay too. If ~/.aider.conf.yml, or the .aider.conf.yml at your git root or in the current directory, holds a key that is not a deeprelay key, setup refuses: it writes nothing, exits non-zero and tells you which file and line hold it, without printing the value. Setup never edits a key line, so delete that line yourself and run setup again. A deeprelay key in that place is allowed to stay, since the file is yours. Setup tells you it is there and recommends the OPENAI_API_KEY form above, and it does not warn about OPENAI_API_KEY, because Aider uses the file's key.

Project files win

Aider loads ~/.aider.conf.yml first, then a .aider.conf.yml at the root of your git repo, then one in the directory you start it in. A later file wins. Setup only writes the global file. If your git root or current directory has its own .aider.conf.yml, setup warns that it overrides the global file there, because a model or openai-api-base in it replaces what setup wrote.

Modes

  • Default: writes both files. Asks before writing.
  • --model : uses that model instead of the default. It must exist on deeprelay and support tool calling.
  • --print: writes nothing. It prints both snippets, the shell function and the export line, so you can merge them yourself.
  • --refresh: rewrites model, openai-api-base and the model's metadata from the current list. It needs an earlier setup, and it shows a diff and backs up the files like setup does.
  • --remove: undoes a previous setup (see below).
  • --force: with --yes, replaces the metadata entry even if you edited it.

Before anything is written

Setup resolves your key the way deeprelay auth token does: from DEEPRELAY_API_KEY if it is set, or else from the credentials file. It reads the model list from GET /v1/models and checks that the model exists and supports tool calling. It makes no billed call. If the API does not serve a recommended list, setup uses the list built into the CLI and says so.

Setup then shows a key-by-key diff and the undo command, and asks you to confirm. --yes skips the prompt for scripts. If stdin is not a terminal and you did not pass --yes, setup stops without writing. If nothing would change, setup says Aider is already configured.

Some YAML layouts (anchors and aliases, for example) cannot be edited without rewriting the file's layout. Setup then writes nothing and prints the two lines to add yourself.

Backups and undo

Before each write, setup copies the existing files into backups/aider/ in the deeprelay config directory (the one holding your credentials file). A later run never overwrites an earlier backup. Setup also records which keys it added or changed, and their earlier values, in the setup directory next to it. No key is ever in either.

deeprelay setup aider --remove replays that record:

  • model and openai-api-base get their earlier values back, or are deleted if setup added them;
  • the metadata entry is deleted if it still holds what setup wrote;
  • entries you edited after setup are left alone, with a warning.

Running --remove again, or when setup never ran, reports "nothing to remove" and exits 0. After removing, you can delete the aider() function or the OPENAI_API_KEY line from your shell rc.

Default model

Aider uses one model, so setup writes one: the first in deeprelay's list of models tested with coding agents. A model covered by your plan comes first. Pick a different one with --model.

Examples

# Configure Aider (asks before writing)
deeprelay setup aider

# No prompt
deeprelay setup aider --yes

# A different model
deeprelay setup aider --model deeprelay/deepseek-v4-pro

# Print the snippets and the key lines
deeprelay setup aider --print

# Update the model and its limits from the catalog
deeprelay setup aider --refresh

# Undo
deeprelay setup aider --remove
deeprelay setup aider [flags]

Options

      --force          With --yes, replace a setup-owned entry you have edited since the last run
  -h, --help           help for aider
      --model string   Use this model instead of the curated list
      --print          Print the config snippet and export line instead of writing any file
      --refresh        Re-sync the configured models from the curated list
      --remove         Undo a previous setup entry by entry
      --yes            Apply without the confirmation prompt (warnings still print)

Options inherited from parent commands

      --api-base string   API base URL (override with DEEPRELAY_API_BASE env) (default "https://api.deeprelay.ai/v1")
      --debug             Enable debug logging to stderr
      --no-preflight      Skip the plan/credit check before inference requests (override with DEEPRELAY_NO_PREFLIGHT env)
  -o, --output string     Output format: table|json (default table on TTY, json otherwise) (default "table")

SEE ALSO

← The gpu CLI