Skip to main content

Company in a Box, Part 10 of 11: A private AI assistant on local models

A series on building a company's IT with containers and open source

Every company is being asked "what's our AI strategy?" right now. For most small companies, the honest answer is: "a per-seat subscription to a public chatbot, and hoping nobody pastes the customer list into it."

Inner Bits has a different answer. An assistant that runs on the company's own hardware, signs in with the company's own identity, logs who used what, and can look things up in the company's own systems. Built entirely from free software and open-weight models.

Three layers

people  ──> Open WebUI (chat, Keycloak sign-in)
editors ──> VS Code + Continue
               │
               ▼
          LiteLLM (gateway: keys, budgets, logs, routing)
               │
               ▼
          Ollama on the Windows host (GPU), localhost only

Ollama: the models

Ollama runs natively on Windows rather than in a container, so it can use the GPU directly. It serves llama3.1, qwen2.5-coder, mistral, nomic-embed-text for embeddings, and a tiny coder model for autocomplete.

A note for my fellow FSF members before you write in: Ollama is free software, but most of these models are open-weight, not free software. Their licences come with conditions, and you can't rebuild them from source. They're still the most free option available for running AI on your own hardware, and I'll take "runs on my machine, under my control" over "runs on someone else's, under their terms" every day.

Ollama listens on localhost only. Post 9 explains why: for a while it was cheerfully answering anyone on the tailnet with no authentication, and the network scanner caught it. Containers still reach it through Docker's host gateway.

LiteLLM: one gateway to rule them all

LiteLLM is an OpenAI-compatible gateway in front of the models. Nothing talks to Ollama directly any more, Open WebUI included. Everything goes through LiteLLM, which gives an IT department what it actually wants from AI:

  • Virtual keys per client (Open WebUI, VS Code, the knowledge graph), each limited to certain models, with optional budgets;
  • A log of every request, stored in PostgreSQL and visible in Grafana and Superset;
  • One place to add a model, local or (later, if ever) a cloud provider;
  • Prometheus metrics for requests, failures and rate limits.

Its admin UI signs in through Keycloak. The master key is the break-glass.

Open WebUI: the chat for everyone

Open WebUI is the chat. It signs in through Keycloak, lab-admins get its admin role automatically, and it sees models only through LiteLLM. It also sends traces and metrics, so it shows up in the same monitoring as everything else. If the AI is slow, I find out the same way I find out anything is slow.

For developers, Continue in VS Code uses the same LiteLLM models for chat and edits, with its own virtual key, plus a small model straight from Ollama for autocomplete, where speed matters more than wisdom.

Apps as tools: MCP

A chatbot that can only chat is a party trick. What makes it useful at work is when it can look things up. The Model Context Protocol (MCP) lets the assistant call tools, and several of the lab's apps now have MCP servers registered in Open WebUI:

Tool server What the assistant can do
Grafana Read dashboards and alerts; run Prometheus and Loki queries
SonarQube Read code-quality findings
n8n Run workflows marked for MCP
Cognee Remember and recall company knowledge

So "why was Keycloak slow last night?" turns into a Loki query and a Prometheus query, answered from real data instead of vibes.

Every tool server uses read-only or narrowly scoped credentials (Grafana's is a Viewer service account), and the tools are admin-only by default. An AI with write access to production is a decision I want to make on purpose, not discover in a log.

Two practical notes: tool calling needs a model that was trained for it (llama3.1 and qwen behave, others mostly hallucinate tools that don't exist), and GitLab isn't connected yet, because its MCP server needs an OAuth dance that Open WebUI's server-side calls can't do.

Cognee: a company memory

The newest member is Cognee, which turns text and documents into a knowledge graph plus vector embeddings, all computed locally through LiteLLM. Through MCP, the assistant can remember, recall and forget. Like a colleague who actually reads the wiki.

The honest trade-offs: each remember runs entity extraction on the local GPU and takes a minute or two per paragraph, and Cognee is rate-limited so the chat doesn't starve. Change the embedding model, and the vector size changes, so everything has to be fed in again. It's the least mature corner of the lab, and the most fun to watch.

I also looked at another "context lake" product for this job, and dropped it when the project got archived. With younger open-source projects, check for a pulse before you commit.

Why bother, when a subscription is easier?

For a company, a private assistant answers the awkward questions a public one raises:

  • Where does the data go? Nowhere. Prompts and documents stay on company hardware.
  • Who used it, for what, and how much? Every request is logged per key and per user.
  • Who can use it? Whoever is in the right Keycloak group, and nobody once they leave.
  • What can it reach? Exactly the tools IT registered, with the scopes IT chose.

What you give up is model quality. Local 7–8B models are good at summarising, drafting, code help and tool calls. They're not frontier models, and they won't pretend to be. LiteLLM turns that into a routing decision rather than a rebuild: a cloud model could sit behind the same gateway, with the same keys and the same logging, for the jobs that need it. Following my own rule, that's a paid option I'll only reach for when there's genuinely no alternative.

Next, the finale: what all of this costs, what the same company would pay in SaaS or on Hetzner, Azure and AWS, and what I'd tell myself on day one.

Read next: Company in a Box, Part 11 of 11: What it costs vs. SaaS and the cloud

Comments

Popular posts from this blog

Company in a Box, Part 1 of 11: Why I'm building a company's IT with containers and open source

A series on building a company's IT with containers and open source Hi. I'm an IT admin. I've been doing this long enough to have strong opinions about Group Policy and long enough to have strong feelings about printers. For most of my career, my home lab looked exactly like my day job: a Hyper-V host and a handful of VMs. Each one had its own OS to patch, its own disk to grow, its own backup job, and its own creative way of breaking at 2 a.m. It worked. It also stopped teaching me anything. These days every vendor README starts with docker compose up , and I was still out here lovingly hand-crafting a VM for each one, like a medieval monk illuminating manuscripts. So I moved the lab to containers. Then things got slightly out of hand. A confession about who I am Let's get this out of the way, because it explains every decision in this series. I'm a Microsoft guy. Windows Server, Active Directory, Exchange, Hyper-V: that's my day job, and I'm good at...

Company in a Box, Part 11 of 11: What it costs vs. SaaS and the cloud

A series on building a company's IT with containers and open source Ten posts in, it's time for the question everyone skips to: is this worth it? Inner Bits runs a small company's IT on one desktop. What does that cost? What would the same company pay to rent it all as SaaS? And what if you ran the exact same stack on a rented server at Hetzner, OVH, Azure or AWS instead of under your desk? Get comfortable, there are tables. Three of them. What the lab costs to run All prices are what I pay in Portugal. Item Cost Hardware a ~€1,500 desktop (32 GB RAM, a GPU for the AI models); over five years, ~€25 a month Electricity ~€15–30 a month Domain name ~€1 a month (about €12 a year) Cloudflare ~€5 a month (Workers Paid; Tunnel, Email Routing and DNS are free) Stalwart Enterprise licence paid (see the ledger below) Tailscale free personal plan Software €0 for everything else. Every app is free software or a free community edition Total ro...

Company in a Box, Part 9 of 11: Patched images and vulnerability scanning

A series on building a company's IT with containers and open source Running a company's IT means running its security too. A home lab is an easy place to skip that. "It's just at home." "It's behind the VPN." Famous last words, usually followed by a very educational weekend. Inner Bits has a public website, inbound mail and a tunnel from the internet. It's meant to show what a small company could run. So it gets the treatment I'd expect at work: hardened containers, patched images, and scanning that happens whether I remember it or not. The baseline: same rules for everyone Every service in the Compose file merges a shared hardening block: no-new-privileges , so a process can't climb its way up through setuid binaries; a PID limit , so a fork bomb only blows up its own container; a memory limit of about twice normal use. On top of that: healthchecks on the databases and key services, databases never recreated unattended, and se...