技术参考
SecretRef 凭证界面
本文档定义了规范的 SecretRef 凭证界面。范围界定如下:
- 范围内:严格指用户提供的、OpenClaw 不会生成或轮换的凭证。
- 范围外:运行时生成或轮换的凭证、OAuth 刷新材料以及会话类工件。
支持的凭证
openclaw.json 目标(secrets configure + secrets apply + secrets audit)
models.providers.*.apiKeymodels.providers.*.headers.*skills.entries.*.apiKeyagents.defaults.memorySearch.remote.apiKeyagents.list[].memorySearch.remote.apiKeytalk.apiKeytalk.providers.*.apiKeymessages.tts.elevenlabs.apiKeymessages.tts.openai.apiKeytools.web.search.apiKeytools.web.search.gemini.apiKeytools.web.search.grok.apiKeytools.web.search.kimi.apiKeytools.web.search.perplexity.apiKeygateway.auth.passwordgateway.auth.tokengateway.remote.tokengateway.remote.passwordcron.webhookTokenchannels.telegram.botTokenchannels.telegram.webhookSecretchannels.telegram.accounts.*.botTokenchannels.telegram.accounts.*.webhookSecretchannels.slack.botTokenchannels.slack.appTokenchannels.slack.userTokenchannels.slack.signingSecretchannels.slack.accounts.*.botTokenchannels.slack.accounts.*.appTokenchannels.slack.accounts.*.userTokenchannels.slack.accounts.*.signingSecretchannels.discord.tokenchannels.discord.pluralkit.tokenchannels.discord.voice.tts.elevenlabs.apiKeychannels.discord.voice.tts.openai.apiKeychannels.discord.accounts.*.tokenchannels.discord.accounts.*.pluralkit.tokenchannels.discord.accounts.*.voice.tts.elevenlabs.apiKeychannels.discord.accounts.*.voice.tts.openai.apiKeychannels.irc.passwordchannels.irc.nickserv.passwordchannels.irc.accounts.*.passwordchannels.irc.accounts.*.nickserv.passwordchannels.bluebubbles.passwordchannels.bluebubbles.accounts.*.passwordchannels.feishu.appSecretchannels.feishu.verificationTokenchannels.feishu.accounts.*.appSecretchannels.feishu.accounts.*.verificationTokenchannels.msteams.appPasswordchannels.mattermost.botTokenchannels.mattermost.accounts.*.botTokenchannels.matrix.passwordchannels.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.serviceAccount通过同级的serviceAccountRef(兼容性例外)channels.googlechat.accounts.*.serviceAccount通过同级的serviceAccountRef(兼容性例外)
auth-profiles.json 目标(secrets configure + secrets apply + secrets audit)
profiles.*.keyRef(type: "api_key")profiles.*.tokenRef(type: "token")
注意事项:
- 身份验证配置文件计划目标需要
agentId。 - 计划条目目标为
profiles.*.key/profiles.*.token,并写入同级的引用(keyRef/tokenRef)。 - 身份验证配置文件引用包含在运行时解析和审计覆盖范围内。
- 对于由 SecretRef 管理的模型供应商,生成的
agents/*/agent/models.json条目会为apiKey/header 字段保留非密钥标记(而非解析后的密钥值)。 - 对于网络搜索:
- 在显式供应商模式(设置了
tools.web.search.provider)下,仅选定的供应商密钥处于活动状态。 - 在自动模式(未设置
tools.web.search.provider)下,tools.web.search.apiKey和特定于供应商的密钥均处于活动状态。
- 在显式供应商模式(设置了
不支持的凭证
范围外的凭证包括:
commands.ownerDisplaySecretchannels.matrix.accessTokenchannels.matrix.accounts.*.accessTokenhooks.tokenhooks.gmail.pushTokenhooks.mappings[].sessionKeyauth-profiles.oauth.*discord.threadBindings.*.webhookTokenwhatsapp.creds.json
原因说明:
- 这些凭证属于生成型、轮换型、会话持有型或 OAuth 持久型类别,不适合只读的外部 SecretRef 解析方式。