Install VisionSqueezer (npm, cargo, pip)
VisionSqueezer ships across three registries. Pick whichever fits your workflow — they all expose the same core pipeline.
npm (recommended for MCP)
The npm wrapper downloads the platform-correct prebuilt binary on install. Best path if you want the MCP server in an AI editor.
Prebuilt MCP binaries cover Linux x86_64/ARM64, macOS Intel/Apple Silicon, and Windows x86_64/ARM64. Python wheels cover Linux x86_64/ARM64, macOS Intel/Apple Silicon, and Windows x86_64; other Python architectures can compile from source with pip install --no-binary vision-squeezer vision-squeezer.
npm install -g vision-squeezer
Or run it zero-install via npx. The npm package ships the MCP server plus a one-shot mode that optimizes a file:
npx -y vision-squeezer optimize image.png --max-tokens 1600
That prints a JSON report and writes the optimized copy to a temp file (output_path). For every CLI flag (--model, --format, --dry-run, …) install the vision-squeezer CLI with Cargo below.
Cargo (Rust source)
cargo install vision-squeezer
This builds the vision-squeezer CLI and vision-squeezer-mcp server from source.
Python (pip)
Native wheels via pyo3 + maturin for Linux, macOS, and Windows.
pip install vision-squeezer
import vision_squeezer as vs
report = vs.optimize_image(
"screenshot.png",
model="claude",
auto_quality=0.95,
output_path="screenshot.optimized.jpg",
)
print(report["tokens_saved"], report["size_reduction_pct"])
See Python Bindings for the full API.
Verify
npx -y vision-squeezer --version # npm
vision-squeezer --version # Cargo CLI
vision-squeezer image.png --model gpt6 --dry-run --json
--dry-run runs the full pipeline without writing to disk or touching the stats database — a safe way to confirm the install works and preview token impact.
--format flag (JPEG / WebP / AVIF) affects file size and upload latency, not API token count.