PHPackages                             wordpress/ai-provider-for-anthropic - 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. [Utility &amp; Helpers](/categories/utility)
4. /
5. wordpress/ai-provider-for-anthropic

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

wordpress/ai-provider-for-anthropic
===================================

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

1.0.2(2mo ago)10154↑66.7%3[4 issues](https://github.com/WordPress/ai-provider-for-anthropic/issues)[1 PRs](https://github.com/WordPress/ai-provider-for-anthropic/pulls)GPL-2.0-or-laterPHPPHP &gt;=7.4

Since Feb 12Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/WordPress/ai-provider-for-anthropic)[ Packagist](https://packagist.org/packages/wordpress/ai-provider-for-anthropic)[ Docs](https://github.com/WordPress/ai-provider-for-anthropic)[ RSS](/packages/wordpress-ai-provider-for-anthropic/feed)WikiDiscussions trunk Synced 1mo ago

READMEChangelog (3)Dependencies (12)Versions (12)Used By (0)

AI Provider for Anthropic
=========================

[](#ai-provider-for-anthropic)

An Anthropic (Claude) provider for the [PHP AI Client](https://github.com/WordPress/php-ai-client) SDK. Works as both a Composer package and a WordPress plugin.

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

[](#requirements)

- PHP 7.4 or higher
- When using with WordPress, requires WordPress 7.0 or higher
    - If using an older WordPress release, the [wordpress/php-ai-client](https://github.com/WordPress/php-ai-client) package must be installed

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

[](#installation)

### As a Composer Package

[](#as-a-composer-package)

```
composer require wordpress/ai-provider-for-anthropic
```

### As a WordPress Plugin

[](#as-a-wordpress-plugin)

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

Usage
-----

[](#usage)

### With WordPress

[](#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

[](#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
----------------

[](#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](https://docs.anthropic.com/en/docs/about-claude/models) for the full list of available models.

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

[](#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
-------

[](#license)

GPL-2.0-or-later

###  Health Score

40

—

FairBetter than 88% of packages

Maintenance77

Regular maintenance activity

Popularity23

Limited adoption so far

Community14

Small or concentrated contributor base

Maturity40

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 50% 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.

###  Release Activity

Cadence

Every ~10 days

Total

3

Last Release

75d ago

### Community

Maintainers

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

---

Top Contributors

[![felixarntz](https://avatars.githubusercontent.com/u/3531426?v=4)](https://github.com/felixarntz "felixarntz (15 commits)")[![JasonTheAdams](https://avatars.githubusercontent.com/u/2024145?v=4)](https://github.com/JasonTheAdams "JasonTheAdams (7 commits)")[![jeffpaul](https://avatars.githubusercontent.com/u/2818133?v=4)](https://github.com/jeffpaul "jeffpaul (5 commits)")[![shaunandrews](https://avatars.githubusercontent.com/u/191598?v=4)](https://github.com/shaunandrews "shaunandrews (2 commits)")[![Jameswlepage](https://avatars.githubusercontent.com/u/36246732?v=4)](https://github.com/Jameswlepage "Jameswlepage (1 commits)")

---

Tags

wordpressaiclaudellmanthropic

###  Code Quality

Static AnalysisPHPStan

Code StylePHP\_CodeSniffer

Type Coverage Yes

### Embed Badge

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

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

###  Alternatives

[cognesy/instructor-php

The complete AI toolkit for PHP: unified LLM API, structured outputs, agents, and coding agent control

310107.9k1](/packages/cognesy-instructor-php)[llm-agents/agents

LLM Agents PHP SDK - Autonomous Language Model Agents for PHP

16410.9k9](/packages/llm-agents-agents)[soukicz/llm

LLM client with support for cache, tools and async requests

445.6k](/packages/soukicz-llm)

PHPackages © 2026

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