Skip to content

Commit 4637af0

Browse files
committed
docs: align models key migration guidance
1 parent d5f96f1 commit 4637af0

2 files changed

Lines changed: 4 additions & 3 deletions

File tree

‎docs/concepts/models.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,8 @@ Custom providers in `models.providers` are written into `models.json` under the
345345
Merge mode precedence for matching provider IDs:
346346

347347
- Non-empty `baseUrl` already present in the agent `models.json` wins.
348-
- Non-empty `apiKey` in the agent `models.json` wins only when that provider is not SecretRef-managed in current config/auth-profile context.
348+
- Plaintext `apiKey` values already present in the agent `models.json` are not preserved in the prompt-facing catalog. When no current config/auth-profile context already supplies that provider credential, OpenClaw migrates the legacy key into the target agent's local `auth-profiles.json` before writing the stripped `models.json`.
349+
- If the legacy `apiKey` migration cannot be durably written, OpenClaw fails closed and leaves the existing `models.json` unchanged instead of writing a stripped catalog that would lose the only credential.
349350
- SecretRef-managed provider `apiKey` values are refreshed from source markers (`ENV_VAR_NAME` for env refs, `secretref-managed` for file/exec refs) instead of persisting resolved secrets.
350351
- SecretRef-managed provider header values are refreshed from source markers (`secretref-env:ENV_VAR_NAME` for env refs, `secretref-managed` for file/exec refs).
351352
- Empty or missing agent `apiKey`/`baseUrl` fall back to config `models.providers`.

‎src/config/schema.help.ts‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -930,7 +930,7 @@ export const FIELD_HELP: Record<string, string> = {
930930
models:
931931
"Model catalog root for provider definitions, merge/replace behavior, and optional Bedrock discovery integration. Keep provider definitions explicit and validated before relying on production failover paths.",
932932
"models.mode":
933-
'Controls provider catalog behavior: "merge" keeps built-ins and overlays your custom providers, while "replace" uses only your configured providers. In "merge", matching provider IDs preserve non-empty agent models.json baseUrl values, while apiKey values are preserved only when the provider is not SecretRef-managed in current config/auth-profile context; SecretRef-managed providers refresh apiKey from current source markers, and matching model contextWindow/maxTokens use the higher value between explicit and implicit entries.',
933+
'Controls provider catalog behavior: "merge" keeps built-ins and overlays your custom providers, while "replace" uses only your configured providers. In "merge", matching provider IDs preserve non-empty agent models.json baseUrl values, while plaintext apiKey values in existing agent models.json are stripped from the prompt-facing catalog and migrated to local auth profiles when they are the only available credential; SecretRef-managed providers refresh apiKey from current source markers, durable migration failures fail closed without rewriting models.json, and matching model contextWindow/maxTokens use the higher value between explicit and implicit entries.',
934934
"models.providers":
935935
"Provider map keyed by provider ID containing connection/auth settings and concrete model definitions. Use stable provider keys so references from agents and tooling remain portable across environments.",
936936
"models.pricing":
@@ -940,7 +940,7 @@ export const FIELD_HELP: Record<string, string> = {
940940
"models.providers.*.baseUrl":
941941
"Base URL for the provider endpoint used to serve model requests for that provider entry. Use HTTPS endpoints and keep URLs environment-specific through config templating where needed.",
942942
"models.providers.*.apiKey":
943-
"Provider credential used for API-key based authentication when the provider requires direct key auth. Use secret/env substitution and avoid storing real keys in committed config files.",
943+
"Provider credential input for API-key based authentication when the provider requires direct key auth. Use secret/env substitution or auth profiles; OpenClaw strips plaintext apiKey values from generated models.json and migrates legacy catalog-only keys into local auth profiles before rewriting that catalog.",
944944
"models.providers.*.auth":
945945
'Selects provider auth style: "api-key" for API key auth, "token" for bearer token auth, "oauth" for OAuth credentials, and "aws-sdk" for AWS credential resolution. Match this to your provider requirements.',
946946
"models.providers.*.api":

0 commit comments

Comments
 (0)