1tomany/llm-sdk
Composer 安装命令:
composer require 1tomany/llm-sdk
包简介
A single, unified, framework-independent library for integration with many popular AI platforms and large language models
关键字:
README 文档
README
This library provides a single, unified, framework-independent library for integration with several popular AI platforms and large language models.
Installation
Install the library using Composer:
composer require 1tomany/llm-sdk
Usage
There are two ways to use this library:
- 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.
- Actions Register the clients you wish to use with a
OneToMany\LlmSdk\Factory\ClientFactoryinstance, inject that instance into each action you wish to take, and interact with the action instead of through the client.
Note: A Symfony bundle is available if you wish to integrate this library into your Symfony applications with autowiring and configuration support.
Examples
Review the examples below to get an idea of how the library works.
Embeddings
examples/embeddings/create.phpCreates an embedding vector from a prompt sent to an LLEM (large language embedding model)
Files
examples/files/upload.phpUploads a file to an LLM vendorexamples/files/delete.phpDeletes a file from an LLM vendor
Outputs
examples/outputs/generate.phpGenerates output from a prompt sent to an LLM
Search Stores
examples/search-stores/create.phpCreates a search store for RAG outputsexamples/search-stores/read.phpDisplays information about a search storeexamples/search-stores/search.phpSearches a store with a given promptexamples/search-stores/files/import.phpImports an uploaded file to a search store
Supported platforms
- Anthropic
- Gemini
- Mock
- OpenAI
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:
- You can log/analyze the request payload before sending it to the model.
- You can compile individual requests for batching.
| Feature | Anthropic | Gemini | Mock | OpenAI |
|---|---|---|---|---|
| Batches | ||||
| Create | ❌ | ✅ | ✅ | ✅ |
| Read | ❌ | ✅ | ✅ | ✅ |
| Cancel | ❌ | ❌ | ❌ | ❌ |
| Embeddings | ||||
| Create | ❌ | ✅ | ✅ | ✅ |
| Files | ||||
| Upload | ✅ | ✅ | ✅ | ✅ |
| Read | ❌ | ❌ | ❌ | ❌ |
| List | ❌ | ❌ | ❌ | ❌ |
| Download | ❌ | ❌ | ❌ | ❌ |
| Delete | ✅ | ✅ | ✅ | ✅ |
| Outputs | ||||
| Generate | ❌ | ✅ | ✅ | ✅ |
| Queries | ||||
| Compile | ❌ | ✅ | ✅ | ✅ |
| Search Stores | ||||
| Create | ❌ | ✅ | ❌ | ❌ |
| Read | ❌ | ✅ | ❌ | ❌ |
| Search | ❌ | ✅ | ❌ | ❌ |
| ImportFile | ❌ | ✅ | ❌ | ❌ |
Credits
License
The MIT License
1tomany/llm-sdk 适用场景与选型建议
1tomany/llm-sdk 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 124 次下载、GitHub Stars 达 0, 最近一次更新时间为 2026 年 02 月 20 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「ai」 「Gemini」 「ai client」 「openai」 「ChatGpt」 「gpt」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 1tomany/llm-sdk 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 1tomany/llm-sdk 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 1tomany/llm-sdk 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
PHP 8.0+ OpenAI API client with fully typed/documented requests+responses models, guzzle and symfony/http-client support and async/parallel requests.
Mock PSR-18 HTTP client
Estimate AI API costs before making expensive calls
Asynchronous MQTT client built on React
A powerful package that seamlessly integrates OpenAI's advanced AI capabilities into your Laravel applications. This package offers quick setup and intuitive configuration to leverage AI models for chat, embeddings, and more.
AI Agent templates for Laravel development - Skills, Agents, and Workflows for enhanced coding assistance
统计信息
- 总下载量: 124
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 36
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2026-02-20