All work

Mimir

A private gateway to cloud AI: models only see what my own rules have cleared.

A small program on my own machine that sits between my chat app and the AI models. Everything I send passes through it first, and it decides, by rules I wrote, what is allowed to leave.

A summary for now. The full case study is coming soon.

  • 4 slots model routing tiers
  • 0 keys held by the chat client
  • 100% of requests policy-checked

The problem

I want to use the big cloud AI models without my private data leaving my machine unless my own rules allow it.

Hosted models are useful but extremely leaky. Left alone, a chat app will send private context, unvetted images and unbounded spend to whichever provider it is pointed at. And when something fails, the model guesses: ask about a screenshot that never attached and it may invent an answer anyway.

What it does

  • Every message is classified before anything leaves the machine; private messages are answered locally with no model call.
  • Names and contact details are pseudonymized, swapped for stable aliases, on cloud requests and restored in the reply.
  • A deterministic vision guard: if a message refers to an image that is not attached, it refuses before a model can guess.
  • Multi-model routing across four named slots, from cheapest-and-fastest to slowest-and-deepest.
  • A hard monthly budget with a cost ledger; at the cap, requests stop.
  • Every failure comes back as an explicit error block.

Follow one request

This is the path every message takes before a model sees it. Press Run to watch a request go through it, or pick a step.

  • Request. The chat app talks to the proxy as if it were a model provider. It holds no keys of its own.
  • Classify. A local classifier assigns a privacy tier before anything else happens. Private messages never leave the machine.
  • Mask. On cloud-bound requests, names and contact details are swapped for stable aliases; the mapping stays local.
  • Vision guard. Images are checked deterministically. A reference to a screenshot with nothing attached is refused, not hallucinated.
  • Route. The request is routed to a model slot by difficulty and cost, under a hard monthly budget.
  • Ledger. The call is priced and recorded, aliases are restored, and the reply is stamped with model, tokens and cost.

The approach

Mimir is a daemon, a program that runs quietly in the background, acting as a policy proxy: a middleman that every request passes through. It alone holds the provider keys, the budget and the privacy rules, and my chat app talks to it as if it were a model provider. Decisions that matter are made before a model is called, by deterministic code: plain rules that give the same answer every time. The trade-off is that it is strict on purpose: when a rule or the budget says no, the request ends in an error, even when a model could have answered it.

Built with

Python · LiteLLM · Policy proxy · SQLite ledger · Pseudonymization · Vision guardrails · Self-hosted