Skip to main content

💻 CLI Reference

The Tresor binary serves as both the daemon and a CLI client. CLI commands connect to a running daemon using whatever interface (TCP or Unix socket) is configured in the YAML config file.

All CLI commands accept the --config flag to specify which config file to use for connecting to the daemon:

tresor --config ~/.config/tresor/config.yaml <command>

🖥️ Daemon Commands​

run — Start the Daemon​

Starts the daemon (gateway + admin API + web UI):

# Auto-detect config from current directory or home
tresor run

# Explicit config path
tresor run --config ~/.config/tresor/config.yaml

version — Show Version​

Displays the binary version and build information:

tresor version

Downstream Commands​

downstream list​

List all configured downstreams:

tresor downstream list

Rule Commands​

rule list​

List all routing rules:

tresor rule list

rule create​

Create a new routing rule:

tresor rule create "My Rule" "/v1/chat/completions"

Creates a rule with the given name and matching path. Format filters can be added via flags:

tresor rule create "Chat Rule" "/v1/chat/completions" \
--match-format openai \
--match-downstream-format anthropic \
--match-downstreams anthropic

Pipeline config can be added later via the web UI or admin API.

🔌 Plugin Commands​

Install your own JavaScript traffic transformations or try the examples in Ladbaby/Tresor-plugins. Plugins can modify requests, responses, headers, and SSE events; installing and enabling versions hot-reloads their behavior without restarting the gateway. Future requests use the enabled version while in-flight requests keep their pinned package. Package management commands connect to the running daemon; lint and pack work locally without executing JavaScript.

# Install and enable a published JSON bundle (not a repository ZIP).
tresor plugin install-url "https://github.com/Ladbaby/Tresor-plugins/releases/download/v1.0.2/remove_thinking-2.0.2.json"

# Or install and enable a local source directory.
tresor plugin install ./remove_thinking

tresor plugin list
tresor plugin disable remove_thinking 2.0.2
tresor plugin enable remove_thinking 2.0.2
tresor plugin delete remove_thinking 2.0.2

# Author tools; pack refuses to overwrite an existing output file.
tresor plugin lint ./my-plugin --json --strict
tresor plugin pack ./my-plugin --output ./my-plugin-1.0.0.json

install-url accepts --sha256 <canonical-source-digest> and optional --signature <base64> --public-key <base64>. Use a trusted digest from the plugin release's plugin-digests.txt, not a checksum of the JSON download. Install only trusted code. plugin activate <id> <version> is a compatibility alias for enabling.

Installation enables a version, but you must add its ID to a routing rule's pipeline before it affects requests. There are no per-plugin user settings. See the Plugin System guide for pipeline composition and authoring details.

Alias Commands​

alias list​

List all alias groups with their active option highlighted:

tresor alias list

alias create​

Create a new alias option:

tresor alias create <input-model-id> <downstream-id> <output-model-id>

Example:

tresor alias create gpt-4o anthropic claude-sonnet-4-20250514

Note: The CLI does not have a --regex flag. To create regex aliases (where the input model ID is treated as a regular expression), use the web UI or the admin API directly (POST /api/aliases with is_regex: true in the JSON body).

alias activate​

Activate an alias option, deactivating any currently active sibling in the same group:

tresor alias activate alias-gpt4o-anthropic

alias delete​

Delete an alias option. If deleting the active alias, the next sibling is automatically promoted to active:

tresor alias delete alias-gpt4o-openai