# @ai-sdk/amazon-bedrock

Latest version **5.0.96** (published 2026-09-25) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @ai-sdk/amazon-bedrock
pnpm add @ai-sdk/amazon-bedrock
yarn add @ai-sdk/amazon-bedrock
bun add @ai-sdk/amazon-bedrock
```

## Health

**Score 60/100 (C)** — status: active.

Positive: no vulnerabilities; recently updated; high maintenance score; popular repo.

Warnings: low downloads; no types; no esm support.

## Facts

| | |
|---|---|
| Version | 5.0.96 |
| Published | 2026-09-25 |
| First published | 2024-06-21 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 26863 |
| Maintainers | vercel-release-bot, matheuss, matt.straka |
| Keywords | ai |

## Links

- npm: https://www.npmjs.com/package/@ai-sdk/amazon-bedrock
- Repository: https://github.com/vercel/ai
- Homepage: https://ai-sdk.dev/docs
- Issues: https://github.com/vercel/ai/issues
- npm.io page: https://npm.io/package/@ai-sdk/amazon-bedrock

## Alternatives

- [@expo/fingerprint](https://npm.io/package/@expo/fingerprint.md) — 6.2M weekly downloads
- [@azure/monitor-opentelemetry-exporter](https://npm.io/package/@azure/monitor-opentelemetry-exporter.md) — 850.0K weekly downloads
- [@azure/monitor-opentelemetry](https://npm.io/package/@azure/monitor-opentelemetry.md) — 624.0K weekly downloads
- [@posthog/ai](https://npm.io/package/@posthog/ai.md) — 423.3K weekly downloads
- [fakefilter](https://npm.io/package/fakefilter.md) — 63.9K weekly downloads

## Recent versions

- 5.0.96 (latest) — 2026-09-25
- 4.0.183 (ai-v6) — 2026-09-24
- 3.0.135 (ai-v5) — 2026-09-23
- 0.0.0-f1630544-20260811180950 (snapshot) — 2026-08-11
- 5.0.0-beta.89 (beta) — 2026-06-24
- 5.0.0-canary.84 (canary) — 2026-06-12
- 3.0.0-alpha.15 (alpha) — 2025-06-18
- 5.0.94 — 2026-09-24
- 4.0.182 — 2026-09-23
- 5.0.93 — 2026-09-23
- 4.0.181 — 2026-09-23
- 5.0.92 — 2026-09-23
- 3.0.134 — 2026-09-23
- 5.0.91 — 2026-09-22
- 3.0.133 — 2026-09-22
- … 738 more at https://npm.io/package/@ai-sdk/amazon-bedrock/versions

## README

# AI SDK - Amazon Bedrock Provider

The **[Amazon Bedrock provider](https://ai-sdk.dev/providers/ai-sdk-providers/amazon-bedrock)** for the [AI SDK](https://ai-sdk.dev/docs)
contains language model support for the Amazon Bedrock [converse API](https://docs.aws.amazon.com/bedrock/latest/APIReference/API_runtime_Converse.html).

> **Deploying to Vercel?** With Vercel's AI Gateway you can access Amazon Bedrock (and hundreds of models from other providers) — no additional packages, API keys, or extra cost. [Get started with AI Gateway](https://vercel.com/ai-gateway).

## Setup

The Amazon Bedrock provider is available in the `@ai-sdk/amazon-bedrock` module. You can install it with

```bash
npm i @ai-sdk/amazon-bedrock
```

## Skill for Coding Agents

If you use coding agents such as Claude Code or Cursor, we highly recommend adding the AI SDK skill to your repository:

```shell
npx skills add vercel/ai
```

## Provider Instance

You can import the default provider instance `bedrock` from `@ai-sdk/amazon-bedrock`:

```ts
import { bedrock } from '@ai-sdk/amazon-bedrock';
```

## Authentication

The Amazon Bedrock provider supports two authentication methods with automatic fallback:

### API Key Authentication (Recommended)

API key authentication provides a simpler setup process compared to traditional AWS SigV4 authentication. You can authenticate using either environment variables or direct configuration.

#### Using Environment Variable

Set the `AWS_BEARER_TOKEN_BEDROCK` environment variable with your API key:

```bash
export AWS_BEARER_TOKEN_BEDROCK=your-api-key-here
```

```ts
import { bedrock } from '@ai-sdk/amazon-bedrock';
import { generateText } from 'ai';

const { text } = await generateText({
  model: bedrock('us.anthropic.claude-haiku-4-5-20251001-v1:0'),
  prompt: 'Write a vegetarian lasagna recipe for 4 people.',
  // API key is automatically loaded from AWS_BEARER_TOKEN_BEDROCK
});
```

#### Using Direct Configuration

You can also pass the API key directly in the provider configuration:

```ts
import { bedrock } from '@ai-sdk/amazon-bedrock';
import { generateText } from 'ai';

const bedrockWithApiKey = bedrock.withSettings({
  apiKey: process.env.AWS_BEARER_TOKEN_BEDROCK, // or your API key directly
  region: 'us-east-1', // Optional: specify region
});

const { text } = await generateText({
  model: bedrockWithApiKey('us.anthropic.claude-haiku-4-5-20251001-v1:0'),
  prompt: 'Write a vegetarian lasagna recipe for 4 people.',
});
```

### SigV4 Authentication (Fallback)

If no API key is provided, the provider automatically falls back to AWS SigV4 authentication using standard AWS credentials:

```ts
import { bedrock } from '@ai-sdk/amazon-bedrock';
import { generateText } from 'ai';

// Uses AWS credentials from environment variables or AWS credential chain
const { text } = await generateText({
  model: bedrock('us.anthropic.claude-haiku-4-5-20251001-v1:0'),
  prompt: 'Write a vegetarian lasagna recipe for 4 people.',
});
```

This method requires standard AWS environment variables:

- `AWS_ACCESS_KEY_ID`
- `AWS_SECRET_ACCESS_KEY`
- `AWS_SESSION_TOKEN` (optional, for temporary credentials)

### Authentication Precedence

The provider uses the following authentication precedence:

1. **API key from direct configuration** (`apiKey` in `withSettings()`)
2. **API key from environment variable** (`AWS_BEARER_TOKEN_BEDROCK`)
3. **SigV4 authentication** (AWS credential chain fallback)

## Example

```ts
import { bedrock } from '@ai-sdk/amazon-bedrock';
import { generateText } from 'ai';

const { text } = await generateText({
  model: bedrock('meta.llama3-8b-instruct-v1:0'),
  prompt: 'Write a vegetarian lasagna recipe for 4 people.',
});
```

## Documentation

Please check out the **[Amazon Bedrock provider documentation](https://ai-sdk.dev/providers/ai-sdk-providers/amazon-bedrock)** for more information.

---
_Source: https://npm.io/package/@ai-sdk/amazon-bedrock · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
