rodrigo@dev:~/plugins/ai-provider-for-ollama-local$ cd ..# back to plugins
rodrigo@dev:~/plugins/ai-provider-for-ollama-local$ cat plugin.json
name: AI Provider for Ollama Localversion: 0.1.0license: GPL-2.0-or-laterprice: FREE
WordPress Plugin — Free & Open Source

Connect WordPress 7.0 AI to your own Ollama server

rodrigo@dev:~/plugins/ai-provider-for-ollama-local$ cat problem.md

WordPress 7.0 shipped with native AI integration — the new WordPress AI Client lets you use language models right in the editor to write, summarise and improve content.

The problem: every available connector needs an API key from a cloud service (OpenAI, Anthropic, Google…). For anyone using Ollama — the runtime that runs models like Llama 3, Mistral, Gemma or Phi locally with no per-token cost — there was no official connector.

rodrigo@dev:~/plugins/ai-provider-for-ollama-local$ cat solution.md

I built this WordPress plugin from scratch to fill that gap.

It connects the new WordPress 7.0 AI Client to any local or remote Ollama server, using the OpenAI-compatible endpoint Ollama already exposes. No sign-up, no subscription, no data leaving your machine.

rodrigo@dev:~/plugins/ai-provider-for-ollama-local$ ./features --list
  • +No API key: no sign-up or subscription
  • +Automatically finds every model installed in Ollama
  • +wp-admin screen (Settings → Connectors) with live status
  • +Works with local Ollama, Docker or a remote server
  • +Configurable URL: wp-admin → PHP constant → env var → default
  • +No external dependencies: no Composer, no node_modules
  • +GPL-2.0-or-later, free and open source
rodrigo@dev:~/plugins/ai-provider-for-ollama-local$ cat architecture.txt

plugin.php
├─ register_provider()          → registers in the WP AI Client registry
├─ register_connector()         → shows up in Settings → Connectors
├─ register_rest_endpoint()     → POST /ai-provider-for-ollama-local/v1/settings
└─ enqueue_connector_card_module()

src/
├─ Provider/OllamaProvider.php
│   └─ extends AbstractApiProvider
├─ Models/OllamaTextGenerationModel.php
│   └─ POST /v1/chat/completions  (OpenAI-compatible)
├─ Metadata/OllamaModelMetadataDirectory.php
│   └─ GET  /v1/models            (model discovery)
└─ Support/OllamaConfig.php
    └─ option → constant → env var → default URL

assets/connector-card.js
    └─ React UI (wp.element) with no build step
rodrigo@dev:~/plugins/ai-provider-for-ollama-local$ cat decisions.md
DecisionWhy
No ComposerInstall = upload the folder. Zero runtime dependencies
Hand-written PSR-4 autoloaderSame reason — independent of the PHP setup
esc_url_raw + sanitize_text_fieldWordPress security best practices on every input
Custom REST endpointSave settings via fetch without reloading the page
Placeholder API keyThe WP AI Client requires auth to be set; a local token avoids errors
wp.element with no build stepZero tooling setup for contributors
rodrigo@dev:~/plugins/ai-provider-for-ollama-local$ ./check --requirements
WordPress7.0+ (AI Client API)
PHP7.4+
Ollamaany recent version with the /v1 endpoint
rodrigo@dev:~/plugins/ai-provider-for-ollama-local$ ls --links
rodrigo@dev:~/plugins/ai-provider-for-ollama-local$ cd ..▋