Search by

aisdk / core

aisdk

Framework-agnostic PHP AI SDK.

Package info

github.com/phpaisdk/core

pkg:composer/aisdk/core

Fund package maintenance!

Open Collective

Statistics

Installs: 2 686

Dependents: 49

Suggesters: 0

Stars: 2

Open Issues: 1

v0.11.0 2026-10-31 02:58 UTC

README

A framework-agnostic PHP SDK for working with AI providers. Generate text, images, audio, video, embeddings, and structured decisions; build agents with tools, approvals, and conversation storage.

Installation

composer require aisdk/core aisdk/openai

Requires PHP 8.3 or later. Set OPENAI_API_KEY in your environment. Each provider is a separate Composer package; this example installs OpenAI.

Usage

use AiSdk\Generate;
use AiSdk\OpenAI;

$result = Generate::text('Explain closures in PHP in one sentence.')
    ->model(OpenAI::model('gpt-6.1-sol'))
    ->run();

echo $result->text;

Use ->stream() for streaming responses. The SDK also provides instance-based runtimes for dependency injection and long-running workers.

Documentation

Read the documentation for configuration, supported features, and more examples.

Contributing ยท Support

License

The MIT License (MIT). See LICENSE for details.