定制 wordpress/ai-provider-for-anthropic 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

wordpress/ai-provider-for-anthropic

最新稳定版本:1.0.3

Composer 安装命令:

composer require wordpress/ai-provider-for-anthropic

包简介

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

README 文档

README

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

Requirements

  • PHP 7.4 or higher
  • When using with WordPress, requires WordPress 7.0 or higher

Installation

As a Composer Package

composer require wordpress/ai-provider-for-anthropic

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

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

统计信息

  • 总下载量: 320
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 10
  • 点击次数: 4
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 10
  • Watchers: 1
  • Forks: 3
  • 开发语言: PHP

其他信息

  • 授权协议: GPL-2.0-or-later
  • 更新时间: 2026-02-21