Try Prune with any app in about 2 minutes. Prune vaults your provider key, caps spend, cuts your bill through caching and compression, and returns a signed receipt on every call.
This repo is one script and one README. The script makes 15 calls (5 short prompts, repeated over 3 rounds) through Prune's OpenRouter proxy so you see caching on the repeats.
- Create an account at app.withprune.com.
- Connect → Providers — vault your OpenRouter key (
sk-or-v1-...). - Connect → API Keys — create a Prune key (
prune_...). Copy it once. - Copy
.env.exampleto.envand set only the Prune key:cp .env.example .envDo not putPRUNE_API_KEY=prune_...sk-or-v1-...orprune-sk-or-v1-...inPRUNE_API_KEY. That is the #1 cause of401 Invalid API key format. - Install and run:
pip install prune-sdk python-dotenv python test_prune.py
Round 1 is cache misses; rounds 2–3 should show cache=exact and
tokens_saved on repeats. Verify receipts at
withprune.com/verify.
python-dotenv used to keep a stale PRUNE_API_KEY from your shell /
Windows user environment. This script now calls load_dotenv(override=True).
Still stuck? Open a new terminal, or unset the system variable, then rerun.
| Error | Meaning | Fix |
|---|---|---|
Invalid API key format |
Wrong key in .env |
Use prune_... from Connect → API Keys |
OpenRouter rejected (429) |
OpenRouter rate limit / free pool | Wait, add credits, or set PRUNE_TEST_MODEL=openai/gpt-4o-mini |
Default model is openai/gpt-4o-mini (needs OpenRouter credits or a funded key).
For free-only:
PRUNE_TEST_MODEL=meta-llama/llama-3.2-3b-instruct:free
Free models share a congested pool (often 20/min, 50/day).
Text me if you hit any issues: 8291006285
Apache-2.0 — see LICENSE.