Developers
Trimml CLI
Route Claude Code and Codex through Trimml's compressor with no code changes. Install, sign in, turn it on.
Overview
The trimml CLI runs a tiny proxy on your own machine. Point Claude Code and Codex at it — one command does this for you — and every request is compressed in flight before it goes to Anthropic or OpenAI. You keep using your tools exactly as before; the savings accrue in the background.
Your provider key never leaves your machine. The proxy forwards your Anthropic/OpenAI request — with your own key — straight to the provider. Only the prompt text to be compressed, plus your dk- key, is sent to Trimml. And compression fails open: if it's ever slow or unreachable, your request is forwarded uncompressed rather than blocked.
Quickstart:
curl -fsSL https://trimml.com/install.sh | bash # install the binary
trimml login # sign in (opens your browser)
trimml on # route Claude Code & Codex
# …use claude / codex exactly as before…
trimml status # see what you've savedPrefer to call the compressor directly instead of routing a tool? See the API reference.
Install
One command. It downloads a single binary for your platform (macOS and Linux; on Windows use WSL), verifies its SHA-256 checksum, and puts it on your PATH — no runtime to install. The source repo can stay private: the installer is served from trimml.com and fetches only public release binaries and checksums.
curl -fsSL https://trimml.com/install.sh | bashBy default the installer uses the latest release pointer. To pin a version or install somewhere else:
TRIMML_VERSION=v0.1.0 curl -fsSL https://trimml.com/install.sh | bash
TRIMML_INSTALL_DIR=/usr/local/bin curl -fsSL https://trimml.com/install.sh | bashUpdate later with trimml update; check your version with trimml --version.
Sign in
trimml login opens your browser, you approve on trimml.com/cli, and a scoped key is minted and stored for you — no copy-paste. The key is account-scoped to compress and usage:read and expires in 90 days by default.
trimml login # opens your browser, mints a scoped key, stores it
trimml login --device # headless / SSH: enter a short code at trimml.com/cli
trimml login --no-expiry # mint a key that never expires (default is 90 days)
trimml login --key dk-… # skip the browser: paste a key from the dashboardThe key is stored under ~/.trimml/ (and read from the TRIMML_API_KEY environment variable if set, which is handy for CI). Sign out any time with trimml logout.
Route your tools
trimml on starts the background proxy and wires Claude Code and Codex to it. Because it routes all of your provider traffic, it shows you exactly what it will add to your shell startup file and asks before writing anything:
# >>> trimml >>>
export ANTHROPIC_BASE_URL="http://127.0.0.1:8788"
export OPENAI_BASE_URL="http://127.0.0.1:8788/openai/v1"
# <<< trimml <<<Open a new shell (or source your rc) and you're routed. Both tools read these standard base-URL variables, so no tool config is needed.
trimml on # starts the proxy, then ASKS before editing your shell rc
trimml off # removes the lines and stops the proxy
trimml run -- claude # one-off: route a single command, no shell changestrimml off reverses it completely — it removes the block and stops the proxy. If you'd rather not touch your shell at all, trimml run -- <command> sets the variables for just that one process.
Track savings
trimml status shows requests routed, tokens saved, a dollar estimate, and how many requests failed open.
trimml status
# lifetime: 312 requests · 1,240,556 tokens saved · ~$3.72 est. · 0 fail-openThe dollar figure is a local estimate — saved tokens valued at the destination model's input list price. Your console and invoice are the billing source of truth (a transparent blended rate). trimml status reads the token totals the active backend has metered for your key.
Tuning & what's compressed
Set how hard the proxy compresses. The change applies to the running proxy immediately and persists for next time.
trimml aggressiveness # show the current level
trimml aggressiveness aggressive # set it — applies to the running proxy at onceCompression is deliberately conservative — the output is always a subsequence of your input (nothing is paraphrased or invented), and the proxy only ever touches large blocks of natural-language prose:
| Command | What it does |
|---|---|
Always preserved | Your latest message, tool definitions and tool_use/tool_result blocks, images, anything marked for prompt caching (cache_control), and content that looks structured — code blocks, JSON, tables. Short blocks (under min_block_tokens) are left alone too. |
Compressed | Large prose in your system prompt (kept one step more conservative) and your older conversation turns — the bulk of a long agentic session, where the redundancy lives. |
Per-run override: trimml run --aggressiveness aggressive -- claude applies a level for that session without changing your saved default.
Configuration
Settings live in ~/.trimml/config.toml and can be read or written with trimml config. The defaults are sensible; you rarely need to touch them.
# ~/.trimml/config.toml
aggressiveness = "balanced" # conservative | balanced | aggressive
proxy_port = 8788
api_base = "https://api.trimml.com"
min_block_tokens = 200 # don't compress blocks smaller than this
fail_open_ms = 800 # forward uncompressed if compression takes longer
compress_cached = false # leave prompt-cache blocks untouched
trimml config get aggressiveness
trimml config set api_base https://api.trimml.comCommand reference
| Command | What it does |
|---|---|
trimml login | Sign in via the browser and store a scoped key. Flags: --device, --no-expiry, --key. |
trimml logout | Remove the stored credential. |
trimml on | Start the proxy and wire your tools (asks before editing your shell rc). --yes skips the prompt. |
trimml off | Unwire your shell and stop the proxy. |
trimml run -- <cmd> | Run one command routed through the proxy, with no shell changes. --aggressiveness overrides the level for that run. |
trimml status | Show tokens and dollars saved from the active backend. |
trimml aggressiveness [level] | Show or set the compression level (conservative, balanced, aggressive). |
trimml config get|set <key> | Read or write a configuration value. |
trimml update | Update to the latest release. |
trimml --version | Print the installed version. |
FAQ
Does Trimml see my Anthropic/OpenAI key? No. It's forwarded from your machine straight to the provider. Only prompt text and your dk- key reach Trimml.
What if compression is down? The proxy fails open: your request goes through uncompressed. It never blocks or breaks a call. Those requests show up in the fail-open count in trimml status.
Will it break prompt caching? No. Blocks marked with cache_control are left untouched by default, and compression is deterministic, so an unchanged prompt compresses identically every time.
How do I uninstall the routing? trimml off removes everything it added to your shell and stops the proxy. To remove the binary, delete it from your PATH (where which trimml points) and the ~/.trimml/ directory.
Questions or large-volume needs? Email support@trimml.com.