Skip to content

Support for AWS Bedrock (via Converse API) #180

@junaidbhura

Description

@junaidbhura

Description

This issue proposes adding a new provider for AWS Bedrock. As an enterprise-grade service, Bedrock provides a unified gateway to multiple foundation models (Anthropic Claude, Meta Llama, Mistral, etc.).

For many enterprise WordPress users, direct connections to individual model providers are blocked by corporate security policies. Supporting Bedrock allows these organizations to use the php-ai-client while adhering to strict compliance, data residency, and security standards within their existing AWS infrastructure.

Motivation

  • Enterprise Adoption: Enables the use of this library in environments where AWS is the only approved AI provider.
  • Model Abstraction: A single implementation of Bedrock's Converse API grants access to dozens of leading foundation models.
  • Lightweight Integration: By utilizing Bedrock's recently released API Key authentication, we can avoid the heavy dependency of the full AWS PHP SDK and the complexity of SigV4 signing.

Proposed Implementation

The implementation (to be provided in a supporting PR) includes:

  • Provider: AwsBedrockProvider implementing the core provider interface.
  • Authentication: Support for Authorization: Bearer {API_KEY}.
  • Feature Parity:
    • Converse API: Full mapping for text-based chat.
    • Vision: Multi-modal support for image inputs via MessagePart.
    • Tool Calling: Mapping FunctionDeclaration to Bedrock’s toolConfig.
    • Usage Tracking: Precise extraction of prompt, completion, and total tokens from response metadata.
    • Flexible Configuration: Supports region-specific runtime endpoints and cross-region inference profile IDs.

Proposed Environment Variables

AWS_BEDROCK_API_KEY: Required for authentication.

AWS_BEDROCK_REGION: The target AWS region.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions