Skip to main content
OpenClaw 可以通过其 Bedrock Converse 流式 provider 使用 Amazon Bedrock 模型。Bedrock 身份验证使用 AWS SDK 默认凭证链,而不是 API 密钥。

入门

选择你偏好的身份验证方式并按步骤完成设置。
最适合: 开发机、CI,或你直接管理 AWS 凭证的主机。
1

在网关主机上设置 AWS 凭证

2

在你的配置中添加 Bedrock provider 和 model

不需要 apiKey。使用 auth: "aws-sdk" 配置 provider:
3

验证模型是否可用

使用 env-marker 身份验证(AWS_ACCESS_KEY_IDAWS_PROFILEAWS_BEARER_TOKEN_BEDROCK)时,OpenClaw 会自动启用隐式 Bedrock provider 进行模型发现,无需额外配置。

自动模型发现

OpenClaw 可以自动发现支持 流式输出文本输出 的 Bedrock 模型。发现过程使用 bedrock:ListFoundationModelsbedrock:ListInferenceProfiles,结果会被缓存(默认:1 小时)。 隐式 provider 的启用方式:
  • 如果 plugins.entries.amazon-bedrock.config.discovery.enabledtrue, 即使没有 AWS env marker,OpenClaw 也会尝试发现。
  • 如果未设置 plugins.entries.amazon-bedrock.config.discovery.enabled, OpenClaw 只会在检测到以下 AWS 身份验证标记之一时自动添加 隐式 Bedrock provider: AWS_BEARER_TOKEN_BEDROCKAWS_ACCESS_KEY_ID + AWS_SECRET_ACCESS_KEY,或 AWS_PROFILE
  • 实际的 Bedrock 运行时身份验证路径仍然使用 AWS SDK 默认链,因此 即使发现过程需要通过 enabled: true 显式启用,共享配置、SSO 和 IMDS 实例角色身份验证也可以正常工作。
对于显式的 models.providers["amazon-bedrock"] 条目,OpenClaw 仍然可以从 AWS env marker(例如 AWS_BEARER_TOKEN_BEDROCK)提前解析 Bedrock env-marker 身份验证,而无需强制加载完整的运行时身份验证。实际的模型调用身份验证路径仍然使用 AWS SDK 默认链。
配置选项位于 plugins.entries.amazon-bedrock.config.discovery 下:
Bedrock 的 ListFoundationModelsGetFoundationModel API 不返回 token 限制元数据,只返回模型 ID、名称、模态和生命周期 状态。OpenClaw 为常见 Bedrock 模型(Claude、Nova、Llama、Mistral、DeepSeek 等)提供了已知上下文窗口和输出 限制的查找表,因此这些模型的会话管理、压缩阈值以及 上下文溢出检测都能正常工作。未在表中的已发现模型会回退到 defaultContextWindowdefaultMaxTokens。如果你使用的模型缺少准确限制,请通过显式的 models.providers["amazon-bedrock"].models 条目进行覆盖。

快速设置(AWS 路径)

此流程会创建 IAM 角色、附加 Bedrock 权限、关联实例配置文件,并在 EC2 主机上启用 OpenClaw 发现功能。

高级配置

OpenClaw 会在基础模型之外一并发现 区域和全局推理配置文件。当配置文件映射到已知的基础模型时,该配置文件会继承该模型的能力(上下文窗口、最大 token 数、推理、视觉),并且会自动注入正确的 Bedrock 请求区域。这意味着跨区域 Claude 配置文件无需手动覆盖 provider 即可工作。全局跨区域配置文件(global.*)会在 openclaw models list 中优先显示,因为它们通常提供更好的容量和自动故障转移。Inference profile IDs look like us.anthropic.claude-opus-4-6-v1 (regional) or anthropic.claude-opus-4-6-v1 (global). If the backing model is already in the discovery results, the profile inherits its full capability set; otherwise safe defaults apply.无需额外配置。只要启用了发现,并且 IAM 主体具有 bedrock:ListInferenceProfiles,配置文件就会与基础模型一起出现在 openclaw models list 中。
某些 Bedrock 模型支持 service_tier 参数,用于优化成本 或延迟。可用的层级如下:通过 agents.defaults.params 为 Bedrock 模型请求设置 serviceTier(或 service_tier),或者在 agents.defaults.models["<model-key>"].params 中按模型设置:
Valid values are default, flex, priority, and reserved. Claude Fable 5, Opus 5, and Sonnet 5 only support the default tier; OpenClaw warns and ignores flex, priority, or reserved requested for those models. For other models, not every model supports every tier — an unsupported tier returns a Bedrock validation error, and the error message can be misleading (for example “The provided model identifier is invalid” rather than naming the tier as the problem). If you see this error, check whether the model supports the requested tier.
Bedrock rejects the temperature parameter for Claude Opus 5, Opus 4.8, and Opus 4.7. OpenClaw omits temperature automatically for any matching Bedrock ref, including foundation model ids, named inference profiles, application inference profiles whose underlying model resolves to Opus 5/4.8/4.7 via bedrock:GetInferenceProfile, and dotted opus-4.7/opus-4.8 variants with optional region prefixes (us., eu., ap., apac., au., jp., global.). No config knob is required, and the omission applies to both the request options object and the inferenceConfig payload field.
Use amazon-bedrock/anthropic.claude-opus-5 on the Messages-API Bedrock endpoint, or a regional/global inference profile such as global.anthropic.claude-opus-5 when it appears in Bedrock discovery. OpenClaw applies the 1,000,000-token context window, 128,000-token output limit, image input, prompt caching, refusal-safe streaming, and native xhigh/max effort levels.Adaptive thinking defaults to high. /think off disables thinking, while /think xhigh|max keeps adaptive thinking enabled. OpenClaw omits custom sampling parameters and unsupported non-default service tiers.
us-east-1 中使用 amazon-bedrock/anthropic.claude-fable-5,或者使用 如 us.anthropic.claude-fable-5 这样的区域推理 ID。 OpenClaw 会应用 Fable 的 1M 上下文窗口、128K 输出上限、始终开启的自适应思考,以及受支持的 effort 映射。/think off/think minimal 映射为 low;temperature 和强制工具选择控制会被省略,这与 Opus 4.7/4.8 路由一致。流式输出会一直保持,直到 Bedrock 返回终止状态,因此中途拒绝不会暴露部分文本。AWS 要求在 Fable 可用之前显式选择加入 provider_data_share 数据保留。 提示和补全内容会与 Anthropic 共享,并最多保留 30 天用于信任与安全。 在启用该模型前,请先查看并配置 Bedrock data retention
Claude Mythos 5 仅对已获得所需有限访问批准的账户可通过 Bedrock 使用。OpenClaw 能识别基础模型 anthropic.claude-mythos-5 以及区域或全局推理配置文件,例如 us.anthropic.claude-mythos-5OpenClaw 会应用 1,000,000 token 的上下文窗口、128,000 token 的输出 上限、图像输入、提示缓存、拒绝安全流式传输,以及原生 effort 等级。自适应思考始终开启:/think off/think minimal 映射为 low,而 xhighmax 仍然可用。 自定义采样和强制工具选择值会被省略。
AWS 在 bedrock-runtimebedrock-mantle 端点 上都记录了 Sonnet 5。 OpenClaw 识别 Bedrock 基础模型 anthropic.claude-sonnet-5 以及区域或全局推理配置文件,例如 us.anthropic.claude-sonnet-5。它会应用 1,000,000 token 的上下文 窗口、128,000 token 的输出上限、图像输入、原生 effort 等级、 提示缓存和拒绝安全流式传输。Bedrock 会为 Sonnet 5 保持自适应思考开启。OpenClaw 默认使用 high/think off/think minimal 映射为 low,因为该路由 无法关闭思考功能。当自适应思考处于活动状态时,自定义 temperature 和强制工具选择值 会被省略。
你可以通过在 amazon-bedrock 插件配置中添加一个 guardrail 对象, 将 Amazon Bedrock Guardrails 应用于所有 Bedrock 模型调用。Guardrails 让你可以强制执行内容过滤、主题拒绝、词语过滤、敏感信息过滤和上下文约束检查。
guardrailIdentifierguardrailVersion 是必需的。
网关使用的 IAM 主体除了标准调用权限外,还必须具有 bedrock:ApplyGuardrail 权限。
Bedrock can also serve as the embedding provider for memory search. This is configured separately from the inference provider — set memory.search.provider to "bedrock":
Bedrock embeddings 使用与 inference 相同的 AWS SDK 凭证链(实例 角色、SSO、访问密钥、共享配置和 web identity)。不需要 API 密钥。支持的 embedding 模型包括 Amazon Titan Embed(v1、v2)、Amazon Nova Embed、Cohere Embed(v3、v4)以及 TwelveLabs Marengo。有关完整的模型列表和维度选项,请参见 Memory configuration reference — Bedrock
  • Bedrock 需要在你的 AWS 账户/区域中启用 model access
  • 自动发现需要 bedrock:ListFoundationModelsbedrock:ListInferenceProfiles 权限。
  • 如果你依赖自动模式,请在网关主机上设置一个受支持的 AWS 身份验证 env marker。若你更希望在没有 env marker 的情况下使用 IMDS/共享配置身份验证,请设置 plugins.entries.amazon-bedrock.config.discovery.enabled: true
  • OpenClaw 会按以下顺序展示凭证来源:AWS_BEARER_TOKEN_BEDROCK, 然后是 AWS_ACCESS_KEY_ID + AWS_SECRET_ACCESS_KEY,然后是 AWS_PROFILE,最后是 默认 AWS SDK 链。
  • 推理支持取决于模型;请查看 Bedrock 模型卡以了解 当前能力。
  • 如果你更偏好托管密钥流程,也可以在 Bedrock 前面放置一个兼容 OpenAI 的 代理,并将其配置为 OpenAI provider。

相关内容

模型选择

选择 provider、model 引用以及故障转移行为。

Memory search

用于 memory search 配置的 Bedrock embeddings。

Memory config reference

完整的 Bedrock embedding 模型列表和维度选项。

故障排查

常规故障排查和常见问题。