Skip to content

Ladbaby/Tresor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

75 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tresor

Switch LLM Providers for Any Apps with One Click

One binary, One click, Any App

Go Version License

🤔 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.

Tresor (Ours) cc-switch LiteLLM
One binary ❌(install on every PC) ❌(tons of dependencies)
One click ❌(retype model name)
Any App ❌(limited apps)

🔄 The Problem: Switching Providers at Scale

Imagine you have agents on three machines, all calling OpenAI. You want to switch them to Anthropic.

⚠ DISCLAIMER: Tresor is intended for personal use rather than LLM transfer stations, so it only have one administrative account. We are not planning to support commercial-purpose multi-user login.

⚡ What Tresor Does

Tresor is a single binary with two modes:

Mode What It Does
Daemon 🖥️ Long-running HTTP gateway + admin REST API + embedded web UI
CLI 💻 Command-line client for managing the daemon
┌──────────────┐     ┌──────────────┐     ┌──────────────┐
│   Your App   │────>│    Tresor    │────>│  LLM Provider│
│              │     │    (gateway) │     │  (OpenAI,    │
│              │<────│              │<────│  Anthropic..) │
└──────────────┘     └──────────────┘     └──────────────┘
                         │
                         ├── Admin REST API
                         ├── Embedded Web UI
                         └── CLI Commands

Key Capabilities

  • 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.
  • 🔄 Protocol Translation — Convert between OpenAI and Anthropic API formats transparently. Your app sends an OpenAI request; Tresor forwards it to Anthropic and converts the response back. No code changes needed.
  • 🔌 Plugin Pipeline — Chain transformation plugins per rule (header injection, compatibility fix, format conversion, and more).
  • 🛤️ Per-Path Routing — Route different API paths (and models) to different providers based on configurable rules.
  • 🌐 Embedded Web UI — Manage everything from a browser dashboard. No separate frontend deployment.
  • 📝 Single Config File — All settings in one portable YAML file. Changes via the web UI write back automatically.

🚀 Getting Started

Warning: the program is heavily vibe-coded, but the author has tried the best to follow software engineering practices to ensure its quality. Use with caution.

Install

Linux / macOS — download the latest release with one command:

curl -fsSL https://raw.githubusercontent.com/Ladbaby/Tresor/main/setup.sh | bash

This installs the binary to ~/.local/bin/tresor and creates a config skeleton at ~/.config/tresor/config.yaml.

Windows — download a release binary manually from GitHub Releases.

Configure

  • Option 1: Configure later via web UI.
  • Option 2: Edit ~/.config/tresor/config.yaml.

Change bind_addr to 0.0.0.0:11510 if you want the server to be publicly available.

Start

# Start the daemon
tresor run --config ~/.config/tresor/config.yaml

# Point your LLM apps to: http://127.0.0.1:11510
# Open the web UI: http://127.0.0.1:11510 in your browser

Run as Systemd Service (Linux)

Run Tresor as a user-level systemd service — no sudo needed, auto-starts on login:

# 1. Create the user service unit
mkdir -p ~/.config/systemd/user
cat > ~/.config/systemd/user/tresor.service << EOF
[Unit]
Description=Tresor LLM Gateway

[Service]
Type=simple
ExecStart=$HOME/.local/bin/tresor run --config $HOME/.config/tresor/config.yaml
WorkingDirectory=$HOME/.config/tresor
Restart=on-failure
RestartSec=5

# Environment (uncomment as needed)
# Environment=HTTP_PROXY=http://proxy.example.com:8080
# Environment=HTTPS_PROXY=http://proxy.example.com:8080

[Install]
WantedBy=default.target
EOF

# 2. Enable and start the service
#    (--user creates a service under your user session)
systemctl --user daemon-reload
systemctl --user enable --now tresor.service

# 3. Check status
systemctl --user status tresor

# View logs
journalctl --user -u tresor -f

Note: If you installed Tresor to a different path, update ExecStart and WorkingDirectory accordingly.

Build from Source

For developers or unsupported platforms (requires Go 1.26+):

go build -o tresor .

See the Installation docs for full instructions.

📚 Documentation

Full documentation is available at ladbaby.github.io/Tresor-docs/:

👤 For Users

💡 Use Cases

🛠️ For Developers

📜 Acknowledgement