ai

Building a Self-Hosted AI Chatbot with Tox, n8n and Ollama

A hands-on experiment in CPU-only local AI, decentralized messaging and workflow automation, including an unexpected hosting network warning and controlled shutdown.

Editorial illustration of a CPU-only AI chatbot, local inference, workflow automation and network challenges

Can a self-hosted AI chatbot operate on an inexpensive virtual server without a dedicated GPU or paid AI APIs? On December 3–4, 2026, I tested a prototype combining decentralized messaging, workflow automation and local language-model inference. The chatbot worked, but an unexpected hosting network warning exposed the difference between functional testing and operational readiness.

1. Infrastructure

Component Configuration
Operating system CentOS Stream 9
CPU 4 AMD EPYC-Milan vCPUs
Memory 16 GB advertised, approximately 15 GiB reported
Swap 4 GiB
Hypervisor KVM / QEMU
GPU None
Automation n8n 2.49.9
Database PostgreSQL 17
AI runtime Ollama 0.40.19
Model Qwen 3.5 4B

Anonymized CPU and memory configuration

The model ran on CPU resources, without a paid external AI inference API.

2. Architecture

The messaging transport was separated from the AI request pipeline.

Tox client <-> Python bridge
                   |
           Authenticated n8n webhook
                   |
           Message validation
                   |
           Ollama / Qwen
                   |
           Reply formatting
                   |
           Python bridge -> Tox client

PostgreSQL supported the n8n infrastructure; the prototype did not implement persistent conversation memory.

The four-node automation workflow

3. Model configuration

The installed Qwen model reported 4.2 billion parameters, Q4_K_M quantization and a storage footprint of approximately 3.3 GB. The experimental workflow configured a 4096-token context, two CPU threads, a maximum generation of 256 tokens, temperature 0.3 and disabled thinking. The advertised maximum model context was not tested on this VPS.

Local model configuration

4. Application safeguards

The Python bridge restricted messages to an authorized contact, validated incoming text, limited accepted requests to three per minute and used a bounded queue. The n8n webhook used authentication, and saved execution data was disabled. The implementation included request timeouts and an unprivileged container user. These measures are not a comprehensive security audit.

5. Functional testing

On December 3, the prototype exchanged messages in English and Ukrainian. The visible timestamps show two observed message-to-response intervals of 36 and 3 seconds. These are individual observations, not a controlled throughput benchmark. A rate-limit notification appeared alongside a subsequent reply, so concurrent request handling requires further validation.

Anonymized chatbot conversation

6. Unexpected network warning

On December 4, the hosting provider reported the following observations over ten minutes:

Reported metric Value
Different addresses exchanging traffic 397
Outbound UDP attempts to destination port 33445 253
Different UDP destination addresses 160
Attempts without a response 93%

The provider classified this behavior as P2P and scan-like traffic. No server restriction had been applied when the warning was issued. The classification does not prove intentional port scanning, and the evidence does not conclusively attribute every observed flow to Tox.

I investigated container processes, network namespaces, sockets and application logs. Rather than continuing on infrastructure where the behavior raised acceptable-use concerns, I discontinued the messaging component.

7. Controlled shutdown

After the experiment, the Tox bridge was absent from the Docker container list. n8n and its task runners remained running, PostgreSQL reported healthy, and Ollama and the model remained installed.

Anonymized container state after shutdown

The modular design allowed the remaining infrastructure to continue operating independently of the messaging transport.

8. Public source and validation

A sanitized source derivative is available in the public GitHub repository. It includes Python source, an inactive n8n workflow, Docker configuration, offline tests, CI and GPL-3.0-only licensing for the original source.

The first GitHub Actions offline test run completed successfully. The published derivative has not been live-tested, built as a Docker image or validated against the native library ABI. The original prototype and the published derivative should not be confused.

9. Engineering lessons and next steps

A functioning chatbot does not establish production readiness. Hosting policies, network observability, dependency management and controlled shutdown must be part of the design. Future work will focus on infrastructure monitoring, alert deduplication, incident state and recovery notifications. These are proposed extensions, not implemented chatbot capabilities.

The experiment demonstrates practical local AI integration and the value of investigating operational constraints before production deployment. Live Tox testing remains suspended.

Related: Self-hosted n8n and Linux VPS migration.

Portrait of Vitalii Balint

ABOUT THE AUTHOR

Vitalii Balint

Exploring practical AI-assisted security operations, Wazuh/SIEM labs, and infrastructure automation, grounded in Linux and Windows systems experience.