{"id":212,"date":"2026-03-21T22:47:22","date_gmt":"2026-03-21T14:47:22","guid":{"rendered":"https:\/\/pa.yingzhi8.cn\/index.php\/2026\/03\/21\/providers-bedrock\/"},"modified":"2026-03-21T23:08:57","modified_gmt":"2026-03-21T15:08:57","slug":"providers-bedrock","status":"publish","type":"post","link":"https:\/\/pa.yingzhi8.cn\/index.php\/2026\/03\/21\/providers-bedrock\/","title":{"rendered":"Amazon Bedrock"},"content":{"rendered":"<h1>Amazon Bedrock<\/h1>\n<p>OpenClaw \u53ef\u4ee5\u901a\u8fc7 pi\u2011ai \u7684 <strong>Bedrock Converse<\/strong> \u6d41\u5f0f\u63d0\u4f9b\u5546\u4f7f\u7528 <strong>Amazon Bedrock<\/strong> \u6a21\u578b\u3002Bedrock \u8ba4\u8bc1\u4f7f\u7528 <strong>AWS SDK \u9ed8\u8ba4\u51ed\u8bc1\u94fe<\/strong>\uff0c\u800c\u975e API \u5bc6\u94a5\u3002<\/p>\n<h2>pi\u2011ai \u652f\u6301\u7684\u529f\u80fd<\/h2>\n<ul>\n<li>\u63d0\u4f9b\u5546\uff1a<code>amazon-bedrock<\/code><\/li>\n<li>API\uff1a<code>bedrock-converse-stream<\/code><\/li>\n<li>\u8ba4\u8bc1\uff1aAWS \u51ed\u8bc1\uff08\u73af\u5883\u53d8\u91cf\u3001\u5171\u4eab\u914d\u7f6e\u6216\u5b9e\u4f8b\u89d2\u8272\uff09<\/li>\n<li>\u533a\u57df\uff1a<code>AWS_REGION<\/code> \u6216 <code>AWS_DEFAULT_REGION<\/code>\uff08\u9ed8\u8ba4\uff1a<code>us-east-1<\/code>\uff09<\/li>\n<\/ul>\n<h2>\u81ea\u52a8\u6a21\u578b\u53d1\u73b0<\/h2>\n<p>\u5982\u679c\u68c0\u6d4b\u5230 AWS \u51ed\u8bc1\uff0cOpenClaw \u53ef\u4ee5\u81ea\u52a8\u53d1\u73b0\u652f\u6301<strong>\u6d41\u5f0f\u4f20\u8f93<\/strong>\u548c<strong>\u6587\u672c\u8f93\u51fa<\/strong>\u7684 Bedrock \u6a21\u578b\u3002\u53d1\u73b0\u529f\u80fd\u4f7f\u7528 <code>bedrock:ListFoundationModels<\/code>\uff0c\u5e76\u4f1a\u88ab\u7f13\u5b58\uff08\u9ed8\u8ba4\uff1a1 \u5c0f\u65f6\uff09\u3002<\/p>\n<p>\u914d\u7f6e\u9009\u9879\u4f4d\u4e8e <code>models.bedrockDiscovery<\/code> \u4e0b\uff1a<\/p>\n<p>&#8220;`json5  theme={&#8220;theme&#8221;:{&#8220;light&#8221;:&#8221;min-light&#8221;,&#8221;dark&#8221;:&#8221;min-dark&#8221;}}<br \/>\n{<br \/>\n  models: {<br \/>\n    bedrockDiscovery: {<br \/>\n      enabled: true,<br \/>\n      region: &#8220;us-east-1&#8221;,<br \/>\n      providerFilter: [&#8220;anthropic&#8221;, &#8220;amazon&#8221;],<br \/>\n      refreshInterval: 3600,<br \/>\n      defaultContextWindow: 32000,<br \/>\n      defaultMaxTokens: 4096,<br \/>\n    },<br \/>\n  },<br \/>\n}<\/p>\n<pre><code>\n\u6ce8\u610f\u4e8b\u9879\uff1a\n\n* `enabled` \u5728\u5b58\u5728 AWS \u51ed\u8bc1\u65f6\u9ed8\u8ba4\u4e3a `true`\u3002\n* `region` \u9ed8\u8ba4\u4e3a `AWS_REGION` \u6216 `AWS_DEFAULT_REGION`\uff0c\u7136\u540e\u662f `us-east-1`\u3002\n* `providerFilter` \u5339\u914d Bedrock \u63d0\u4f9b\u5546\u540d\u79f0\uff08\u4f8b\u5982 `anthropic`\uff09\u3002\n* `refreshInterval` \u5355\u4f4d\u4e3a\u79d2\uff1b\u8bbe\u7f6e\u4e3a `0` \u53ef\u7981\u7528\u7f13\u5b58\u3002\n* `defaultContextWindow`\uff08\u9ed8\u8ba4\uff1a`32000`\uff09\u548c `defaultMaxTokens`\uff08\u9ed8\u8ba4\uff1a`4096`\uff09\u7528\u4e8e\u5df2\u53d1\u73b0\u7684\u6a21\u578b\uff08\u5982\u679c\u4f60\u77e5\u9053\u6a21\u578b\u9650\u5236\uff0c\u53ef\u4ee5\u8986\u76d6\u8fd9\u4e9b\u503c\uff09\u3002\n\n## \u8bbe\u7f6e\uff08\u624b\u52a8\uff09\n\n1. \u786e\u4fdd AWS \u51ed\u8bc1\u5728 **Gateway \u7f51\u5173\u4e3b\u673a**\u4e0a\u53ef\u7528\uff1a\n\n```bash  theme={&quot;theme&quot;:{&quot;light&quot;:&quot;min-light&quot;,&quot;dark&quot;:&quot;min-dark&quot;}}\nexport AWS_ACCESS_KEY_ID=&quot;AKIA...&quot;\nexport AWS_SECRET_ACCESS_KEY=&quot;...&quot;\nexport AWS_REGION=&quot;us-east-1&quot;\n# \u53ef\u9009\uff1a\nexport AWS_SESSION_TOKEN=&quot;...&quot;\nexport AWS_PROFILE=&quot;your-profile&quot;\n# \u53ef\u9009\uff08Bedrock API \u5bc6\u94a5\/Bearer \u4ee4\u724c\uff09\uff1a\nexport AWS_BEARER_TOKEN_BEDROCK=&quot;...&quot;\n<\/code><\/pre>\n<ol start=\"2\">\n<li>\u5728\u914d\u7f6e\u4e2d\u6dfb\u52a0 Bedrock \u63d0\u4f9b\u5546\u548c\u6a21\u578b\uff08\u65e0\u9700 <code>apiKey<\/code>\uff09\uff1a<\/li>\n<\/ol>\n<p>&#8220;`json5  theme={&#8220;theme&#8221;:{&#8220;light&#8221;:&#8221;min-light&#8221;,&#8221;dark&#8221;:&#8221;min-dark&#8221;}}<br \/>\n{<br \/>\n  models: {<br \/>\n    providers: {<br \/>\n      &#8220;amazon-bedrock&#8221;: {<br \/>\n        baseUrl: &#8220;https:\/\/bedrock-runtime.us-east-1.amazonaws.com&#8221;,<br \/>\n        api: &#8220;bedrock-converse-stream&#8221;,<br \/>\n        auth: &#8220;aws-sdk&#8221;,<br \/>\n        models: [<br \/>\n          {<br \/>\n            id: &#8220;anthropic.claude-opus-4-5-20251101-v1:0&#8221;,<br \/>\n            name: &#8220;Claude Opus 4.5 (Bedrock)&#8221;,<br \/>\n            reasoning: true,<br \/>\n            input: [&#8220;text&#8221;, &#8220;image&#8221;],<br \/>\n            cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },<br \/>\n            contextWindow: 200000,<br \/>\n            maxTokens: 8192,<br \/>\n          },<br \/>\n        ],<br \/>\n      },<br \/>\n    },<br \/>\n  },<br \/>\n  agents: {<br \/>\n    defaults: {<br \/>\n      model: { primary: &#8220;amazon-bedrock\/anthropic.claude-opus-4-5-20251101-v1:0&#8221; },<br \/>\n    },<br \/>\n  },<br \/>\n}<\/p>\n<pre><code>\n## EC2 \u5b9e\u4f8b\u89d2\u8272\n\n\u5f53\u5728\u9644\u52a0\u4e86 IAM \u89d2\u8272\u7684 EC2 \u5b9e\u4f8b\u4e0a\u8fd0\u884c OpenClaw \u65f6\uff0cAWS SDK \u4f1a\u81ea\u52a8\u4f7f\u7528\u5b9e\u4f8b\u5143\u6570\u636e\u670d\u52a1\uff08IMDS\uff09\u8fdb\u884c\u8ba4\u8bc1\u3002\u4f46\u662f\uff0cOpenClaw \u7684\u51ed\u8bc1\u68c0\u6d4b\u76ee\u524d\u53ea\u68c0\u67e5\u73af\u5883\u53d8\u91cf\uff0c\u4e0d\u68c0\u67e5 IMDS \u51ed\u8bc1\u3002\n\n**\u89e3\u51b3\u65b9\u6cd5\uff1a** \u8bbe\u7f6e `AWS_PROFILE=default` \u4ee5\u8868\u660e AWS \u51ed\u8bc1\u53ef\u7528\u3002\u5b9e\u9645\u8ba4\u8bc1\u4ecd\u7136\u901a\u8fc7 IMDS \u4f7f\u7528\u5b9e\u4f8b\u89d2\u8272\u3002\n\n```bash  theme={&quot;theme&quot;:{&quot;light&quot;:&quot;min-light&quot;,&quot;dark&quot;:&quot;min-dark&quot;}}\n# \u6dfb\u52a0\u5230 ~\/.bashrc \u6216\u4f60\u7684 shell \u914d\u7f6e\u6587\u4ef6\nexport AWS_PROFILE=default\nexport AWS_REGION=us-east-1\n<\/code><\/pre>\n<p>EC2 \u5b9e\u4f8b\u89d2\u8272<strong>\u6240\u9700\u7684 IAM \u6743\u9650<\/strong>\uff1a<\/p>\n<ul>\n<li><code>bedrock:InvokeModel<\/code><\/li>\n<li><code>bedrock:InvokeModelWithResponseStream<\/code><\/li>\n<li><code>bedrock:ListFoundationModels<\/code>\uff08\u7528\u4e8e\u81ea\u52a8\u53d1\u73b0\uff09<\/li>\n<\/ul>\n<p>\u6216\u8005\u9644\u52a0\u6258\u7ba1\u7b56\u7565 <code>AmazonBedrockFullAccess<\/code>\u3002<\/p>\n<p><strong>\u5feb\u901f\u8bbe\u7f6e\uff1a<\/strong><\/p>\n<p>&#8220;`bash  theme={&#8220;theme&#8221;:{&#8220;light&#8221;:&#8221;min-light&#8221;,&#8221;dark&#8221;:&#8221;min-dark&#8221;}}<\/p>\n<h1>1. \u521b\u5efa IAM \u89d2\u8272\u548c\u5b9e\u4f8b\u914d\u7f6e\u6587\u4ef6<\/h1>\n<p>aws iam create-role &#8211;role-name EC2-Bedrock-Access<br \/>\n  &#8211;assume-role-policy-document &#8216;{<br \/>\n    &#8220;Version&#8221;: &#8220;2012-10-17&#8221;,<br \/>\n    &#8220;Statement&#8221;: [{<br \/>\n      &#8220;Effect&#8221;: &#8220;Allow&#8221;,<br \/>\n      &#8220;Principal&#8221;: {&#8220;Service&#8221;: &#8220;ec2.amazonaws.com&#8221;},<br \/>\n      &#8220;Action&#8221;: &#8220;sts:AssumeRole&#8221;<br \/>\n    }]<br \/>\n  }&#8217;<\/p>\n<p>aws iam attach-role-policy &#8211;role-name EC2-Bedrock-Access<br \/>\n  &#8211;policy-arn arn:aws:iam::aws:policy\/AmazonBedrockFullAccess<\/p>\n<p>aws iam create-instance-profile &#8211;instance-profile-name EC2-Bedrock-Access<br \/>\naws iam add-role-to-instance-profile<br \/>\n  &#8211;instance-profile-name EC2-Bedrock-Access<br \/>\n  &#8211;role-name EC2-Bedrock-Access<\/p>\n<h1>2. \u9644\u52a0\u5230\u4f60\u7684 EC2 \u5b9e\u4f8b<\/h1>\n<p>aws ec2 associate-iam-instance-profile<br \/>\n  &#8211;instance-id i-xxxxx<br \/>\n  &#8211;iam-instance-profile Name=EC2-Bedrock-Access<\/p>\n<h1>3. \u5728 EC2 \u5b9e\u4f8b\u4e0a\u542f\u7528\u53d1\u73b0\u529f\u80fd<\/h1>\n<p>openclaw config set models.bedrockDiscovery.enabled true<br \/>\nopenclaw config set models.bedrockDiscovery.region us-east-1<\/p>\n<h1>4. \u8bbe\u7f6e\u89e3\u51b3\u65b9\u6cd5\u6240\u9700\u7684\u73af\u5883\u53d8\u91cf<\/h1>\n<p>echo &#8216;export AWS_PROFILE=default&#8217; &gt;&gt; ~\/.bashrc<br \/>\necho &#8216;export AWS_REGION=us-east-1&#8217; &gt;&gt; ~\/.bashrc<br \/>\nsource ~\/.bashrc<\/p>\n<h1>5. \u9a8c\u8bc1\u6a21\u578b\u5df2\u88ab\u53d1\u73b0<\/h1>\n<p>openclaw models list<br \/>\n&#8220;`<\/p>\n<h2>\u6ce8\u610f\u4e8b\u9879<\/h2>\n<ul>\n<li>Bedrock \u9700\u8981\u5728\u4f60\u7684 AWS \u8d26\u6237\/\u533a\u57df\u4e2d\u542f\u7528<strong>\u6a21\u578b\u8bbf\u95ee<\/strong>\u3002<\/li>\n<li>\u81ea\u52a8\u53d1\u73b0\u9700\u8981 <code>bedrock:ListFoundationModels<\/code> \u6743\u9650\u3002<\/li>\n<li>\u5982\u679c\u4f60\u4f7f\u7528\u914d\u7f6e\u6587\u4ef6\uff0c\u8bf7\u5728 Gateway \u7f51\u5173\u4e3b\u673a\u4e0a\u8bbe\u7f6e <code>AWS_PROFILE<\/code>\u3002<\/li>\n<li>OpenClaw \u6309\u4ee5\u4e0b\u987a\u5e8f\u83b7\u53d6\u51ed\u8bc1\u6765\u6e90\uff1a<code>AWS_BEARER_TOKEN_BEDROCK<\/code>\uff0c\u7136\u540e\u662f <code>AWS_ACCESS_KEY_ID<\/code> + <code>AWS_SECRET_ACCESS_KEY<\/code>\uff0c\u7136\u540e\u662f <code>AWS_PROFILE<\/code>\uff0c\u6700\u540e\u662f\u9ed8\u8ba4\u7684 AWS SDK \u94fe\u3002<\/li>\n<li>\u63a8\u7406\u652f\u6301\u53d6\u51b3\u4e8e\u6a21\u578b\uff1b\u8bf7\u67e5\u770b Bedrock \u6a21\u578b\u5361\u4e86\u89e3\u5f53\u524d\u529f\u80fd\u3002<\/li>\n<li>\u5982\u679c\u4f60\u66f4\u559c\u6b22\u6258\u7ba1\u5bc6\u94a5\u6d41\u7a0b\uff0c\u4e5f\u53ef\u4ee5\u5728 Bedrock \u524d\u9762\u653e\u7f6e\u4e00\u4e2a OpenAI \u517c\u5bb9\u7684\u4ee3\u7406\uff0c\u5e76\u5c06\u5176\u914d\u7f6e\u4e3a OpenAI \u63d0\u4f9b\u5546\u3002<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Amazon Bedrock OpenClaw \u53ef\u4ee5\u901a\u8fc7 pi\u2011ai \u7684 Bedrock Converse \u6d41 [&hellip;]<\/p>\n","protected":false},"author":0,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[],"class_list":["post-212","post","type-post","status-publish","format-standard","hentry","category-docs"],"_links":{"self":[{"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/posts\/212","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"replies":[{"embeddable":true,"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/comments?post=212"}],"version-history":[{"count":1,"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/posts\/212\/revisions"}],"predecessor-version":[{"id":507,"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/posts\/212\/revisions\/507"}],"wp:attachment":[{"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/media?parent=212"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/categories?post=212"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pa.yingzhi8.cn\/index.php\/wp-json\/wp\/v2\/tags?post=212"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}