Back to the blog

Speeding up the Nextcloud Assistant: what to check first

· By Bee Flow · 5 min read

Four things decide how fast the Assistant answers: a provider for the task, how quickly tasks are picked up, a model that fits the hardware, and a runtime Nextcloud can reach. Nextcloud's own steps, in order.

Task cards waiting on a conveyor belt in front of a small server under a cloud, with an hourglass beside it

When the Nextcloud Assistant takes minutes to answer, or a task stays on "scheduled", the cause is almost always one of four things: no provider is registered for that kind of task, the task is waiting for the background job, the model is too big for the hardware, or Nextcloud cannot reach the model runtime. Nextcloud documents a fix for each. This post walks through them in the order that finds the cause fastest. The facts come from the Nextcloud 35 manuals, the current release as we write this.

How a request travels

It helps to know the path. The Assistant does not call a model itself. It schedules a task through Nextcloud's Task Processing API. A worker picks the task up and hands it to the provider app registered for that task type, and the provider runs the model or calls a service. A slow answer means time was lost at one of those three steps: waiting to be picked up, waiting behind other tasks, or the model itself.

1. Is there a provider for this task?

The Assistant is the front end. Each feature needs a backend app, and the Assistant page of the manual lists which one: text and chat need llm2 or the OpenAI and LocalAI integration, speech-to-text needs stt_whisper2, Context Chat needs its own app and backend plus a text provider. If a feature does nothing at all, check under Administration settings → Artificial Intelligence that a provider is selected for that task type.

The command line shows what happened to a task:

sudo -E -u www-data php occ taskprocessing:task:list
sudo -E -u www-data php occ taskprocessing:task:stats

A task that stays scheduled was never picked up. A task that failed carries an error message, and that message usually names the cause.

2. Are tasks waiting for the background job?

This is the most common reason for "it works, but only after a few minutes". The AI overview explains that AI tasks run through background jobs, and those run every five minutes by default. A question asked just after a run waits almost five minutes before anything starts.

First make sure background jobs run at all. Under Administration settings → Basic settings, the mode should be Cron, and the page shows when the last job ran. The background jobs page describes the set-up.

Then add dedicated workers, so tasks are picked up as soon as they are scheduled. The manual recommends four or more. Since Nextcloud 32.0.7 the command is:

sudo -E -u www-data php occ taskprocessing:worker -v -t 60

Run it in a loop, or as the nextcloud-ai-worker@ systemd unit the manual describes, and enable four instances. Older versions use background-job:worker. With All-in-One you run the same command through docker exec on the host, and the manual gives that line as well.

3. Does the model fit the hardware?

If tasks are picked up at once and answers still crawl, look at the model. The manual's own FAQ, "Why is my prompt slow?", gives two reasons: the work is done on a CPU where a GPU was expected, and many people ask at the same time, since requests are generally handled in the order they arrive.

For llm2, the documented hardware is an NVIDIA GPU with at least 8 GB of VRAM and CUDA 12.4 or later, with 12 GB of system RAM. It also runs on a CPU with AVX and AVX2, and for that the manual recommends 10 to 20 cores. Two notes on that page explain a lot of slow installs: llm2 uses all cores by default, so it is better on a separate machine than next to Nextcloud itself, and it cannot yet be scaled out over several machines.

What you can do inside Nextcloud:

  • Check that the container really sees the GPU. A llm2 that silently falls back to the CPU is the classic case.
  • Pick the smaller of the bundled models for everyday tasks.
  • Move llm2 to its own machine, so it does not compete with PHP and the database.
  • If chats get slower as they grow, lower chat_last_n_messages in the Assistant's configuration, so fewer earlier messages are sent along each time.

4. Can Nextcloud reach the runtime?

With the OpenAI and LocalAI integration pointed at your own Ollama or another runtime, "not answering" is often a connection problem. Three checks:

  • The address. localhost inside a container is that container. When Nextcloud runs in Docker, use the address of the host or the runtime's machine. You enter the base URL without the endpoint path.
  • The model name. The model selected in Nextcloud has to be one the runtime serves. Pull it there first.
  • Tool calling. The Context Agent needs a model that supports it. A model without it answers in prose where an action was expected.

Our post on AI in Nextcloud with a local model goes deeper into these three.

When the hardware is the limit

Sometimes everything is set up correctly and the server simply has no GPU, or not enough of one. Nextcloud's own answer is in the manual: the Assistant can use a provider outside the machine, through the OpenAI and LocalAI integration or the routes on the AI as a Service page.

Bee Flow is another provider you can put behind the Assistant. The Bee Flow app for Nextcloud registers Bee Flow as a Task Processing provider for the text task types. The Assistant stays where it is, and its text tasks run on the model you chose in Bee Flow: an EU-hosted provider such as Mistral, Scaleway or IONOS, or a runtime on a machine that does have a GPU. Image generation, speech and transcription are not registered, so those keep using their Nextcloud apps.

What it asks of you: Bee Flow is a separate Docker stack next to Nextcloud, on amd64. The core needs 4 GB of memory, and the default install with the personal-data filter and classifier about 11 GB. It needs no GPU when the model is hosted. The connector is open source under AGPL and supports Nextcloud 33 to 35.

#nextcloud #ai-models