Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Claude via AWS Bedrock #258

Open
connorads opened this issue Jan 5, 2025 · 1 comment
Open

Support for Claude via AWS Bedrock #258

connorads opened this issue Jan 5, 2025 · 1 comment

Comments

@connorads
Copy link

What

AWS Bedrock offers access to Anthropic's Claude models.
And Anthropic provide an official NPM package to use it.
https://www.npmjs.com/package/@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();

Why

Many start-ups and businesses use AWS and would prefer to use their (sometimes free) AWS credits to access Claude and other models instead of going direct to Anthropic and their APIs.

@slavingia
Copy link
Contributor

Good idea, feel free to work on it if you'd find this useful!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants