Blog

Self-Hosted AI in WordPress with Ollama and Qdrant

A WordPress support chat can send a conversation, an article snippet, or text to be indexed to the URL configured in the plugin. If that URL points to OpenAI or another external provider, the request leaves the server. A self-hosted installation connects WordPress with Ollama to run models and with Qdrant to search for information using vectors. This article separates the workload between the engine, memory, and plugins.

Why Keep AI Inside Your Server

Controlling where text is processed and avoiding provider quotas are two reasons to set up AI on your own infrastructure. When WordPress, Ollama, and Qdrant run on the same server or in a private network that you manage, prompts and vectors can remain under your control. Ollama’s code uses an MIT license and Qdrant’s uses Apache 2.0; each downloaded model has its own license. Self-hosting can eliminate the per-request fee, but not the total cost of the service.

Before installing anything, define the tasks you want to migrate: drafts, support chat, or internal search. For a support chat, it is advisable to measure latency with several simultaneous requests; for an index, the publishing frequency and the volume of each entry matter. This list determines the model, the context, the RAM, and whether you need a GPU.

Ollama and Qdrant: Engine and Memory

Ollama allows you to download and run models such as llama3, mistral, or gemma. The files for an 8B 4-bit Llama 3 variant take up several gigabytes; the size depends on the quantization, and memory consumption also varies with the context length. Its API listens on port 11434 by default and offers OpenAI-compatible routes under /v1. A compatible client can point to that URL, but it must verify the endpoints, model names, streaming, tool calls, and embeddings.

Qdrant organizes embeddings into collections and can search by cosine similarity. Its Docker deployment exposes port 6333 for the REST API and 6334 for gRPC by default. all-MiniLM-L6-v2, run with a compatible library like Sentence Transformers, generates 384-dimensional vectors; via the Ollama API, nomic-embed-text is another option. The same model must generate the vectors during both indexing and queries, and its dimensions must match those of the collection. Once the model and collection are defined, it’s time to connect the services.

If WordPress also runs as a container in the same Docker Compose network, services are resolved by name, and internal URLs http://ollama:11434 and http://qdrant:6333 can be used without exposing the ports to the Internet. If WordPress runs on the host, it must connect to that network or use mapped ports with limited access. The full deployment, including Compose, volumes, and context settings, can be found in Local AI in WordPress with Ollama and Qdrant: build your self-hosted stack.

The initial check consists of starting the containers and running curl http://localhost:11434/api/tags. The response includes the models downloaded to that instance. If none appear, a model must still be downloaded before connecting WordPress.

The Plugin Layer: WordPress Enters the Scene

WordPress does not need a plugin written from scratch for this architecture. The first filter is to check if it allows separately configuring the generation URL and the embeddings URL. AI Engine, by Meow Apps, includes a specific integration with Ollama. A plugin with an OpenAI-compatible API can work with Ollama if its endpoints and model names match, but simply changing a label is not enough.

The semantic part is less unified. Some plugins connect WordPress to Qdrant, while others leave indexing to an external integration. On a small site, an mu-plugin can generate the embedding, send it to the Qdrant PHP client when saving a post, and defer the work with WP-Cron. For larger volumes, processing requires a work queue and retry control.

The tool comparison and their limits are available in The best AI plugins for WordPress with local Ollama and Qdrant. Before installing one, verify with a real request if it accepts a custom URL, a local model, and the required endpoints. If it only accepts cloud service keys and does not allow modifying the base URL, it will not be able to connect to Ollama.

Limits to Know in Advance

Hardware imposes the first limit. An 8B 4-bit model can fit in an 8 GB GPU, but the context, quantization, and memory reserved by Ollama reduce the available margin. It can also run on a CPU, although latency and the number of responses depend on the processor, RAM, and model. Measure a request with the actual context length before hiring or upgrading hardware.

OLLAMA_NUM_PARALLEL controls how many requests each model processes simultaneously. Increasing this value can raise RAM and VRAM consumption and reduce response speed under load. The concurrency test should use several representative requests, not a single call from the command line.

Hosting determines the third restriction. Shared hosting may prevent the installation of containers or long-running services. localhost always refers to the machine where WordPress is running, so it cannot reach an Ollama instance installed on another server. Options include hosting it on the same machine, linking both services via a private network, or using a VPS that you control. Size the infrastructure based on the model, maximum context, and concurrency the site will need.

Start with Search, Not Generation

Semantic search offers a traceable first test because each result can be linked to an existing post. Qdrant does not write responses: it returns identifiers and metadata that WordPress can relate to the stored content. This separation allows you to verify if the system retrieves the correct article before adding a model that writes text. Use real site queries and define which document should appear for each.

The first trial consists of installing Ollama, downloading nomic-embed-text, creating a collection in Qdrant, and indexing a recent batch of posts. Compare the results with the WordPress search engine and record the position of each expected source. The search passes the test when it consistently retrieves relevant documents. Afterward, you can incorporate an 8B model to generate drafts; if retrieval fails, first correct the indexing, the embedding model, or the collection.

Try it in 3 minutes

Install Ollama + Open WebUI on your computer, free and private.