fix(config): preserve agent-level apiKey/baseUrl during models.json merge (#27293)

Merged via /review-pr -> /prepare-pr -> /merge-pr.

Prepared head SHA: 6b4b37b03d74e40e14afc2c55fef24a1e59fb0b3
Co-authored-by: Sid-Qin <201593046+Sid-Qin@users.noreply.github.com>
Co-authored-by: gumadeiras <5599352+gumadeiras@users.noreply.github.com>
Reviewed-by: @gumadeiras
This commit is contained in:
Sid
2026-02-26 16:46:36 +08:00
committed by GitHub
parent 92c309f2e1
commit c289b5ff9f
6 changed files with 146 additions and 2 deletions

View File

@@ -207,3 +207,9 @@ mode, pass `--yes` to accept defaults.
Custom providers in `models.providers` are written into `models.json` under the
agent directory (default `~/.openclaw/agents/<agentId>/models.json`). This file
is merged by default unless `models.mode` is set to `replace`.
Merge mode precedence for matching provider IDs:
- Non-empty `apiKey`/`baseUrl` already present in the agent `models.json` win.
- Empty or missing agent `apiKey`/`baseUrl` fall back to config `models.providers`.
- Other provider fields are refreshed from config and normalized catalog data.