lanos / anthropic
PHP client for the Anthropic API
v1.0.0
2024-12-27 01:21 UTC
Requires
- php: ^8.1
- guzzlehttp/guzzle: ^7.0
Requires (Dev)
- phpunit/phpunit: ^10.0
README
A PHP client for the Anthropic API.
Installation
composer require lanos/anthropic
Usage
use Lanos\Anthropic\Anthropic; $anthropic = new Anthropic('your-api-key'); // Create a message $response = $anthropic->messages()->create([ 'model' => 'claude-3-opus-20240229', 'messages' => [ ['role' => 'user', 'content' => 'Hello, Claude!'] ], 'max_tokens' => 1024 ]); // List available models $models = $anthropic->models()->list(); // Create a message batch $batch = $anthropic->messageBatches()->create([ 'model' => 'claude-3-opus-20240229', 'messages' => [ ['role' => 'user', 'content' => 'Hello!'], ['role' => 'user', 'content' => 'How are you?'] ] ]);