{"slug": "trim-local-proxy-that-compresses-coding-prompts-before-they-reach-your-llm", "title": "Trim - local proxy that compresses coding prompts before they reach your LLM", "summary": "Trim launched as an OpenAI-compatible local proxy at http://127.0.0.1:8888/v1 that compresses coding prompts before they reach upstream LLM providers, aimed at clients including Cursor, Continue, VS Code Chat and Claude Code. The tool offers Fast Mode, AST/heuristic compression on the hot path via `trim start`, and Deep Mode, which runs Microsoft's LLMLingua on-device only and compresses each last-user prose island in place while freezing tools and paths. An optional cloud control plane adds Google, GitHub and GitLab login, credits, Paddle billing, receipts and workspaces, and the CLI is distributed via install scripts, npm (@usetrim/trim) and Homebrew under an MIT license.", "body_md": "Local context optimization for AI coding tools, with an optional cloud control plane for auth, quotas, billing, and receipts.\n\nPoint Cursor, Continue, VS Code Chat, Claude Code, and similar clients at a local OpenAI-compatible proxy. Trim reduces prompt size before requests reach your upstream provider. Deep Mode runs on your machine only - never in Trim cloud.\n\n**Website:** [use-trim.com](https://use-trim.com) · **Docs:** [use-trim.com/docs](https://use-trim.com/docs) · **Security:** [SECURITY.md](https://github.com/usetrim/trim/blob/main/SECURITY.md)\n\n- **OpenAI-compatible local proxy** - one Base URL (`http://127.0.0.1:8888/v1` ) for coding IDEs and CLIs\n- **Fast Mode** - AST / heuristic compression on the hot path (`trim start` )\n- **Deep Mode** - Segmented Allowlist Deep on the live proxy when Preferences Deep is on (freeze tools/paths; compress each last-user prose island in place, order preserved); LLMLingua stays on-device\n- **Cloud control plane** (optional) - Google / GitHub / GitLab login, credits, Paddle billing, receipts, workspaces\n- **Operator console** -`apps/admin` for plans, billing settings, provider adapters, compliance\n\n**macOS / Linux**\n\n```\ncurl -fsSL https://use-trim.com/install.sh | sh\n```\n\n**Windows (PowerShell)**\n\n```\nirm https://use-trim.com/install.ps1 | iex\n```\n\n**npm**\n\n```\nnpm install -g @usetrim/trim\n```\n\n**Homebrew**\n\n```\nbrew install usetrim/tap/trim\n```\n\n**From source (Go)**\n\n```\ngit clone https://github.com/usetrim/trim.git\ncd trim/cli && go install ./cmd/trim\n```\n\n`go install github.com/usetrim/trim/cli/cmd/trim@v…` is not supported while `cli/go.mod` contains a local `replace` for the server module. Use a clone, Release binaries, npm, or Homebrew instead.\n\nOptional flags (Unix installer): `TRIM_WITH_TREESITTER=1`, `TRIM_WITH_ZIG_TREESITTER=1`, `TRIM_WITH_DEEP=1`.\n\nTelemetry from installers is privacy-light and soft-fail. Opt out with `DO_NOT_TRACK=1` or `TRIM_TELEMETRY_DISABLED=1`.\n\n## Package-manager ops (tokens, taps): [packaging/README.md](https://github.com/usetrim/trim/blob/main/packaging/README.md).\n\nNo environment variables required for Trim Cloud (official npm / Homebrew / installers).\n\n1. Install the CLI (above).\n2. One-time Deep deps on this PC (local Microsoft LLMLingua - not Trim cloud; package managers never pip-install it):\n\n```\ntrim compress --bootstrap\n# Expect a green success banner (same polish as trim start) when ready\n```\n\n3. Sign in and create an API key:\n\n```\ntrim login\n```\n\n4. Start the local proxy (one-shot), or enable Always-on:\n\n```\ntrim start\n# everyday: preference + best-effort OS logon (no admin on normal Windows)\ntrim autostart enable\n```\n\n5. In your IDE, set the OpenAI-compatible Base URL to:\n\n```\nhttp://127.0.0.1:8888/v1\n```\n\n6. Optional: install **Trim IDE** (publisher`usetrim` ) from the VS Code Marketplace or Open VSX for Always-on proxy + dashboard metrics. See[extensions/trim-ide/README.md](https://github.com/usetrim/trim/blob/main/extensions/trim-ide/README.md) .\n\nAlways-on: leave **Start Trim with your IDE** checked in the dashboard (or `trim autostart enable`). OS logon uses launchd / systemd user / Windows Startup Run → `%LOCALAPPDATA%\\Trim\\bin` - preference stays on even if OS registration is blocked; then use `trim start` or the IDE extension. Docs: [Always-on](https://use-trim.com/docs/concepts/always-on), [`trim autostart`](https://use-trim.com/docs/cli/autostart).\n\nEveryday vs advanced commands: `trim help`. Always-on details: `trim help autostart` · `trim help daemon`.\n\nUninstall:\n\n```\ntrim uninstall\n# keep local data / binary:\ntrim uninstall --keep-data\n```\n\n| Path | Role | License | \n|---|---|---|\n| `cli/` | Local proxy, compress, setup, daemon, TUI | MIT | \n| `server/` | Go API (auth, quotas, webhooks, admin) | AGPL-3.0 | \n| `apps/web/` | Next.js product site + dashboard | MIT | \n| `apps/admin/` | Operator console | MIT | \n| `apps/docs/` | Docs packaging notes (content lives in web `/docs` ) | MIT | \n| `extensions/trim-ide/` | VS Code / Open VSX extension | MIT | \n| `supabase/migrations/` | Postgres schema and seeds | - | \n| `packaging/` | Homebrew / Scoop / winget runbooks | - | \n\nPrerequisites: **Go 1.22+**, **Node.js 20+**, **Docker** (Postgres + Redis), **Git**.\n\n```\n# Infra\ndocker compose up -d\n\n# API\ncd server\ncp .env.example .env\n# Fill every required key (cloud and local modes fail closed; no silent defaults)\ngo run ./cmd/api\n\n# Web dashboard (new terminal)\ncd apps/web\ncp .env.example .env.local\nnpm install\nnpm run dev\n\n# CLI proxy (new terminal)\ncd cli\ncp .env.example .env   # local builds: set TRIM_CLI_HMAC_SECRET (official releases bake it)\ngo run ./cmd/trim start\n```\n\n- API default: `http://localhost:8080`\n- Web default: `http://localhost:3000`\n- Local proxy dashboard: `http://localhost:8888/dashboard`\n\nFull contributor setup: [CONTRIBUTING.md](https://github.com/usetrim/trim/blob/main/CONTRIBUTING.md).\n\n```\ntrim start                          # local OpenAI-compatible proxy\ntrim compress path/to/file.go --mode fast\ntrim compress docs.txt --deep --engine v2\ntrim compress --bootstrap           # first-time Deep deps (green success banner)\ntrim config sync                    # pull cloud preferences\ntrim setup                          # print IDE / shell wiring\ntrim tui                            # local stats (+ cloud quota when logged in)\n```\n\nCopy `.trimrc.example` → `.trimrc` for compression modes (`mild` | `balanced` | `aggressive` | `custom`).\n\nTrim’s hosted product uses:\n\n| Piece | Typical host | Hostname | \n|---|---|---|\n| Web | Vercel / Cloudflare Pages | `use-trim.com` ,`www.use-trim.com` | \n| API | Render (Docker: `server/Dockerfile` ) | `api.use-trim.com` | \n| Admin | Vercel (second project) | `admin.use-trim.com` | \n| Database + Auth | Supabase | - | \n| Redis | Upstash | - | \n| Billing | Paddle Billing (MoR) | webhook → `/webhooks/paddle` | \n\n1. **DNS** - point apex/www,`api` , and`admin` at your hosts (Cloudflare DNS is fine on the Free plan).\n2. **Supabase** - apply SQL in`supabase/migrations/`**in filename order** . Enable Google, GitHub, and GitLab Auth; set redirect URLs for web, admin, and localhost. Set API`JWT_SECRET` to the Supabase JWT secret.\n3. **Redis** - set`REDIS_URL` (`rediss://…` for Upstash).\n4. **Env** - copy and fill:\n  - `server/.env.example` → API\n  - `apps/web/.env.example` → web\n  - `apps/admin/.env.example` → admin\n5. **Paddle** - configure plans and sync from**Admin → Plans** (preferred). Webhook:`https://api.use-trim.com/webhooks/paddle` . Prices live in the database (`plan_catalog` +`billing_settings` ), not in`.env` .\n6. **Deploy** - API from`server/` ; web from`apps/web` ; admin from`apps/admin` .\n7. **Smoke test** - OAuth login → API key →`trim start` → checkout / upgrade → receipt.\n\nAdmin console details: [apps/admin/README.md](https://github.com/usetrim/trim/blob/main/apps/admin/README.md).\n\nRelease / taps / signing: [packaging/README.md](https://github.com/usetrim/trim/blob/main/packaging/README.md).\n\n| Situation | Behavior | \n|---|---|\n| Free or expired | New checkout for a paid plan | \n| Active paid → higher plan | Upgrade with Paddle proration (mode from `billing_settings` ) | \n| Active paid → lower plan | Blocked while the period is unexpired (no self-serve downgrade) | \n| Monthly → annual (same plan) | Treated as upgrade when enabled in settings | \n| Annual → monthly (same plan) | Blocked while unexpired | \n| Top-up packs | Always a new checkout (tier unchanged) | \n\nPlan order is `plan_catalog.plan_rank`. Optional **Unlimited metering** is a per-plan operator dial (`plan_catalog.unlimited`, default off) - not a client-side flag.\n\nProduct docs ship with the web app:\n\n- Hosted: [use-trim.com/docs](https://use-trim.com/docs)\n- Source: `apps/web/src/lib/docs/`\n\nTopics include IDE setup (Cursor, Continue, VS Code, Claude Code, and others), metering, security (device binding, fraud layers), CLI reference, and dashboard / admin guides.\n\n- Report vulnerabilities privately - see [SECURITY.md](https://github.com/usetrim/trim/blob/main/SECURITY.md)\n- Never put the Supabase **service role** key in browser env\n- Lock `CORS_ORIGINS` / admin origins to real hosts\n- Rotate `JWT_SECRET` and Paddle secrets if leaked\n\nSee [CONTRIBUTING.md](https://github.com/usetrim/trim/blob/main/CONTRIBUTING.md) and [GOVERNANCE.md](https://github.com/usetrim/trim/blob/main/GOVERNANCE.md).\n\nPlease open a pull request against `main`. Keep UI copy and public strings backend-driven where the product already expects `site_messages` / API chrome (no hardcoded marketing or error invention in clients).\n\n**Dual license** - see [LICENSE](https://github.com/usetrim/trim/blob/main/LICENSE):\n\n| Components | License | \n|---|---|\n| `cli/` ,`apps/web/` ,`apps/docs/` ,`extensions/` | MIT | \n| `server/` (hosted control plane) | [AGPL-3.0](https://github.com/usetrim/trim/blob/main/LICENSES/AGPL-3.0.txt) | \n\nIf you modify and host the backend as a network service, AGPL-3.0 source disclosure obligations apply.", "url": "https://wpnews.pro/news/trim-local-proxy-that-compresses-coding-prompts-before-they-reach-your-llm", "canonical_source": "https://github.com/usetrim/trim", "published_at": "2026-11-03 10:38:11+00:00", "updated_at": "2026-11-03 10:51:40.992062+00:00", "lang": "en", "topics": ["ai-tools", "developer-tools", "large-language-models", "ai-products"], "entities": ["Trim", "Cursor", "Continue", "VS Code Chat", "Claude Code", "Microsoft", "LLMLingua", "Paddle"], "also_reported_by": [], "alternates": {"html": "https://wpnews.pro/news/trim-local-proxy-that-compresses-coding-prompts-before-they-reach-your-llm", "markdown": "https://wpnews.pro/news/trim-local-proxy-that-compresses-coding-prompts-before-they-reach-your-llm.md", "text": "https://wpnews.pro/news/trim-local-proxy-that-compresses-coding-prompts-before-they-reach-your-llm.txt", "jsonld": "https://wpnews.pro/news/trim-local-proxy-that-compresses-coding-prompts-before-they-reach-your-llm.jsonld"}}