SecretRef(基于环境变量/文件/执行/存储的引用),而不是原始密钥值。
范围:
- 范围内:严格由用户提供、且 OpenClaw 不会铸造或轮换的证书。
- 范围外:运行时铸造或轮换的证书、OAuth 刷新材料,以及类会话工件。
docs/reference/secretref-user-supplied-credentials-matrix.json 进行检查;不要手动编辑条目。
支持的凭证
openclaw.json 目标(secrets configure + secrets apply + secrets audit)
models.providers.*.apiKeymodels.providers.*.headers.*models.providers.*.request.auth.tokenmodels.providers.*.request.auth.valuemodels.providers.*.request.headers.*models.providers.*.request.proxy.tls.camodels.providers.*.request.proxy.tls.certmodels.providers.*.request.proxy.tls.keymodels.providers.*.request.proxy.tls.passphrasemodels.providers.*.request.tls.camodels.providers.*.request.tls.certmodels.providers.*.request.tls.keymodels.providers.*.request.tls.passphraseskills.entries.*.apiKeymemory.search.remote.apiKeyagents.entries.*.tts.providers.*.apiKeyagents.entries.*.memory.search.remote.apiKeytalk.providers.*.apiKeytalk.realtime.providers.*.apiKeytts.providers.*.apiKeyplugins.entries.acpx.config.mcpServers.*.env.*plugins.entries.brave.config.webSearch.apiKeyplugins.entries.codex.config.appServer.authTokenplugins.entries.codex.config.appServer.headers.*plugins.entries.exa.config.webSearch.apiKeyplugins.entries.firecrawl.config.webFetch.apiKeyplugins.entries.google-meet.config.realtime.providers.*.apiKeyplugins.entries.google.config.webSearch.apiKeyplugins.entries.google.config.webSearch.headers.*plugins.entries.xai.config.webSearch.apiKeyplugins.entries.moonshot.config.webSearch.apiKeyplugins.entries.perplexity.config.webSearch.apiKeyplugins.entries.firecrawl.config.webSearch.apiKeyplugins.entries.minimax.config.webSearch.apiKeyplugins.entries.tavily.config.webSearch.apiKeyplugins.entries.parallel.config.webSearch.apiKeyplugins.entries.voice-call.config.realtime.providers.*.apiKeyplugins.entries.voice-call.config.streaming.providers.*.apiKeyplugins.entries.voice-call.config.tts.providers.*.apiKeyplugins.entries.voice-call.config.twilio.authTokenplugins.entries.webhooks.config.routes.*.secretgateway.auth.passwordgateway.auth.tokengateway.remote.tokengateway.remote.passwordcron.webhookTokenchannels.telegram.botTokenchannels.telegram.webhookSecretchannels.telegram.accounts.*.botTokenchannels.telegram.accounts.*.webhookSecretchannels.slack.botTokenchannels.slack.appTokenchannels.slack.relay.authTokenchannels.slack.userTokenchannels.slack.signingSecretchannels.slack.accounts.*.botTokenchannels.slack.accounts.*.appTokenchannels.slack.accounts.*.relay.authTokenchannels.slack.accounts.*.userTokenchannels.slack.accounts.*.signingSecretchannels.sms.authTokenchannels.sms.accounts.*.authTokenchannels.buzz.authTagchannels.buzz.privateKeychannels.clickclack.tokenchannels.clickclack.accounts.*.tokenchannels.discord.tokenchannels.discord.pluralkit.tokenchannels.discord.voice.tts.providers.*.apiKeychannels.discord.accounts.*.tokenchannels.discord.accounts.*.pluralkit.tokenchannels.discord.accounts.*.voice.tts.providers.*.apiKeychannels.irc.passwordchannels.irc.nickserv.passwordchannels.irc.accounts.*.passwordchannels.irc.accounts.*.nickserv.passwordchannels.feishu.appSecretchannels.feishu.encryptKeychannels.feishu.verificationTokenchannels.feishu.accounts.*.appSecretchannels.feishu.accounts.*.encryptKeychannels.feishu.accounts.*.verificationTokenchannels.qqbot.clientSecretchannels.qqbot.accounts.*.clientSecretchannels.msteams.appPasswordchannels.mattermost.botTokenchannels.mattermost.accounts.*.botTokenchannels.matrix.accessTokenchannels.matrix.passwordchannels.matrix.accounts.*.accessTokenchannels.matrix.accounts.*.passwordchannels.nextcloud-talk.botSecretchannels.nextcloud-talk.apiPasswordchannels.nextcloud-talk.accounts.*.botSecretchannels.nextcloud-talk.accounts.*.apiPasswordchannels.zalo.botTokenchannels.zalo.webhookSecretchannels.zalo.accounts.*.botTokenchannels.zalo.accounts.*.webhookSecretchannels.googlechat.serviceAccountchannels.googlechat.accounts.*.serviceAccount
auth-profiles.json 目标(secrets configure + secrets apply + secrets audit)
- 存储引用使用符合
^[A-Z][A-Z0-9_]{0,127}$的名称,并且在此版本中仅从 Gateway 范围的团队作用域解析。典型引用为{"source":"store","provider":"default","id":"OPENAI_API_KEY"}。 - 身份验证配置文件计划目标需要
agentId;计划条目以profiles.*.key/profiles.*.token为目标,并写入相邻引用(keyRef/tokenRef)。身份验证配置文件引用包含在运行时解析和审计覆盖范围内。 - 在
openclaw.json中,SecretRef 必须使用结构化对象,例如{"source":"env","provider":"default","id":"DISCORD_BOT_TOKEN"}。在 SecretRef 凭证路径上,旧式的secretref-env:<ENV_VAR>标记字符串会被拒绝;请运行openclaw doctor --fix以迁移有效标记。 - OAuth 策略保护:
auth.profiles.<id>.mode = "oauth"不能与该配置文件的 SecretRef 输入结合使用。违反此策略时,启动/重载和身份验证配置文件解析会立即失败。 - 对于由 SecretRef 管理的模型提供方,生成的
agents/*/agent/models.json条目会保留非密文标记(而不是解析后的密文值),用于apiKey/header 相关字段。标记持久化以源配置为准:OpenClaw 从当前生效的源配置快照(解析前)写入标记,而不是使用解析后的运行时密文值。 - 冷启动 Gateway 可以将可重试的解析失败隔离给已映射的、非 Gateway 所有者。当前已映射的类别包括模型提供方和技能、媒体/TTS/cron 提供方、符合条件的身份验证配置文件、按代理划分的内存、沙箱 SSH、频道账户,以及清单声明的插件路由。启动时会将每个失败所有者的显式引用保留在运行时快照中,通过 status 和 doctor 报告该所有者,并在不尝试更低优先级凭证的情况下拒绝该所有者的请求。重载和配置写入预检使用相同的所有者感知策略:健康的所有者会刷新;符合条件且失败的所有者仅在其引用标识、提供方定义以及完整的非密文所有者契约未发生变化时才保持陈旧状态;新的或已变化的失败会变为冷态。Gateway 入口认证、结构无效的引用或值、fail-closed 所有者,以及当前未映射的所有者仍然保持严格处理。
- 对于网页搜索:在显式提供方模式下(设置了
tools.web.search.provider),只有所选提供方的键处于激活状态。在自动模式下(未设置tools.web.search.provider),只有按优先级解析出的第一个提供方键处于激活状态,未被选中的提供方引用在被选中之前会被视为非激活状态。提供方凭证使用plugins.entries.<plugin>.config.webSearch.*。 - Slack 的
identity: "user"使用channels.slack.userToken,并在 Socket Mode 下配合channels.slack.appToken,或在 HTTP 模式下配合channels.slack.signingSecret。同样的配对规则也适用于channels.slack.accounts.*;此身份不需要 bot token。
- 身份验证配置文件计划目标需要
agentId;计划条目以profiles.*.key/profiles.*.token为目标,并写入相邻引用(keyRef/tokenRef)。身份验证配置文件引用包含在运行时解析和审计覆盖范围内。 - 在
openclaw.json中,SecretRef 必须使用结构化对象,例如{"source":"env","provider":"default","id":"DISCORD_BOT_TOKEN"}。在 SecretRef 凭证路径上,旧式的secretref-env:<ENV_VAR>标记字符串会被拒绝;请运行openclaw doctor --fix以迁移有效标记。 - OAuth 策略保护:
auth.profiles.<id>.mode = "oauth"不能与该配置文件的 SecretRef 输入结合使用。违反此策略时,启动/重载和身份验证配置文件解析会立即失败。 - 对于由 SecretRef 管理的模型提供方,生成的
agents/*/agent/models.json条目会保留非密文标记(而不是解析后的密文值),用于apiKey/header 相关字段。标记持久化以源配置为准:OpenClaw 从当前生效的源配置快照(解析前)写入标记,而不是使用解析后的运行时密文值。 - 冷启动网关可以将可重试的解析失败隔离给已映射的、非网关所有者。当前已映射的类别包括模型提供方和技能、媒体/TTS/cron 提供方、符合条件的身份验证配置文件、按代理划分的内存、沙箱 SSH、频道账户,以及清单声明的插件路由。启动时会将每个失败所有者的显式引用保留在运行时快照中,通过 status 和 doctor 报告该所有者,并在不尝试更低优先级凭证的情况下拒绝该所有者的请求。重载和配置写入预检使用相同的所有者感知策略:健康的所有者会刷新;符合条件且失败的所有者仅在其引用标识、提供方定义以及完整的非密文所有者契约未发生变化时才保持陈旧状态;新的或已变化的失败会变为冷态。网关入口认证、结构无效的引用或值、fail-closed 所有者,以及当前未映射的所有者仍然保持严格处理。
- 对于网页搜索:在显式提供方模式下(设置了
tools.web.search.provider),只有所选提供方的键处于激活状态。在自动模式下(未设置tools.web.search.provider),只有按优先级解析出的第一个提供方键处于激活状态,未被选中的提供方引用在被选中之前会被视为非激活状态。提供方凭证使用plugins.entries.<plugin>.config.webSearch.*。 - Slack 的
identity: "user"使用channels.slack.userToken,并在 Socket Mode 下配合channels.slack.appToken,或在 HTTP 模式下配合channels.slack.signingSecret。同样的配对规则也适用于channels.slack.accounts.*;此身份不需要 bot token。
不支持的证书
这些凭证属于已签发、轮换、带会话或具有 OAuth 持久性的类型,不适合只读的外部 SecretRef 解析:hooks.tokenhooks.gmail.pushTokenhooks.mappings[].sessionKeyauth-profiles.oauth.*channels.discord.threadBindings.webhookTokenchannels.discord.accounts.*.threadBindings.webhookTokenchannels.whatsapp.creds.jsonchannels.whatsapp.accounts.*.creds.json