返回资讯中心
外部精选
软件工程
#开发者实时流

Trim - local proxy that compresses coding prompts before they reach your LLM

Local context optimization for AI coding tools, with an optional cloud control plane for auth, quotas, billing, and receipts.

Hacker News 最新usetrim2026/11/3 · 今天17 分钟阅读

以下正文同步自 Hacker News 最新,版权归原站所有,已转换为易读排版。

Local context optimization for AI coding tools, with an optional cloud control plane for auth, quotas, billing, and receipts.

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

Website: use-trim.com · Docs: use-trim.com/docs · Security: SECURITY.md

OpenAI-compatible local proxy - one Base URL (http://127.0.0.1:8888/v1) for coding IDEs and CLIs

Fast Mode - AST / heuristic compression on the hot path (trim start)

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

Cloud control plane (optional) - Google / GitHub / GitLab login, credits, Paddle billing, receipts, workspaces

Operator console - apps/admin for plans, billing settings, provider adapters, compliance

Install the CLI

macOS / Linux

curl -fsSL https://use-trim.com/install.sh | sh

Windows (PowerShell)

irm https://use-trim.com/install.ps1 | iex

npm

brew install usetrim/tap/trim

From source (Go)

git clone https://github.com/usetrim/trim.git cd trim/cli && go install ./cmd/trim

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.

Optional flags (Unix installer): TRIM_WITH_TREESITTER=1, TRIM_WITH_ZIG_TREESITTER=1, TRIM_WITH_DEEP=1.

Telemetry from installers is privacy-light and soft-fail. Opt out with DO_NOT_TRACK=1 or TRIM_TELEMETRY_DISABLED=1.

Quick start (end users)

No environment variables required for Trim Cloud (official npm / Homebrew / installers).

trim compress --bootstrap

Expect a green success banner (same polish as trim start) when ready

Sign in and create an API key: trim login

Start the local proxy (one-shot), or enable Always-on: trim start

everyday: preference + best-effort OS logon (no admin on normal Windows)

trim autostart enable

In your IDE, set the OpenAI-compatible Base URL to: http://127.0.0.1:8888/v1

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.

Always-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, trim autostart.

Everyday vs advanced commands: trim help. Always-on details: trim help autostart · trim help daemon.

trim uninstall

keep local data / binary:

trim uninstall --keep-data

Repository layout

Path Role License

cli/ Local proxy, compress, setup, daemon, TUI MIT

server/ Go API (auth, quotas, webhooks, admin) AGPL-3.0

apps/web/ Next.js product site + dashboard MIT

apps/admin/ Operator console MIT

apps/docs/ Docs packaging notes (content lives in web /docs) MIT

extensions/trim-ide/ VS Code / Open VSX extension MIT

supabase/migrations/ Postgres schema and seeds

packaging/ Homebrew / Scoop / winget runbooks

Local development

Prerequisites: Go 1.22+, Node.js 20+, Docker (Postgres + Redis), Git.

Infra

docker compose up -d

API

cd server cp .env.example .env

Fill every required key (cloud and local modes fail closed; no silent defaults)

go run ./cmd/api

Web dashboard (new terminal)

cd apps/web cp .env.example .env.local npm install npm run dev

CLI proxy (new terminal)

cd cli cp .env.example .env # local builds: set TRIM_CLI_HMAC_SECRET (official releases bake it) go run ./cmd/trim start

API default: http://localhost:8080

Web default: http://localhost:3000

Local proxy dashboard: http://localhost:8888/dashboard

Full contributor setup: CONTRIBUTING.md.

trim start # local OpenAI-compatible proxy trim compress path/to/file.go --mode fast trim compress docs.txt --deep --engine v2 trim compress --bootstrap # first-time Deep deps (green success banner) trim config sync # pull cloud preferences trim setup # print IDE / shell wiring trim tui # local stats (+ cloud quota when logged in)

Copy .trimrc.example → .trimrc for compression modes (mild | balanced | aggressive | custom).

DNS - point apex/www, api, and admin at your hosts (Cloudflare DNS is fine on the Free plan).

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.

Redis - set REDIS_URL (rediss://… for Upstash).

Env - copy and fill:

server/.env.example → API

apps/web/.env.example → web

apps/admin/.env.example → admin

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.

Deploy - API from server/; web from apps/web; admin from apps/admin.

Smoke test - OAuth login → API key → trim start → checkout / upgrade → receipt.

Admin console details: apps/admin/README.md.

Release / taps / signing: packaging/README.md.

Situation Behavior

Free or expired New checkout for a paid plan

Active paid → higher plan Upgrade with Paddle proration (mode from billing_settings)

Active paid → lower plan Blocked while the period is unexpired (no self-serve downgrade)

Monthly → annual (same plan) Treated as upgrade when enabled in settings

Annual → monthly (same plan) Blocked while unexpired

Top-up packs Always a new checkout (tier unchanged)

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

Topics include IDE setup (Cursor, Continue, VS Code, Claude Code, and others), metering, security (device binding, fraud layers), CLI reference, and dashboard / admin guides.

Report vulnerabilities privately - see SECURITY.md

Never put the Supabase service role key in browser env

Lock CORS_ORIGINS / admin origins to real hosts

Rotate JWT_SECRET and Paddle secrets if leaked

Contributing

See CONTRIBUTING.md and GOVERNANCE.md.

Please 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).

If you modify and host the backend as a network service, AGPL-3.0 source disclosure obligations apply.

正文由 探How 从来源站点 RSS 同步,内容未经改写;遇到排版缺失或需要图片、视频时请以原文为准。

打开原文
去社区讨论 →