CH·02CLI reference

deeprelay setup zed

Point Zed at deeprelay

Point Zed at deeprelay

Synopsis

Points Zed's agent panel at deeprelay. After it runs, Zed lists deeprelay as an OpenAI-compatible provider, sends its requests to deeprelay's /v1/chat/completions endpoint and starts the agent panel on a deeprelay model.

What it writes

Setup edits Zed's user settings, ~/.config/zed/settings.json (under $XDG_CONFIG_HOME when that is set). Zed uses this path on macOS as well as Linux. Setup changes two keys and leaves the rest of the file alone. Comments, trailing commas, formatting, other providers under language_models and other openai_compatible entries stay exactly as they were.

The deeprelay provider and the default model:

{
  "language_models": {
    "openai_compatible": {
      "deeprelay": {
        "api_url": "https://api.deeprelay.ai/v1",
        "available_models": [
          {
            "name": "deeprelay/deepseek-v4.1-flash",
            "display_name": "deeprelay/deepseek-v4.1-flash",
            "max_tokens": 131072,
            "max_output_tokens": 8192,
            "capabilities": {
              "tools": true,
              "images": false,
              "parallel_tool_calls": false,
              "prompt_cache_key": false,
              "chat_completions": true,
              "interleaved_reasoning": false,
              "max_tokens_parameter": false
            }
          }
        ]
      }
    }
  },
  "agent": {
    "default_model": { "provider": "deeprelay", "model": "deeprelay/deepseek-v4.1-flash" }
  }
}

available_models holds every model in deeprelay's list of models tested with coding agents, in that list's order. name is the exact deeprelay model ID, because Zed sends it unchanged. max_tokens is the context length from the deeprelay catalog, and max_output_tokens the catalog's maximum output; setup leaves max_output_tokens out when the catalog does not list one.

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

Your key never lands in a file

Zed's own guidance is to keep API keys out of settings.json, and setup writes nothing key-shaped there. Zed gets the key one of two ways:

  1. The keychain. Open Agent settings in Zed, find the deeprelay provider and paste the output of deeprelay auth token. Zed stores it in your system keychain.
  2. An environment variable. Zed names it after the provider ID, so the deeprelay provider reads DEEPRELAY_API_KEY. A non-empty variable wins over the keychain. Add this line to your shell rc (~/.zshrc, ~/.bashrc); setup and --print print it with the absolute path of your deeprelay binary:
export DEEPRELAY_API_KEY="$('/usr/local/bin/deeprelay' auth token)"

Then start Zed from that shell (zed .). Zed started from the Dock or a launcher does not see shell variables, so use the keychain route for that.

Setup prints both steps after it writes. If DEEPRELAY_API_KEY is not set when you run setup, it also warns. The key is never stored in settings.json, your rc file, the setup record or a backup, and setup never writes a key file.

Modes

  • Default: writes the deeprelay provider and the agent panel's default model. Asks before writing.
  • --model : writes only that model instead of the curated list. It must exist on deeprelay and support tool calling.
  • --print: writes nothing. It prints the settings snippet, the export line and the keychain step, so you can merge the snippet yourself.
  • --refresh: rewrites available_models, api_url and the default model from the current list. It needs an earlier setup, and it shows a diff and backs up the file like setup does.
  • --remove: undoes a previous setup (see below).
  • --force: with --yes, replaces setup's entries even if you edited them (see below).

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 each 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 Zed is already configured.

Setup owns language_models.openai_compatible.deeprelay as a whole. If you edited it after setup (renamed a model or changed api_url, say), a run asks before replacing your edit. --yes alone leaves the edited entry alone, writes everything else, and exits non-zero. --yes --force replaces it.

If settings.json is not valid JSON or JSONC, setup stops with an error and writes nothing.

Backups and undo

Before each write, setup copies the existing file into backups/zed/ 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 zed --remove replays that record:

  • language_models.openai_compatible.deeprelay is deleted if it still holds what setup wrote;
  • agent.default_model gets its earlier value back, or is deleted if setup added it;
  • 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. A key you pasted into Zed stays in the keychain; remove it in Agent settings. You can also delete the DEEPRELAY_API_KEY line from your shell rc.

Default model

The default model is the first one in deeprelay's list of models tested with coding agents. A model covered by your plan comes first. Every other model on the list is in available_models, so the agent panel's model picker can switch to it. Pick a single model with --model.

Examples

# Configure Zed (asks before writing)
deeprelay setup zed

# No prompt
deeprelay setup zed --yes

# Only one model
deeprelay setup zed --model deeprelay/deepseek-v4-pro

# Print the snippet, the shell rc line and the keychain step
deeprelay setup zed --print

# Update the model list from the catalog
deeprelay setup zed --refresh

# Replace setup's entries even though you edited them
deeprelay setup zed --refresh --yes --force

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

Options

      --force          With --yes, replace a setup-owned entry you have edited since the last run
  -h, --help           help for zed
      --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