OllamaPress is a WordPress plugin that provides a bridge between WordPress and Ollama's API, allowing you to interact with large language models directly from your WordPress installation.
OllamaPress exposes Ollama's API endpoints through WordPress REST API routes, making it easy to integrate AI capabilities into your WordPress site. Whether you want to generate text completions, have interactive chats, or work with AI models, OllamaPress provides the necessary infrastructure.
Complete Ollama API integration including:
- Text generation and completions
- Interactive chat capabilities
- Model management (create, list, copy, delete)
- Embedding generation
- Model information retrieval
- Support for streaming responses
- Support for multimodal models (like llava)
- WordPress installation
- Running Ollama instance
- WordPress REST API enabled
- Download the plugin files
- Upload them to your
/wp-content/plugins/directory - Activate the plugin through the 'Plugins' menu in WordPress
- Configure your Ollama API URL in the plugin settings (default:
http://localhost:11434/api)
If WordPress is running in Docker and Ollama is installed on your localhost you can use http://host.docker.internal:11434/api as the API URL.
You can save these values in the options panel or define them in your wp-config.php:
define('OLLAMA_URL', 'http://host.docker.internal:11434/api');
define('OLLAMA_TIMEOUT', 300);OllamaPress exposes the following WordPress REST API endpoints (namespace: ollama/v1):
POST /wp-json/ollama/v1/generate- Generate text completionsPOST /wp-json/ollama/v1/chat- Interactive chat with modelsPOST /wp-json/ollama/v1/embed- Generate embeddings
GET /wp-json/ollama/v1/models- List available modelsPOST /wp-json/ollama/v1/create- Create a new modelPOST /wp-json/ollama/v1/info- Get model informationPOST /wp-json/ollama/v1/copy- Copy a modelDELETE /wp-json/ollama/v1/delete- Delete a modelPOST /wp-json/ollama/v1/pull- Pull a model from OllamaPOST /wp-json/ollama/v1/push- Push a model to OllamaGET /wp-json/ollama/v1/running- List currently running models
$response = wp_remote_post(rest_url('ollama/v1/generate'), [
'body' => wp_json_encode([
'model' => 'llama2',
'prompt' => 'Write a short blog post about WordPress',
'stream' => false
]),
'headers' => ['Content-Type' => 'application/json'],
]);$response = wp_remote_post(rest_url('ollama/v1/chat'), [
'body' => wp_json_encode([
'model' => 'llama2',
'messages' => [
['role' => 'user', 'content' => 'What is WordPress?']
],
'stream' => false
]),
'headers' => ['Content-Type' => 'application/json'],
]);$response = wp_remote_post(rest_url('ollama/v1/embed'), [
'body' => wp_json_encode([
'model' => 'all-minilm',
'input' => 'Text to embed'
]),
'headers' => ['Content-Type' => 'application/json'],
]);This plugin is licensed under the GPL v2 or later.
Commercial support is available for this plugin. Book a consultation to get started.