AppStars

Self-hosted AI: generative features without handing your data to an AI vendor

Why we run speech, OCR and vision models on in-region cloud GPUs instead of calling an AI vendor's API, how the pipeline fits together, and where the costs and effort go.

Most generative AI features follow the same recipe. Your app collects something from a customer, posts it to an AI company's API, and shows what comes back. It is quick to build and it demos well.

It also means every document, recording and video your customers trust you with now passes through someone else's systems. For a lot of products that is fine. For regulated industries, and for any customer who asks "where does our data go?", it is the part of the design that ends the conversation.

This post is about the other way to do it: open-weight models that you run yourself, on infrastructure you choose. We'll cover why it matters, what a real pipeline looks like, and the trade-offs nobody puts on the brochure.

Why self-host at all

There are two reasons, and they are different problems.

Supply-chain risk. When a feature depends on a third-party AI API, that API is part of your product. It can be repriced, rate-limited, restricted in your region, changed underneath you, or switched off. You don't control the model version, and you find out about behaviour changes from your customers. An open-weight model is a file you keep. The version you tested is the version that runs, for as long as you want it to.

Third-party data exposure. Sending customer content to an AI provider adds another party that holds it, even briefly. That party has its own retention rules, its own staff, its own subprocessors and its own incidents. Your customers' security questionnaires will ask about it, and "we trust the vendor" is a weak answer. With self-hosted models, the audio, images and text go to your models and nowhere else.

Neither reason is about the models being better. Often a commercial model is stronger at the margins. The point is that for many business tasks an open-weight model is good enough, and owning it removes a whole category of risk.

A real pipeline: video to step-by-step guide

The clearest example we have is the generative AI we architected and built for Knowby, a work-instructions platform. The feature is simple to describe: film a task, narrate it if you like, and get back an editable step-by-step guide.

Behind that sits a GPU job running entirely open-weight models in a serverless container on NVIDIA L4 GPUs, in the customer's data region. No customer data goes to a third-party AI provider. The stages:

  1. Speech. Whisper transcribes the narration, and steps are cut at sentence boundaries.
  2. Captions. PaddleOCR reads text on screen. A vision-language model then decides whether that text is an instruction or just a label that happened to be filmed on a piece of equipment.
  3. Vision. If there is no narration, scene-change detection finds the steps, and a vision-language model running on llama.cpp writes a one-sentence description of each.
  4. Media. FFmpeg extracts the audio, scores scenes, grabs frames, and cuts the step clips, thumbnails and candidate cover images.

The order matters. The pipeline degrades gracefully: speech first, then captions, then scenes. A silent video still becomes a guide. A guide made from narration is better, but nobody gets an error message because they forgot to talk.

The output is an editable draft guide. A person reviews and edits it before it's published. That's a design choice, not a limitation: the model does the tedious first pass, and a person who knows the task signs off.

You can read the full case study on the Knowby AI platform page.

The trade-offs

Self-hosting is not free, and it is worth being plain about where the effort goes.

Cost has a different shape

With an API you pay per call and someone else owns the hardware. With self-hosted models you pay for GPU time. Serverless GPU containers help a lot here: the job starts when there is work and stops when there isn't, so you aren't paying for an idle card overnight. But you are now responsible for how long each job runs, and a slow pipeline costs real money. Profiling stops being optional.

GPU quotas are a hard limit

Cloud providers ration GPUs. Your quota in a given region is a number you agree with the provider, and it is often smaller than you'd like. When a burst of uploads arrives and the quota is used up, the next job can't start. We handle that with queued retries: the work waits and runs when capacity frees up, instead of failing. We also load-tested the GPU endpoint with k6 so the capacity numbers came from measurements, not hope.

Memory is the real constraint

A single GPU has a fixed amount of video memory, and speech, OCR and vision-language models all want some. You usually can't hold every model at once. The answer is VRAM-aware sequencing: load the speech model, run it, unload it, then load the next one. It is slower than keeping everything resident, but it fits on a card you can actually get, and quantised models (Q4 or Q8) can stretch it further.

Images and deploys

Model weights are large. If your container build bundles gigabytes of weights next to your code, every small code change re-ships them. We tuned the image builds so a code change doesn't drag the models along with it. It sounds like housekeeping, and it is, but it keeps deploys quick.

Quality is your job now

There is no vendor tuning the model for you. You choose the model size, test it against real examples from your own domain, and decide when it is good enough. Sometimes the honest answer is that a task isn't ready yet.

When it makes sense

Self-hosted AI fits best when:

  • your customers are in regulated industries, or simply ask where their data goes
  • the task is well defined, such as transcription, reading text, describing an image or translating
  • the volume is steady enough that GPU time is predictable
  • you want the feature to keep working the same way next year

It fits less well for open-ended chat where you need the strongest general model available today. Even then, there's a middle path: let people use a commercial assistant for general work, and connect it to your systems in a controlled way, while the sensitive processing stays on your own models.

A practical checklist

If you're weighing up a self-hosted AI feature, start here:

  • Write down where the data goes today. Every API call, every vendor, every region. That list is your risk register.
  • Pick one narrow task. Transcription or OCR is a good first step. Prove it on real data before anything bigger.
  • Check your GPU quota early. Ask for it in the region you need before you write code.
  • Plan for memory. List the models you need and their sizes, and decide what loads when.
  • Build the fallback first. Decide what happens when a stage fails or finds nothing.
  • Keep a person in the loop. Generate a draft, not a final answer.
  • Measure cost per job. Time each stage on the GPU and multiply. That number decides whether the feature pays its way.

If you'd like to talk through a feature like this, our self-hosted AI page has more on how we approach it.

Bring us the hard problem.

A 45-minute discovery call with the engineer who'll build it.