gitwtfhub

wtf is millwright?

northwood-systems/millwright — explained in plain English

Analysis updated 2026-05-18

23RustAudience · developerComplexity · 4/5LicenseSetup · moderate

TL;DR

Millwright is a self-hosted router that sits between your AI apps and model providers, picking the cheapest healthy model for each request while protecting prompt-cache savings.

Mindmap

mindmap
  root((millwright))
    What it does
      Routes LLM requests
      Cheap mid frontier roles
      Cost based selection
      Cache aware sessions
    Tech stack
      Rust
      Docker
      SQLite
      PostgreSQL
    Use cases
      Spend control
      Cache preservation
      Cost reporting
      Provider swapping
    Audience
      AI agent builders
      DevOps teams
      Self hosters

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Why would anyone build with this?

REASON 1

Route AI coding assistant traffic (like Claude Code) across cheap, mid, and frontier model tiers to control spend.

REASON 2

Keep a session pinned to one provider and model so prompt-cache discounts are not lost mid-conversation.

REASON 3

Track and report LLM spend per team with a built-in CLI and cost analyzer.

REASON 4

Swap model providers behind one endpoint without changing application code.

What's in the stack?

RustDockerSQLitePostgreSQL

How it stacks up

northwood-systems/millwrightadindazu/tangoaudiobigmacfive/turbo-graph
Stars232323
LanguageRustRustRust
Setup difficultymoderatemoderatemoderate
Complexity4/53/54/5
Audiencedeveloperdeveloperdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you spin it up?

Difficulty · moderate Time to first run · 30min

Requires building the Rust binary or Docker, plus your own model provider API keys.

Permissive Apache-2.0 license, use, modify, and deploy freely including commercially, as long as you keep attribution.

Wtf does this do

Millwright is a self-hosted router that sits between your AI applications and the model providers you choose. It accepts requests written in the OpenAI Chat Completions format or the Anthropic Messages format, then forwards each one to an OpenAI-compatible API, Anthropic directly, or Amazon Bedrock, depending on your rules. Instead of every request going to the priciest model, you group models into three roles: cheap, mid, and frontier. Millwright picks the lowest-cost healthy option that your policy allows for that role, based on the type of task or risk level of the request. High-risk or planning-heavy requests are always sent to the frontier role, while routine work can use cheaper models. A notable feature is cache-aware routing. Many AI providers offer discounted pricing when a session keeps reusing the same warm prompt cache, but switching models mid-session can break that savings. Millwright keeps a session pinned to the same confirmed provider and model within each role, so cheap, mid, and frontier work can all run at once without stepping on each other's cache. Every routing decision is logged with the model chosen, the provider, the reason, and any alternatives that were rejected, so you can see exactly where your money is going. A command-line tool shows total spend, cost breakdowns by team, and live activity, and there is a built-in analyzer that can turn usage logs into an HTML or Markdown cost report. Millwright ships as a single Rust binary with Docker support, and your provider API keys stay on your own infrastructure rather than passing through a third-party service. It is built for developers and teams running AI agent tools like Claude Code or similar coding assistants who want to control spend without changing their application code. Setup involves an interactive command that walks through provider endpoints, model roles, and pricing, followed by starting the server.

Yoink these prompts

Prompt 1
Walk me through setting up Millwright with cheap, mid, and frontier model roles for my OpenAI and Anthropic API keys.
Prompt 2
How do I configure Millwright so my Claude Code sessions keep prompt-cache affinity across requests?
Prompt 3
Explain how to run `millwright analyze` on my usage logs to generate a cost report.
Prompt 4
Show me the Docker Compose setup for running Millwright locally with a mock provider for testing.

Frequently asked questions

wtf is millwright?

Millwright is a self-hosted router that sits between your AI apps and model providers, picking the cheapest healthy model for each request while protecting prompt-cache savings.

What language is millwright written in?

Mainly Rust. The stack also includes Rust, Docker, SQLite.

What license does millwright use?

Permissive Apache-2.0 license, use, modify, and deploy freely including commercially, as long as you keep attribution.

How hard is millwright to set up?

Setup difficulty is rated moderate, with roughly 30min to a first successful run.

Who is millwright for?

Mainly developer.

View the repo → Decode another repo

This repo across BitVibe Labs

Don't trust strangers blindly. Verify against the repo.