https://github.com/ladbaby/tresor
β‘A single-binary LLM gateway for switching providers with one click. One gateway, One config, One click.
https://github.com/ladbaby/tresor
agent ai-gateway cc-switch claude-code codex deepseek gemini-cli litellm llm opencode
Last synced: 15 days ago
JSON representation
β‘A single-binary LLM gateway for switching providers with one click. One gateway, One config, One click.
- Host: GitHub
- URL: https://github.com/ladbaby/tresor
- Owner: Ladbaby
- Created: 2026-06-06T09:27:22.000Z (19 days ago)
- Default Branch: main
- Last Pushed: 2026-06-07T15:03:38.000Z (18 days ago)
- Last Synced: 2026-06-07T16:03:03.093Z (18 days ago)
- Topics: agent, ai-gateway, cc-switch, claude-code, codex, deepseek, gemini-cli, litellm, llm, opencode
- Language: Go
- Homepage: https://ladbaby.github.io/Tresor-docs/
- Size: 2.69 MB
- Stars: 1
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Tresor
> **Switch LLM Providers for Any Apps with One Click**
**One binary, One click, Any App**

[](https://go.dev/)
[](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](https://github.com/farion1231/cc-switch)|[LiteLLM](https://github.com/BerriAI/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:
```bash
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](https://github.com/Ladbaby/Tresor/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
```bash
# 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:
```bash
# 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+):
```bash
go build -o tresor .
```
See the [Installation](https://ladbaby.github.io/Tresor-docs/docs/user/getting-started/installation) docs for full instructions.
## π Documentation
Full documentation is available at **[ladbaby.github.io/Tresor-docs/](https://ladbaby.github.io/Tresor-docs/)**:
### π€ For Users
- [π Introduction](https://ladbaby.github.io/Tresor-docs/docs/user/intro) β overview and architecture
- [π¦ Installation & Quick Start](https://ladbaby.github.io/Tresor-docs/docs/user/getting-started/installation) β install from release or source, configure, run
- [βοΈ Configuration Basics](https://ladbaby.github.io/Tresor-docs/docs/user/configuration/basics) β YAML config file reference
- [π Downstreams](https://ladbaby.github.io/Tresor-docs/docs/user/configuration/downstreams) β configure LLM provider endpoints
- [π Rules](https://ladbaby.github.io/Tresor-docs/docs/user/configuration/rules) β define routing rules with transform pipelines
- [π·οΈ Model Aliases](https://ladbaby.github.io/Tresor-docs/docs/user/configuration/aliases) β map model names and hot-switch backends
- [π Proxy Modes](https://ladbaby.github.io/Tresor-docs/docs/user/configuration/proxy-modes) β outbound proxy configuration
- [π₯οΈ Web UI Guide](https://ladbaby.github.io/Tresor-docs/docs/user/web-ui) β manage everything from the browser
- [π» CLI Reference](https://ladbaby.github.io/Tresor-docs/docs/user/cli-reference) β all command-line commands
### π‘ Use Cases
- [π Transparent Provider Switching](https://ladbaby.github.io/Tresor-docs/docs/user/use-cases/provider-switching) β route OpenAI-format traffic to Anthropic
- [ποΈ Model Aliasing](https://ladbaby.github.io/Tresor-docs/docs/user/use-cases/model-aliasing) β hot-switch between backends
- [βοΈ A/B Testing Backends](https://ladbaby.github.io/Tresor-docs/docs/user/use-cases/ab-testing) β compare providers side by side
### π οΈ For Developers
- [ποΈ Architecture](https://ladbaby.github.io/Tresor-docs/docs/dev/architecture) β codebase structure, request flow, data layer
- [π Plugin System](https://ladbaby.github.io/Tresor-docs/docs/dev/plugin-system) β building custom transformers
- [π§ͺ Testing](https://ladbaby.github.io/Tresor-docs/docs/dev/testing) β test strategy and coverage
- [π€ Contributing](https://ladbaby.github.io/Tresor-docs/docs/dev/contributing) β how to contribute to Tresor
## π Acknowledgement
- [llama.cpp](https://github.com/ggml-org/llama.cpp): Memory saving LLM inference.
- [Qwen & Unsloth](https://huggingface.co/unsloth/Qwen3.6-27B-MTP-GGUF): High quality local LLM.
- [Google Gemini](https://gemini.google.com/): Icon creation.
- [OpenAI ChatGPT](https://chatgpt.com/): Comparison figures.