diff --git a/docs/concepts/models.md b/docs/concepts/models.md index 4c6d9077ad8..899dcdce470 100644 --- a/docs/concepts/models.md +++ b/docs/concepts/models.md @@ -67,6 +67,24 @@ to `zai/*`. Provider configuration examples (including OpenCode) live in [/providers/opencode](/providers/opencode). +### Safe allowlist edits + +Use additive writes when updating `agents.defaults.models` by hand: + +```bash +openclaw config set agents.defaults.models '{"openai-codex/gpt-5.4":{}}' --strict-json --merge +``` + +`openclaw config set` protects model/provider maps from accidental clobbers. A +plain object assignment to `agents.defaults.models`, `models.providers`, or +`models.providers..models` is rejected when it would remove existing +entries. Use `--merge` for additive changes; use `--replace` only when the +provided value should become the complete target value. + +Interactive provider setup and `openclaw configure --section model` also merge +provider-scoped selections into the existing allowlist, so adding Codex, +Ollama, or another provider does not drop unrelated model entries. + ## "Model is not allowed" (and why replies stop) If `agents.defaults.models` is set, it becomes the **allowlist** for `/model` and for diff --git a/docs/gateway/configuration-reference.md b/docs/gateway/configuration-reference.md index 2d0247748b4..f81ca2f2643 100644 --- a/docs/gateway/configuration-reference.md +++ b/docs/gateway/configuration-reference.md @@ -1238,6 +1238,8 @@ Time format in system prompt. Default: `auto` (OS preference). - `elevatedDefault`: default elevated-output level for agents. Values: `"off"`, `"on"`, `"ask"`, `"full"`. Default: `"on"`. - `model.primary`: format `provider/model` (e.g. `openai/gpt-5.4`). If you omit the provider, OpenClaw tries an alias first, then a unique configured-provider match for that exact model id, and only then falls back to the configured default provider (deprecated compatibility behavior, so prefer explicit `provider/model`). If that provider no longer exposes the configured default model, OpenClaw falls back to the first configured provider/model instead of surfacing a stale removed-provider default. - `models`: the configured model catalog and allowlist for `/model`. Each entry can include `alias` (shortcut) and `params` (provider-specific, for example `temperature`, `maxTokens`, `cacheRetention`, `context1m`). + - Safe edits: use `openclaw config set agents.defaults.models '' --strict-json --merge` to add entries. `config set` refuses replacements that would remove existing allowlist entries unless you pass `--replace`. + - Provider-scoped configure/onboarding flows merge selected provider models into this map and preserve unrelated providers already configured. - `params`: global default provider parameters applied to all models. Set at `agents.defaults.params` (e.g. `{ cacheRetention: "long" }`). - `params` merge precedence (config): `agents.defaults.params` (global base) is overridden by `agents.defaults.models["provider/model"].params` (per-model), then `agents.list[].params` (matching agent id) overrides by key. See [Prompt Caching](/reference/prompt-caching) for details. - `embeddedHarness`: default low-level embedded agent runtime policy. Use `runtime: "auto"` to let registered plugin harnesses claim supported models, `runtime: "pi"` to force the built-in PI harness, or a registered harness id such as `runtime: "codex"`. Set `fallback: "none"` to disable automatic PI fallback. @@ -2562,6 +2564,7 @@ OpenClaw uses the built-in model catalog. Add custom providers via `models.provi - `models.mode`: provider catalog behavior (`merge` or `replace`). - `models.providers`: custom provider map keyed by provider id. + - Safe edits: use `openclaw config set models.providers. '' --strict-json --merge` or `openclaw config set models.providers..models '' --strict-json --merge` for additive updates. `config set` refuses destructive replacements unless you pass `--replace`. - `models.providers.*.api`: request adapter (`openai-completions`, `openai-responses`, `anthropic-messages`, `google-generative-ai`, etc). - `models.providers.*.apiKey`: provider credential (prefer SecretRef/env substitution). - `models.providers.*.auth`: auth strategy (`api-key`, `token`, `oauth`, `aws-sdk`). diff --git a/docs/gateway/configuration.md b/docs/gateway/configuration.md index f91e105ba71..e68a2b51e34 100644 --- a/docs/gateway/configuration.md +++ b/docs/gateway/configuration.md @@ -166,6 +166,7 @@ placeholders such as `***` or shortened token values. ``` - `agents.defaults.models` defines the model catalog and acts as the allowlist for `/model`. + - Use `openclaw config set agents.defaults.models '' --strict-json --merge` to add allowlist entries without removing existing models. Plain replacements that would remove entries are rejected unless you pass `--replace`. - Model refs use `provider/model` format (e.g. `anthropic/claude-opus-4-6`). - `agents.defaults.imageMaxDimensionPx` controls transcript/tool image downscaling (default `1200`); lower values usually reduce vision-token usage on screenshot-heavy runs. - See [Models CLI](/concepts/models) for switching models in chat and [Model Failover](/concepts/model-failover) for auth rotation and fallback behavior.