maryushenina/ai-client-sdk

Lightweight SDK for using OpenAI Chat Completion API in PHP projects.

v0.1.0 2025-07-03 09:18 UTC

This package is auto-updated.

Last update: 2025-07-03 13:29:59 UTC


README

Lightweight SDK for interacting with the OpenAI Chat Completion API using PHP.

Tests Packagist License

Installation

composer require maryushenina/ai-client-sdk

Usage

use GuzzleHttp\Client;
use MaryUshenina\AiClientSdk\OpenAIClient;

$client = new OpenAIClient(new Client(), 'your-api-key');

$response = $client->complete([
    ['role' => 'system', 'content' => 'You are a helpful assistant.'],
    ['role' => 'user', 'content' => 'What is PHP?']
]);

echo $response;

Testing

./vendor/bin/phpunit

Install dependencies

make install

Rebuild environment (clean + install)

make rebuild

Run tests inside Docker (optional)

make docker-test

License

MIT