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.8.1(3w ago)0124↓87.6%[6 issues](https://github.com/1tomany/llm-sdk/issues)1MITPHPPHP &gt;=8.4

Since Jan 29Pushed 3w 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 3d ago

READMEChangelog (10)Dependencies (48)Versions (41)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.

### Examples

[](#examples)

Review the examples below to get an idea of how the library works.

#### Embeddings

[](#embeddings)

- [`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)

#### Files

[](#files)

- [`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/delete.php`](https://github.com/1tomany/llm-sdk/blob/master/examples/files/delete.php) Deletes a file from an LLM vendor

#### Outputs

[](#outputs)

- [`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

#### Search Stores

[](#search-stores)

- [`examples/search-stores/create.php`](https://github.com/1tomany/llm-sdk/blob/master/examples/search-stores/create.php) Creates a search store for RAG outputs
- [`examples/search-stores/read.php`](https://github.com/1tomany/llm-sdk/blob/master/examples/search-stores/read.php) Displays information about a search store
- [`examples/search-stores/search.php`](https://github.com/1tomany/llm-sdk/blob/master/examples/search-stores/search.php) Searches a store with a given prompt
- [`examples/search-stores/files/import.php`](https://github.com/1tomany/llm-sdk/blob/master/examples/search-stores/files/import.php) Imports an uploaded file to a search store

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❌✅✅✅**Search Stores**Create❌✅❌❌Read❌✅❌❌Search❌✅❌❌ImportFile❌✅❌❌Credits
-------

[](#credits)

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

License
-------

[](#license)

The MIT License

###  Health Score

44

—

FairBetter than 90% of packages

Maintenance95

Actively maintained with recent releases

Popularity10

Limited adoption so far

Community10

Small or concentrated contributor base

Maturity54

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 ~3 days

Recently: every ~20 days

Total

38

Last Release

24d 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 (183 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

[craftcms/cms

Craft CMS

3.6k3.6M3.1k](/packages/craftcms-cms)[api-platform/core

Build a fully-featured hypermedia or GraphQL API in minutes!

2.6k51.2M339](/packages/api-platform-core)[symfony/ai-agent

PHP library for building agentic applications.

32870.1k107](/packages/symfony-ai-agent)[web-auth/webauthn-framework

FIDO2/Webauthn library for PHP and Symfony Bundle.

515100.5k3](/packages/web-auth-webauthn-framework)[sylius/sylius

E-Commerce platform for PHP, based on Symfony framework.

8.5k5.9M737](/packages/sylius-sylius)[cognesy/instructor-php

The complete AI toolkit for PHP: unified LLM API, structured outputs, agents, and coding agent control

318123.0k1](/packages/cognesy-instructor-php)

PHPackages © 2026

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