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 Chat Completions, Anthropic Messages, or OpenAI Responses 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β
- β‘ Hot-Switch Models β Map one model name to any backend model and switch on the fly. Your app requests
gpt-4o; Tresor can route it to Claude Sonnet, Opus, or keep it on GPT-4o β all without restarting. - π Auto-Translation β Automatically convert between OpenAI, Anthropic, OpenAI Responses, and Google Gemini formats. Your app sends an OpenAI request; Tresor forwards it to an Anthropic, Gemini, or any other downstream and converts the response back β no rule configuration needed.
- π Traffic Inspection (off by default) β Inspect raw incoming requests and downstream LLM responses, by clicking the log entries. Curious about what your LLM Apps are actually sending to LLMs? Then this is for you! Works similar to claude-tap.
- π Embedded Web UI β Manage everything from a browser dashboard. No separate frontend deployment.
- π Plugin Pipeline β Chain transformation plugins per rule (header injection, image fix, format conversion, and more). Fourteen built-in plugins cover all common format combinations.
- π Single Config File β All settings in one portable YAML file. Changes via the web UI write back automatically.
- π Proxy Authentication β Require clients to authenticate via
Authorization: Bearerorx-api-keyheaders (supports Anthropic-format clients like Claude Office plugin). - π Retry on Empty Response β Automatically retry downstream requests that return HTTP 200 but produce no content (e.g., thinking-only responses, empty completions). Up to 3 retries with exponential backoff. Transparent to the client.
- πͺΆ 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 (OpenAI Chat Completions, Anthropic Messages, or OpenAI Responses API) doesn't match the downstream's declared format, automatically insert the appropriate format converter (e.g.,
openai2responses,responses2anthropic) - βοΈ Transform & Forward β Run request through configured transformers, then forward to the resolved downstream
- π Retry on Empty Response β (if enabled) If the downstream returns HTTP 200 but produces no content, retry up to 3 times with exponential backoff. Retries are transparent to the client.
- β©οΈ 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