Tresor
Switch LLM Providers for Any Apps with One Click. β a single Go binary that sits between your applications and LLM providers, intercepting API calls, routing them to different backends, and transforming request/response formats on the fly.
At a Glanceβ
Tresor has two faces in one binary:
| Mode | What It Does |
|---|---|
| Daemon | π₯οΈ Long-running HTTP gateway + admin REST API + embedded web UI |
| CLI | π» Command-line client for managing rules, downstreams, and aliases |
ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ
β Your App βββββ>β Tresor βββββ>β LLM Providerβ
β β β (gateway) β β (OpenAI, β
β β<βββββ β<βββββ Anthropic..)β
ββββββββββββββββ ββββββββββββββββ ββββββββββββββββ
β
βββ Admin REST API
βββ Embedded Web UI
βββ CLI Commands
π€ Why Tresor?β
- One binary: No need to install on every PC/server where LLM apps live in.
- One click: LLM provider switch via alias buttons in web UI.
- Any Apps: All LLM apps using OpenAI/Anthropic API do not need to reconfigure their LLM providers.
For apps that do not support customizable endpoint, a possible workaround is to modify DNS records and point the IP address to Tresor.

π The Problem: Switching Providers at Scaleβ

Imagine you have agents on three machines, all calling OpenAI. You want to switch them to Anthropic. Tresor sits in the middle so you only change one thing.
β DISCLAIMER: Tresor is intended for personal use rather than LLM transfer stations, so it only has one administrative account. We are not planning to support commercial-purpose multi-user login.
β¨ Core Featuresβ
- π Protocol Translation β Convert between OpenAI and Anthropic API formats transparently. Send an OpenAI request, receive it from an Anthropic backend, without changing a line of application code.
- β‘ Auto-Translation β When a downstream declares its API format (e.g.,
api_formats: [anthropic]), Tresor automatically inserts the appropriate format converter into the pipeline, even without an explicit rule. - π€οΈ Per-Path Routing β Route different API paths (and models) to different downstream providers based on configurable rules.
- π·οΈ Model Aliasing β Map one model name to another at the gateway layer. Your app sends
gpt-4o, Tresor forwards asclaude-sonnet-4. Hot-switch between backends without restarting. Supports regex patterns (e.g.,^claude-.*) to match entire families of models. Groups can be reordered via drag-and-drop in the web UI. - π Plugin Pipeline β Chain multiple transformation plugins per rule (header injection, format conversion, image extraction, and more).
- π Aggregated Model List β Tresor exposes
/v1/modelsthat aggregates all known models from downstreams and exact-match aliases (regex aliases excluded), so OpenAI-compatible clients can discover available models. - π Request Logging β Real-time gateway request logs via Server-Sent Events (SSE), displayed newest-first with a text filter for searching. Configurable log verbosity (debug, info, warn, error).
- π Embedded Web UI β Manage everything from a browser-based dashboard served by the daemon itself. Features include a login screen, dark/light theme toggle, visual pipeline editor, request log viewer, and an About panel. No separate frontend needed.
- π Single Config File β All downstreams, rules, aliases, and settings live in one portable YAML file. Changes via API or UI write back automatically.
- πͺΆ Zero External Dependencies β Pure Go SQLite (no CGO), no external web framework, single compiled binary.
π How It Worksβ
When a request hits Tresor:
- π Auth Check β Validate proxy API key if configured
- π Model Extract β Extract the model name from the request body
- π·οΈ Alias Check β Look for an active exact alias matching the model; if not found, try active regex aliases. If found, use its downstream and rewrite the model name
- π― Direct Routing β If no alias, find which downstream can handle this model via
output_model_ids - π Rule Matching β Collect all matching rules for pipeline transforms (rules never override the resolved downstream; multiple rules can match and their pipelines are concatenated)
- β‘ Auto-Translation β If the request format doesn't match the downstream's declared format, automatically insert a format converter
- βοΈ Transform & Forward β Run request through configured transformers, then forward to the resolved downstream
- β©οΈ Transform Response β Run the downstream's response through response transformers before returning to the client
ποΈ Key Design Decisionsβ
- π Single YAML config β all settings in one portable file
- πΎ SQLite (
modernc.org/sqlite) β pure Go, no CGO dependency - π Upsert on startup β YAML data merges into SQLite; DB-only rows preserved
- π« No external web framework β uses
net/httpServeMux directly - π¦ Single binary β daemon and CLI dispatched by subcommand
- π Web UI embedded at compile time β via Go's
embed.FS
Next: π¦ Installation β Get Tresor running on your machine.