PHPackages                             1tomany/llm-sdk - 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. 1tomany/llm-sdk

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

1tomany/llm-sdk
===============

A single, unified, framework-independent library for integration with many popular AI platforms and large language models

v0.7.7(1mo ago)096↓38.1%[5 issues](https://github.com/1tomany/llm-sdk/issues)1MITPHPPHP &gt;=8.4

Since Jan 29Pushed 1mo agoCompare

[ Source](https://github.com/1tomany/llm-sdk)[ Packagist](https://packagist.org/packages/1tomany/llm-sdk)[ RSS](/packages/1tomany-llm-sdk/feed)WikiDiscussions master Synced 1mo ago

READMEChangelog (10)Dependencies (28)Versions (38)Used By (1)

AI and LLM Library for PHP
==========================

[](#ai-and-llm-library-for-php)

This library provides a single, unified, framework-independent library for integration with several popular AI platforms and large language models.

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

[](#installation)

Install the library using Composer:

```
composer require 1tomany/llm-sdk
```

Usage
-----

[](#usage)

There are two ways to use this library:

1. **Direct** Instantiate the AI client you wish to use and send a request object to it. This method is easier to use, but comes with the cost that your application will be less flexible and testable.
2. **Actions** Register the clients you wish to use with a `OneToMany\LlmSdk\Factory\ClientFactory` instance, inject that instance into each action you wish to take, and interact with the action instead of through the client.

**Note:** A [Symfony bundle](https://github.com/1tomany/llm-sdk-bundle) is available if you wish to integrate this library into your Symfony applications with autowiring and configuration support.

You can learn how to use this library by reviewing the examples below while I'm working on thoroughly documenting it.

### Examples

[](#examples)

- [`examples/files/upload.php`](https://github.com/1tomany/llm-sdk/blob/master/examples/files/upload.php) Uploads a file to an LLM vendor
- [`examples/files/deletes.php`](https://github.com/1tomany/llm-sdk/blob/master/examples/files/delete.php) Deletes a file from an LLM vendor
- [`examples/embeddings/create.php`](https://github.com/1tomany/llm-sdk/blob/master/examples/embeddings/create.php) Creates an embedding vector from a prompt sent to an LLEM (large language embedding model)
- [`examples/outputs/generate.php`](https://github.com/1tomany/llm-sdk/blob/master/examples/outputs/generate.php) Generates output from a prompt sent to an LLM

Supported platforms
-------------------

[](#supported-platforms)

- Anthropic
- Gemini
- Mock
- OpenAI

### Platform feature support

[](#platform-feature-support)

**Note:** Each platform refers to generating output (inference) differently; OpenAI uses the word "Responses" while Gemini uses the word "Content". I've decided the word "Output" best represents what a large language model produces in the case of generative models, and "Embedding" in the case of embedding models.

To generate output or create an embedding, you must first compile a "Query". A query is made up of different input components: text prompts, files, a JSON schema, and/or system instructions.

This library allows you to compile a query before sending it to the model for two reasons:

1. You can log/analyze the request payload before sending it to the model.
2. You can compile individual requests for batching.

FeatureAnthropicGeminiMockOpenAI**Batches**Create❌✅✅✅Read❌✅✅✅Cancel❌❌❌❌**Embeddings**Create❌✅✅✅**Files**Upload✅✅✅✅Read❌❌❌❌List❌❌❌❌Download❌❌❌❌Delete✅✅✅✅**Outputs**Generate❌✅✅✅**Queries**Compile❌✅✅✅Credits
-------

[](#credits)

- [Vic Cherubini](https://github.com/viccherubini), [1:N Labs, LLC](https://1tomany.com)

License
-------

[](#license)

The MIT License

###  Health Score

43

—

FairBetter than 91% of packages

Maintenance88

Actively maintained with recent releases

Popularity13

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity53

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% 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 ~1 days

Total

36

Last Release

59d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/60762?v=4)[Vic Cherubini](/maintainers/viccherubini)[@viccherubini](https://github.com/viccherubini)

---

Top Contributors

[![viccherubini](https://avatars.githubusercontent.com/u/60762?v=4)](https://github.com/viccherubini "viccherubini (177 commits)")

---

Tags

aiopenaiGeminiclaudellmgptai clientChatGptOpen AIAI SDKchat gptllm clientllm sdk

###  Code Quality

TestsPHPUnit

Static AnalysisPHPStan

Code StylePHP CS Fixer

Type Coverage Yes

### Embed Badge

![Health badge](/badges/1tomany-llm-sdk/health.svg)

```
[![Health](https://phpackages.com/badges/1tomany-llm-sdk/health.svg)](https://phpackages.com/packages/1tomany-llm-sdk)
```

###  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)[symfony/ai-platform

PHP library for interacting with AI platform provider.

51927.7k136](/packages/symfony-ai-platform)[symfony/ai-agent

PHP library for building agentic applications.

30536.7k44](/packages/symfony-ai-agent)[sbsaga/toon

🧠 TOON for Laravel — a compact, human-readable, and token-efficient data format for AI prompts &amp; LLM contexts. Perfect for ChatGPT, Gemini, Claude, Mistral, and OpenAI integrations (JSON ⇄ TOON).

6115.6k](/packages/sbsaga-toon)[vizra/vizra-adk

Vizra Agent Development Kit - A comprehensive Laravel package for building intelligent AI agents.

29026.1k](/packages/vizra-vizra-adk)

PHPackages © 2026

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