torounit/ai-provider-for-lm-studio
Composer 安装命令:
composer require torounit/ai-provider-for-lm-studio
包简介
LM Studio AI Provider for the PHP AI Client SDK.
关键字:
README 文档
README
LM Studio AI Provider for the PHP AI Client SDK.
Requirements
- PHP 7.4+
- wordpress/php-ai-client ^1.3
- LM Studio running locally with the server enabled
Installation
As a Composer Package
composer require torounit/ai-provider-for-lm-studio
As a WordPress Plugin
- Upload the plugin files to
/wp-content/plugins/ai-provider-for-lm-studio/ - Activate the plugin through the Plugins menu in WordPress
- Start LM Studio and enable the local server (Developer tab → Start Server)
Configuration
| Variable | Default | Description |
|---|---|---|
LM_STUDIO_SERVER_URL |
http://localhost:1234 |
LM Studio server URL (scheme + host + port, no API path) |
Both environment variables and PHP constants (e.g. define('LM_STUDIO_SERVER_URL', '...') in wp-config.php) are supported.
Usage
Composer (standalone)
<?php require __DIR__ . '/vendor/autoload.php'; use WordPress\AiClient\AiClient; use ToroUnit\LmStudioAiProvider\Provider\LmStudioProvider; // putenv('LM_STUDIO_SERVER_URL=http://localhost:1234'); $registry = AiClient::defaultRegistry(); $registry->registerProvider(LmStudioProvider::class); // List available models $models = LmStudioProvider::modelMetadataDirectory()->listModelMetadata(); foreach ($models as $model) { echo $model->getId() . "\n"; } // Generate text $result = AiClient::prompt('Hello, who are you?') ->usingProvider('lm_studio') ->generateText(); echo $result . "\n";
WordPress Plugin
After activating the plugin, the LM Studio provider is automatically registered with the AI Client. Use the AI Client API as usual:
use WordPress\AiClient\AiClient; $result = AiClient::prompt('Hello, who are you?') ->usingProvider('lm_studio') ->generateText();
License
GPL-2.0-or-later
统计信息
- 总下载量: 0
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 0
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-2.0-or-later
- 更新时间: 2026-06-07