
Research
/Security News
Shai Hulud Strikes Again (v2)
Another wave of Shai-Hulud campaign hits npm.
@anthropic-ai/bedrock-sdk
Advanced tools
This library provides convenient access to the Anthropic Bedrock API.
For the non-Bedrock Anthropic API at api.anthropic.com, see @anthropic-ai/sdk.
npm install @anthropic-ai/bedrock-sdk
import { AnthropicBedrock } from '@anthropic-ai/bedrock-sdk';
// Note: this assumes you have configured AWS credentials in a way
// that the AWS Node SDK will recognise, typicaly a shared `~/.aws/credentials`
// file or `AWS_ACCESS_KEY_ID` & `AWS_SECRET_ACCESS_KEY` environment variables.
//
// https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/setting-credentials-node.html
const client = new AnthropicBedrock();
async function main() {
const message = await client.messages.create({
model: 'anthropic.claude-3-5-sonnet-20241022-v2:0',
messages: [
{
role: 'user',
content: 'Hello!',
},
],
max_tokens: 1024,
});
console.log(message);
}
main();
For non-Node environments like Vercel Edge Runtime where the default AWS credential provider chain isn't available, you can provide a custom credential resolver:
import { AnthropicBedrock } from '@anthropic-ai/bedrock-sdk';
const customCredentialProvider = async () => {
// Return an object that implements the AwsCredentialIdentityProvider interface
return {
accessKeyId: 'your-aws-access-key-id',
secretAccessKey: 'your-aws-secret-access-key',
sessionToken: 'your-aws-session-token', // Optional, if using temporary credentials
};
};
const client = new AnthropicBedrock({
awsRegion: 'us-east-1',
providerChainResolver: async () => {
return customCredentialProvider;
},
});
For more details on how to use the SDK, see the README.md for the main Anthropic SDK which this library extends.
TypeScript >= 4.5 is supported.
The following runtimes are supported:
import { AnthropicBedrock } from "npm:@anthropic-ai/bedrock-sdk"."node" environment ("jsdom" is not supported at this time).Note that React Native is not supported at this time.
If you are interested in other runtime environments, please open or upvote an issue on GitHub.
FAQs
The official TypeScript library for the Anthropic Bedrock API
The npm package @anthropic-ai/bedrock-sdk receives a total of 135,339 weekly downloads. As such, @anthropic-ai/bedrock-sdk popularity was classified as popular.
We found that @anthropic-ai/bedrock-sdk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 12 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Research
/Security News
Another wave of Shai-Hulud campaign hits npm.

Product
Add real-time Socket webhook events to your workflows to automatically receive software supply chain alert changes in real time.

Security News
ENISA has become a CVE Program Root, giving the EU a central authority for coordinating vulnerability reporting, disclosure, and cross-border response.