Spend less on Claude — with receipts.

One line in Claude Code settings. That's it.

Prefex is a local-first proxy for Claude Code and the Anthropic API — smart routing, prompt-cache assist, cross-session memory, and spend guardrails. It shows the honest savings it adds (beyond the native caching you already get free), request by request. Your prompts and keys never leave your machine.

$ curl -fsSL https://prefex.vercel.app/install.sh -o install.sh
$ less install.sh review
$ bash install.sh
$ prefex preview preview changes

macOS, Linux & Windows · ~20MB binary · zero dependencies
Customize: PREFEX_BIND=0.0.0.0 PREFEX_PORT=9019 bash install.sh

0 code changes
100% local & private
<20MB single binary

See exactly what it's doing

A local dashboard at localhost:8019 — honest savings, every request, full control. No account, localhost-only, no auth.

Prefex dashboard Home tab — honest savings headline and per-layer optimization cards
Home — the honest savings headline (what Prefex actually added beyond the native prompt caching you already get free), with a labeled counterfactual, plus every optimization layer — router, prompt-cache assist, memory, guardrails — at a glance.
Prefex dashboard Activity tab — full request log with model, cache %, cost, saved, and latency
Activity — every request, with model, cache hit %, cost, saved, and latency. Filter and search your own traffic.
Prefex dashboard Settings tab — one-click connect for Claude Code, Cursor, and OpenClaw
Connect — one-click setup for Claude Code, Cursor, OpenClaw, and Continue. API keys stored locally, never sent to Prefex.
Prefex dashboard Coach tab — actionable optimization suggestions from your own traffic
Coach — actionable suggestions computed from your own traffic: prompt consolidation, expiring cache, context cleanup.

// dashboard shown with sample data · localhost-only · your data never leaves your machine

Install

One command. Then change one setting in your existing API client.

1.
Download and review the install script
Downloads the macOS binary, starts Prefex, and connects Claude Code automatically. Run prefex preview first to see exactly what would change.
$ curl -fsSL https://prefex.vercel.app/install.sh -o install.sh && less install.sh
$ bash install.sh
Custom bind/port: PREFEX_BIND=0.0.0.0 PREFEX_PORT=9019 bash install.sh
2.
Open the dashboard
Prefex is running on :8019. The installer connects Claude Code for you — restart Claude Code to activate.
$ open http://localhost:8019/dashboard

~20MB standalone binary. Zero dependencies. 12 features across three tiers: smart routing + prompt caching + compression (cost) · session memory + context guard + checkpointing (context) · loop guard + token trap + think cap + lean reasoning (guardrails).

1.
Download and review the install script
Downloads the Linux binary, starts Prefex, and connects Claude Code automatically. Run prefex preview first to see exactly what would change.
$ curl -fsSL https://prefex.vercel.app/install.sh -o install.sh && less install.sh
$ bash install.sh
Custom bind/port: PREFEX_BIND=0.0.0.0 PREFEX_PORT=9019 bash install.sh
2.
Open the dashboard
Prefex is running on :8019. The installer connects Claude Code for you — restart Claude Code to activate.
$ xdg-open http://localhost:8019/dashboard

~20MB standalone binary. Zero dependencies. 12 features across three tiers: smart routing + prompt caching + compression (cost) · session memory + context guard + checkpointing (context) · loop guard + token trap + think cap + lean reasoning (guardrails).

1.
Download the install script
Review it before running — it's a PowerShell script and you should know what it does.
PS> iwr https://prefex.vercel.app/install.ps1 -OutFile install.ps1
PS> Get-Content install.ps1 | more
2.
Run it
Downloads the binary, starts Prefex, and connects Claude Code. Customize via $env:PREFEX_BIND and $env:PREFEX_PORT before running.
PS> .\install.ps1
3.
Open the dashboard
Prefex is running. The installer connects Claude Code for you — just restart Claude Code.
PS> Start-Process http://localhost:8019/dashboard
To stop: iwr https://prefex.vercel.app/stop.ps1 -OutFile stop.ps1; .\stop.ps1

~20MB standalone binary. Requires PowerShell 5.1+ and Windows 10/11. Windows support is lightly tested — if you run into issues, email k@daytwoai.com.

Works with your tools

Prefex is a local proxy. Anything that lets you set a custom API base URL works out of the box.

ToolHow to connectStatus
Claude Code Set ANTHROPIC_BASE_URL in ~/.claude/settings.json Auto-configured by installer
Continue.dev Set apiBase for each model in ~/.continue/config.json Supported
Cursor Set ANTHROPIC_BASE_URL env var in your shell Supported
VS Code Set ANTHROPIC_BASE_URL in integrated terminal env settings Supported
Windsurf Set ANTHROPIC_BASE_URL env var in your shell Supported
Aider Run with --api-base http://localhost:8019 Supported
Python / Node SDK Pass base_url="http://localhost:8019" to the client Supported
Any HTTP client Replace api.anthropic.com with localhost:8019 Supported

What you actually save

There's no honest fixed percentage — it depends entirely on your workload. So Prefex shows you two numbers, and is clear about which is which.

Number on your dashboard What it means Whose credit
Saved by Prefex (the headline) What routing, trimming and guardrails actually added beyond the native prompt caching Claude Code already gives you for free. Prefex
vs no optimization at all (counterfactual) Every token repriced at full strong-model rate with no caching discount. Intentionally the bigger number — shown only for context, clearly labeled. mostly Anthropic's free native caching

Most of the eye-catching "X% saved" figures you'll see elsewhere are really Anthropic's native caching — which you get without us. Prefex only takes credit for what it adds, and shows you the receipt per request. Don't trust a headline number; check your own dashboard.

See it yourself — run the benchmark

5 code-review questions on public code, run twice — cold then warm. Costs ~$0.02–0.05 total.

1.
Download & review the script
Uses the Claude CLI — no API key export needed. Runs 3 rounds: Prefex cold, Prefex warm, direct baseline.
$ curl -fsSL https://prefex.vercel.app/prefex-bench.sh -o prefex-bench.sh && less prefex-bench.sh
2.
Run it (Prefex must be running)
Requires: claude CLI, python3. Backs up settings, runs benchmark, restores on exit.
$ bash prefex-bench.sh
1.
Download & review the script
Uses the Claude CLI — no API key export needed. Same benchmark as the macOS/Linux version.
PS> iwr https://prefex.vercel.app/prefex-bench.ps1 -OutFile prefex-bench.ps1
PS> Get-Content prefex-bench.ps1 | more
2.
Run it (Prefex must be running)
Requires: claude CLI. Backs up settings, runs benchmark, restores on exit.
PS> .\prefex-bench.ps1
Round Requests Total input tokens Cached tokens Actual cost Saved % saved
Round 1 — cold 5 ~37 000 0 ~$0.042
Round 2 — warm 5 ~37 000 ~34 000 ~$0.005 ~$0.037 ~88%

Costs are read from Anthropic's own billing fields in the SSE stream — not computed by Prefex. Corpus: karpathy/nanoGPT@3adf61e (public, deterministic).

Connect your client

Change one value. Everything else stays the same.

Claude Code
# ~/.claude/settings.json
{
  "env": {
    "ANTHROPIC_BASE_URL": "http://localhost:8019"  ← add this
  }
}
Python (Anthropic SDK)
import anthropic

client = anthropic.Anthropic(
    api_key="sk-ant-...",
    base_url="http://localhost:8019",  ← add this
)
Node.js (Anthropic SDK)
import Anthropic from "@anthropic-ai/sdk";

const client = new Anthropic({
  apiKey: "sk-ant-...",
  baseURL: "http://localhost:8019",  // ← add this
});
cURL
curl http://localhost:8019/v1/messages \
  -H "x-api-key: $ANTHROPIC_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "content-type: application/json" \
  -d '{"model":"claude-sonnet-4-6","max_tokens":1024,"messages":[{"role":"user","content":"Hello"}]}'

Your prompts never leave your machine.

Prefex runs entirely on localhost. There is no telemetry, no analytics, no external logging service. If any internal component fails — requests pass through to the upstream API unchanged. Prefex never blocks a request because of its own failure.

Verify it yourself with tcpdump:

# All outbound traffic from Prefex should go only to api.anthropic.com
sudo tcpdump -i any -n 'dst port 443' 2>/dev/null | grep -v api.anthropic.com
Full privacy and data handling details →

Download, review, run. Savings from the first request.

$ curl -fsSL https://prefex.vercel.app/install.sh -o install.sh
$ less install.sh review
$ bash install.sh
$ prefex preview preview changes
github.com/PromptForcePrime/prefex →

Free to use

30-day license, renewable online. No credit card. No call-home. Renew →

Marketplace

Curated skills, MCP servers, and templates for Claude Code. One-click install from your dashboard. Browse →

Need team management, shared caches, or custom routing? Join the enterprise waitlist →

Uninstall / restore

Stop Prefex and point Claude Code back to Anthropic directly.

macOS / Linux — one command:

$ curl -fsSL https://prefex.vercel.app/uninstall.sh | bash

Add --purge to also delete ~/.prefex (logs, cache, config).

Windows (PowerShell):

PS> iwr https://prefex.vercel.app/uninstall.ps1 -OutFile uninstall.ps1; .\uninstall.ps1

Add -purge to also delete %USERPROFILE%\.prefex (logs, cache, config).

Manually restore ~/.claude/settings.json:

Remove or change the ANTHROPIC_BASE_URL entry back to https://api.anthropic.com:

{
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.anthropic.com"
  }
}

Then restart Claude Code. If you had no settings.json before installing Prefex, you can delete the file entirely.

Full cleanup (remove all Prefex data):

$ curl -fsSL https://prefex.vercel.app/uninstall.sh | bash -s -- --purge

Windows: .\uninstall.ps1 -purge

Stops Prefex, removes the binary, restores settings, and deletes ~/.prefex.