Skip to content
prune.

Documentation

Technical guides for the Prune LLM proxy - integration, security, and comparisons.

Quick answer

Prune is a managed AI gateway. Change your SDK base URL, add a Prune API key, and every response includes a cost/security receipt. Unique-path savings apply even when prompts never repeat; cache is upside.

Start here

Quick start

AES-256-GCM encryption for vaulted provider API keys vault · Spend caps checked before the provider is called

In our 26 Sep lab, new questions cost about 94% less than sending everything to gpt-4o, and repeats were free. Lab result, not a customer bill.

quickstart.py
pip install openai
export PRUNE_API_KEY=prune_...  # dashboard → API Keys. Your OpenAI key stays in the Prune vault.

import os
from openai import OpenAI

PRUNE_API_KEY = os.environ["PRUNE_API_KEY"]

client = OpenAI(
    base_url="https://api.withprune.com/v1",
    api_key=PRUNE_API_KEY,
)

resp = client.chat.completions.create(
    model="gpt-4o",
    messages=[{"role": "user", "content": "Hello!"}],
)
print(resp.choices[0].message.content)
print(resp.model_dump().get("prune_metadata"))  # cache_hit, cost, signed receipt

Set up with your coding agent

Paste this into Cursor, Claude Code, Codex or Windsurf. It finds your LLM clients, points them at Prune, and checks one request. Your keys never go in the chat.

Show the prompt
Add Prune to this project so its LLM API calls go through the Prune gateway.

Before you change code:
- I create a Prune API key (it starts with prune_) at https://app.withprune.com under Connect > API Keys, and save my provider key under Connect > Providers. Do not ask me to paste either key into this chat.
- Read the key from the PRUNE_API_KEY environment variable. Never hard-code it and never ship it to a browser or mobile bundle. Add PRUNE_API_KEY to .env.example and make sure the real env file is in .gitignore.

Steps:
1. Find every place this app creates an LLM client (OpenAI, Anthropic, or any OpenAI-compatible SDK).
2. Change only the client construction. Do not rewrite call sites, prompts or model names.
   - OpenAI SDK, Python: OpenAI(base_url="https://api.withprune.com/v1", api_key=os.environ["PRUNE_API_KEY"])
   - OpenAI SDK, TypeScript: new OpenAI({ baseURL: "https://api.withprune.com/v1", apiKey: process.env.PRUNE_API_KEY })
   - Anthropic SDK: base_url / baseURL "https://api.withprune.com" with api_key / apiKey set to PRUNE_API_KEY
   - Raw HTTP: POST https://api.withprune.com/v1/chat/completions with header "Authorization: Bearer $PRUNE_API_KEY"
3. Do not migrate these, list them for me instead: calls to the OpenAI Responses API (client.responses.create is not supported through Prune yet), and Bedrock calls with stream=true.
4. Verify with one real request. Expect HTTP 200, a prune_metadata object in the JSON body, and an X-Prune-Provider response header. Sending the same request again should return X-Prune-Cache-Hit: true.
5. Optional, only if the code already has these concepts: send X-Prune-Customer-Id with the end customer's id, X-Prune-Feature-Id with the product feature name, and for agent loops X-Prune-Run-Id plus X-Prune-Run-Budget-Usd.

Keep the diff minimal and do not refactor unrelated code. Full reference: https://www.withprune.com/llms-full.txt

Also

Guides

Compare

Start free at app.withprune.com/signup (no card), then vault a key and send one request.

Have an account? Sign in · PyPI.