jonathanbossenger/wp-ollama-model-provider
Composer 安装命令:
composer require jonathanbossenger/wp-ollama-model-provider
包简介
Ollama AI model provider for WordPress AI Client. Enables WordPress to use Ollama models locally or in the cloud.
README 文档
README
A WordPress plugin that provides local and cloud AI model support (Ollama) for the WordPress AI Client.
Description
WP Ollama Model Provider enables WordPress to use AI models through Ollama, supporting both local installations and Ollama Cloud. This plugin acts as a provider for the WordPress AI Client, making Ollama models accessible to any WordPress plugin that uses the AI Client.
Features
- Flexible Deployment: Support for both local Ollama installations and Ollama Cloud
- Local AI Models: Run AI models locally with Ollama - no cloud API keys required
- Cloud Integration: Use Ollama Cloud for easy access without local installation
- Automatic Model Detection: Discovers all available Ollama models on your system or cloud account
- Simple Configuration: Easy settings page at Settings > Ollama AI Models
- Model Selection: Choose which Ollama model to use from a dropdown
- Model Caching: Efficient 5-minute cache for model discovery
- Public API: Other plugins can easily check for and use your selected model
- Privacy-First: Local mode ensures text generation happens entirely on your machine
Supported Providers
- Ollama (current)
- Local installation
- Ollama Cloud
- Future: LocalAI, LM Studio, and other local providers
Requirements
- PHP: 8.0 or higher
- WordPress: 6.0 or higher
- Dependencies:
wordpress/wp-ai-client^0.2.1- For local mode: Ollama installed and running locally
- For cloud mode: Ollama Cloud API key
Installation
Via Composer (Recommended)
# Install in your WordPress project
composer require jonathanbossenger/wp-ollama-model-provider
The plugin will be installed to wp-content/plugins/wp-ollama-model-provider/ (or web/app/plugins/ for Bedrock).
Activate it through the WordPress admin.
For Bedrock/Roots.io users: The package will automatically install to the correct plugins directory.
For traditional WordPress installations:
Run composer from your WordPress root with proper installer-paths configured, or run it directly in wp-content/plugins/.
Manual Installation
- Download the latest release from GitHub Releases
- Upload to
/wp-content/plugins/wp-ollama-model-provider/ - Run
composer install --no-devin the plugin directory - Activate the plugin through the WordPress admin
Setup Ollama
Local Setup
- Install Ollama from https://ollama.com
- Pull at least one model:
ollama pull llama3.2
- Verify Ollama is running:
curl http://localhost:11434/api/tags
Ollama Cloud Setup
- Sign up for Ollama Cloud at https://ollama.com/cloud
- Get your API key from the Ollama Cloud dashboard
Configuration
For Local Ollama:
- Navigate to Settings > Ollama AI Models in WordPress admin
- Select Local as the deployment mode
- Select your preferred Ollama model from the dropdown
- Click Save Settings
For Ollama Cloud:
- Navigate to Settings > Ollama AI Models in WordPress admin
- Select Ollama Cloud as the deployment mode
- Enter your Ollama Cloud API key
- Select your preferred model from the dropdown
- Click Save Settings
Your selected model is now available to all WordPress plugins that use the AI Client.
Usage
For End Users
Once configured, the plugin runs automatically in the background. Any WordPress plugin that uses the WordPress AI Client can detect and use your selected Ollama model.
For Plugin Developers
Check for Selected Model
if ( function_exists( 'wp_ollama_model_provider_get_selected_model' ) ) { $selected_model = wp_ollama_model_provider_get_selected_model( 'ollama' ); if ( ! empty( $selected_model ) ) { // Use the selected Ollama model } }
Use the Selected Model
// Check for selected Ollama model from wp-ollama-model-provider if ( function_exists( 'wp_ollama_model_provider_get_selected_model' ) ) { $selected_ollama_model = wp_ollama_model_provider_get_selected_model( 'ollama' ); if ( ! empty( $selected_ollama_model ) && class_exists( 'WpOllamaModelProvider\Providers\Ollama\OllamaProvider' ) ) { $model = \WpOllamaModelProvider\Providers\Ollama\OllamaProvider::model( $selected_ollama_model ); $registry = \WordPress\AiClient\AiClient::defaultRegistry(); $registry->bindModelDependencies( $model ); return \WordPress\AI_Client\AI_Client::prompt( $prompt ) ->using_model( $model ) ->generate_text(); } } // Fall back to automatic provider/model selection return \WordPress\AI_Client\AI_Client::prompt( $prompt )->generate_text();
Public API Functions
wp_ollama_model_provider_is_provider_registered( $provider_slug )
- Check if a provider (e.g., 'ollama') is registered
- Returns:
bool
wp_ollama_model_provider_has_settings_page()
- Check if the settings page is available
- Returns:
bool
wp_ollama_model_provider_get_selected_model( $provider_slug )
- Get the selected model for a provider (e.g., 'ollama')
- Returns:
string(model ID) or empty string if none selected
Filters
wp_ai_client_ollama_base_url
Change the Ollama base URL (default: http://localhost:11434).
add_filter( 'wp_ai_client_ollama_base_url', function() { return 'http://192.168.1.100:11434'; // Remote Ollama server } );
wp_ai_client_default_request_timeout
Adjust timeout for slower models (default: varies by plugin).
add_filter( 'wp_ai_client_default_request_timeout', function() { return 120; // 2 minutes } );
Documentation
- Quick Start Guide - Get up and running in 5 minutes
- Ollama Models Reference - Model recommendations and comparisons
- Integration Guide - Technical integration details
Troubleshooting
No models appearing in dropdown
-
Verify Ollama is running:
ollama list
-
Pull a model if needed:
ollama pull llama3.2
-
Use the "Refresh Model List" button on the settings page
Cannot connect to Ollama
-
Check if Ollama is running:
curl http://localhost:11434/api/tags
-
Start Ollama if needed:
ollama serve
Slow generation times
- Use a smaller model (e.g.,
llama3.2:1binstead ofllama2:13b) - Increase the timeout using the
wp_ai_client_default_request_timeoutfilter - See OLLAMA-MODELS.md for model recommendations
Enable debug logging
// In wp-config.php define( 'WP_DEBUG', true ); define( 'WP_DEBUG_LOG', true ); define( 'WP_DEBUG_DISPLAY', false );
Check wp-content/debug.log for error messages.
Limitations
- Text Generation Only: Ollama only supports text generation, not image generation
- Local Models: Requires Ollama to be installed and running locally (or on your network)
- Resource Intensive: Larger models require significant RAM and CPU/GPU resources
Contributing
Contributions are welcome! Please feel free to submit issues or pull requests.
Development Setup
- Clone the repository
- Run
composer install - Ensure Ollama is installed and running
- Activate the plugin in a WordPress development environment
Coding Standards
This plugin follows WordPress Coding Standards. Check your code:
vendor/bin/phpcs --standard=WordPress wp-ollama-model-provider.php includes/
License
GPL-2.0-or-later
Support
- Issues: GitHub Issues
- Documentation: See
docs/directory - Ollama: https://ollama.com
Credits
Created by Jonathan Bossenger
Built on top of:
jonathanbossenger/wp-ollama-model-provider 适用场景与选型建议
jonathanbossenger/wp-ollama-model-provider 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 2 次下载、GitHub Stars 达 9, 最近一次更新时间为 2026 年 02 月 07 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「wordpress」 「cloud」 「local」 「wordpress-plugin」 「ai」 「machine-learning」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 jonathanbossenger/wp-ollama-model-provider 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 jonathanbossenger/wp-ollama-model-provider 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 jonathanbossenger/wp-ollama-model-provider 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
A SDK for working with B2 cloud storage.
Small library to access Microsoft Windows Azure Blob Storage with a Service or a StreamWrapper.
Allow packages to be installed from a repository or tarball bundle that have multiple packages in the sub-folders
UCloud Resource (Cloud) Storage SDK for PHP
The flysystem adapter for yandex disk rest api.
A sleek PHP wrapper around rclone with Laravel-style fluent API syntax
统计信息
- 总下载量: 2
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 9
- 点击次数: 26
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: GPL-2.0-or-later
- 更新时间: 2026-02-07