wordpress/anthropic-ai-provider

Anthropic AI provider for the PHP AI Client SDK. Works as both a Composer package and WordPress plugin.

Installs: 12

Dependents: 1

Suggesters: 1

Security: 0

Stars: 2

Watchers: 1

Forks: 1

Open Issues: 1

Type:wordpress-plugin

pkg:composer/wordpress/anthropic-ai-provider

1.0.0 2026-02-12 05:24 UTC

This package is auto-updated.

Last update: 2026-02-12 05:24:25 UTC


README

An Anthropic (Claude) provider for the PHP AI Client SDK. Works as both a Composer package and a WordPress plugin.

Requirements

Installation

As a Composer Package

composer require wordpress/anthropic-ai-provider

As a WordPress Plugin

  1. Download the plugin files
  2. Upload to /wp-content/plugins/anthropic-ai-provider/
  3. Ensure the PHP AI Client plugin is installed and activated
  4. Activate the plugin through the WordPress admin

Usage

With WordPress

The provider automatically registers itself with the PHP AI Client on the init hook. Simply ensure both plugins are active and configure your API key:

// Set your Anthropic API key (or use the ANTHROPIC_API_KEY environment variable)
putenv('ANTHROPIC_API_KEY=your-api-key');

// Use the provider
$result = AiClient::prompt('Hello, world!')
    ->usingProvider('anthropic')
    ->generateTextResult();

As a Standalone Package

use WordPress\AiClient\AiClient;
use WordPress\AnthropicAiProvider\Provider\AnthropicProvider;

// Register the provider
$registry = AiClient::defaultRegistry();
$registry->registerProvider(AnthropicProvider::class);

// Set your API key
putenv('ANTHROPIC_API_KEY=your-api-key');

// Generate text
$result = AiClient::prompt('Explain quantum computing')
    ->usingProvider('anthropic')
    ->generateTextResult();

echo $result->toText();

Supported Models

Available models are dynamically discovered from the Anthropic API. This includes Claude models for text generation with multimodal input support. See the Anthropic documentation for the full list of available models.

Configuration

The provider uses the ANTHROPIC_API_KEY environment variable for authentication. You can set this in your environment or via PHP:

putenv('ANTHROPIC_API_KEY=your-api-key');

License

GPL-2.0-or-later