SPB Git forge

spb/doc-api

Public
2commits 1branches 0releases
15.7 MBsize
maindefault branch
14 days agolast push
Python 88.3% TypeScript 7.6% Shell 4.1%
1.2 KB · 25 lines typescript
Raw Blame History
1// STATUS: UNVERIFIED — no cloud credentials in this atlas; snippet follows official docs verbatim-ish2// Source: https://platform.claude.com/docs/en/build-with-claude/claude-in-amazon-bedrock (retrieved 2026-09-18)3// Install: npm install @anthropic-ai/bedrock-sdk4// Auth: standard AWS credential chain; region from AWS_REGION (SDK defaults to us-east-1, does not read ~/.aws/config).5import { AnthropicBedrockMantle } from "@anthropic-ai/bedrock-sdk";67const client = new AnthropicBedrockMantle({8  awsRegion: process.env.AWS_REGION ?? "us-east-1",9});1011const message = await client.messages.create({12  model: "anthropic.claude-haiku-4-5", // cheapest Haiku 4.5 id on the Bedrock Messages-API endpoint13  max_tokens: 8,14  messages: [{ role: "user", content: "Reply with OK." }],15});1617const textBlock = message.content.find((block) => block.type === "text");18if (textBlock && textBlock.type === "text") console.log(textBlock.text);1920// Legacy InvokeModel path (not run here):21//   import AnthropicBedrock from "@anthropic-ai/bedrock-sdk";22//   new AnthropicBedrock({ awsRegion: "us-west-2" }).messages.create({23//     model: "us.anthropic.claude-haiku-4-5-20251001-v1:0", max_tokens: 8,24//     messages: [{ role: "user", content: "Reply with OK." }] });25