PHPackages                             achttienvijftien/ai-provider-for-bedrock - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. achttienvijftien/ai-provider-for-bedrock

ActiveWordpress-plugin

achttienvijftien/ai-provider-for-bedrock
========================================

AWS Bedrock provider for the WordPress AI Client

015↑2700%PHPCI passing

Since Aug 4Pushed todayCompare

[ Source](https://github.com/achttienvijftien/ai-provider-for-bedrock)[ Packagist](https://packagist.org/packages/achttienvijftien/ai-provider-for-bedrock)[ RSS](/packages/achttienvijftien-ai-provider-for-bedrock/feed)WikiDiscussions main Synced today

READMEChangelogDependenciesVersions (1)Used By (0)

AI Provider for AWS Bedrock
===========================

[](#ai-provider-for-aws-bedrock)

Registers AWS Bedrock as a provider for the [WordPress AI Client](https://make.wordpress.org/ai/handbook/projects/php-ai-client/), so the AI features in WordPress 7.0 and the AI plugin can run on the models hosted in your own AWS account.

Works as a WordPress plugin and as a Composer package.

Requirements
------------

[](#requirements)

- PHP 8.3 or newer
- WordPress 7.0 or newer, which bundles the AI Client
- An AWS account with Bedrock model access in the region you configure

Installation
------------

[](#installation)

```
composer require achttienvijftien/ai-provider-for-bedrock
```

The package is a `wordpress-plugin`, so with [composer/installers](https://github.com/composer/installers) it lands in your plugins directory. Activate it and the provider registers itself.

Configuration
-------------

[](#configuration)

Constant or environment variableRequiredDescription`AWS_BEDROCK_API_KEY`yesA long lived Bedrock API key, used as a bearer token.`AWS_BEDROCK_REGION`noThe region to use, falling back to `AWS_DEFAULT_REGION`, then `AWS_REGION`, then `us-east-1`.The AI Client derives credentials from a constant named after the provider ID, so defining `AWS_BEDROCK_API_KEY` is all that is needed. No registration code is required.

### Choosing a model

[](#choosing-a-model)

Pin the model you want. Bedrock exposes dozens of models, and when nothing expresses a preference the AI Client selects the first one that satisfies the request, which follows the order the Bedrock API happens to return and is usually a very small model.

With the AI plugin:

```
add_filter( 'wpai_preferred_text_models', function ( array $models ): array {
	array_unshift( $models, array( 'aws-bedrock', 'eu.anthropic.claude-sonnet-5' ) );

	return $models;
} );
```

Note that the AI plugin ships preferences for other providers only, so without a filter like this none of them match Bedrock.

Directly through the AI Client:

```
wp_ai_client_prompt( 'Summarize this' )
	->using_model_preference( array( 'aws-bedrock', 'eu.anthropic.claude-sonnet-5' ) )
	->generate_text();
```

Model IDs come from this package's own discovery, so models that need an inference profile carry their profile ID, such as `eu.anthropic.claude-sonnet-5` rather than `anthropic.claude-sonnet-5`.

### Using an IAM role instead of an API key

[](#using-an-iam-role-instead-of-an-api-key)

A long lived key can be replaced with SigV4 signing, which lets an ECS task role or EC2 instance role provide short lived credentials:

```
use AchttienVijftien\AiProvider\Bedrock\Auth\SigV4Authentication;
use AchttienVijftien\AiProvider\Bedrock\BedrockProvider;
use WordPress\AiClient\AiClient;

add_action( 'plugins_loaded', function () {
	AiClient::defaultRegistry()->setProviderRequestAuthentication(
		BedrockProvider::ID,
		SigV4Authentication::fromDefaultChain()
	);
}, 20 );
```

This requires `aws/aws-sdk-php`.

IAM permissions
---------------

[](#iam-permissions)

```
{
  "Version": "2012-10-17",
  "Statement": [
    { "Effect": "Allow", "Action": ["bedrock:InvokeModel", "bedrock:InvokeModelWithResponseStream"], "Resource": "*" },
    { "Effect": "Allow", "Action": "bedrock:CallWithBearerToken", "Resource": "*" },
    { "Effect": "Allow", "Action": ["bedrock:ListFoundationModels", "bedrock:GetFoundationModel", "bedrock:ListInferenceProfiles"], "Resource": "*" },
    { "Effect": "Allow", "Action": "aws-marketplace:ViewSubscriptions", "Resource": "*" }
  ]
}
```

`bedrock:CallWithBearerToken` is required for API key authentication and requests are denied without it. `bedrock:ListInferenceProfiles` is optional but recommended, because without it the model IDs of profile based models are derived from the region geography instead of read from AWS.

Invoking a model your account has never used also needs `aws-marketplace:Subscribe`. Granting that to a long lived key lets it subscribe your account to paid products, so it is usually better to invoke a new model once from the console as an administrator and leave this package with view access only.

Anthropic models additionally require a one time use case form, which is submitted from the Bedrock console.

What it handles
---------------

[](#what-it-handles)

- **Inference profiles.** Most current models, including every Claude and Nova model, cannot be invoked by their bare model ID. Profile IDs are read from `ListInferenceProfiles` and fall back to the region geography prefix.
- **Structured output.** An output schema uses the native structured output field, falling back to a forced tool call and then to an untargeted tool call, so JSON schemas work across model families that support different mechanisms.
- **Sampling parameters.** Anthropic removed `temperature` and `topP` from Claude Opus 4.7 and newer. Those values are dropped for models that reject them, and a rejection discovered at runtime is remembered so the rejected call is only made once.
- **Vision and documents.** Image and document parts are sent as Converse content blocks.
- **Tool calling.** Function declarations map onto `toolConfig`, and tool calls come back as function call message parts.
- **Image generation.** Amazon Nova Canvas, Amazon Titan and Stability models through `InvokeModel`.
- **Honest capability reporting.** Models that cannot be invoked are not listed, so discovery does not advertise something that fails later.

Development
-----------

[](#development)

```
nvm use
composer install
pnpm install
```

### Unit tests

[](#unit-tests)

```
composer lint
composer test
```

The unit suite runs against the Composer copy of the AI Client and needs neither WordPress nor credentials.

### Integration tests

[](#integration-tests)

The integration suite runs inside a real WordPress through [wp-env](https://developer.wordpress.org/block-editor/reference-guides/packages/packages-env/), with this plugin and the [AI plugin](https://wordpress.org/plugins/ai/) both active. Every Bedrock call is stubbed through the `pre_http_request` filter, so no AWS credentials and no network access are required.

```
pnpm run env:start
pnpm run test:integration
pnpm run env:stop
```

`pnpm test` runs both suites in order.

These tests cover the parts that unit tests cannot: that the plugin registers itself, that credentials resolve from the constant, that model discovery maps inference profiles correctly, and that an ability such as `ai/summarization` reaches this provider and back.

License
-------

[](#license)

GPL-3.0-or-later

###  Health Score

23

—

LowBetter than 25% of packages

Maintenance65

Regular maintenance activity

Popularity8

Limited adoption so far

Community8

Small or concentrated contributor base

Maturity11

Early-stage or recently created project

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

### Community

Maintainers

![](https://www.gravatar.com/avatar/6b266fbc7c6022e0bd39e3e1f06d75029dda33bae8d4a109d79824cb6f3bbf18?d=identicon)[dennisenderink](/maintainers/dennisenderink)

![](https://www.gravatar.com/avatar/d1030590f60d21fefa30620a1c50195fa207c5ed67f618326ba6ad781264301c?d=identicon)[omnisite](/maintainers/omnisite)

![](https://www.gravatar.com/avatar/25ddb3567dc50c66226060bf3be9ea79e580f8c16852a021f2b0c007af75d06f?d=identicon)[tmdk](/maintainers/tmdk)

---

Top Contributors

[![dennisenderink](https://avatars.githubusercontent.com/u/329734?v=4)](https://github.com/dennisenderink "dennisenderink (1 commits)")

### Embed Badge

![Health badge](/badges/achttienvijftien-ai-provider-for-bedrock/health.svg)

```
[![Health](https://phpackages.com/badges/achttienvijftien-ai-provider-for-bedrock/health.svg)](https://phpackages.com/packages/achttienvijftien-ai-provider-for-bedrock)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
