From npm install to a keyless client call.
Five steps, a couple of minutes. Verbatim from the README where the code is real; the config surface lives in the docs.
Install the package and start the proxy with your upstream key in server-side env. By default it proxies OpenAI; the key never leaves the machine the proxy runs on.
npm install perishable
# Start the proxy (OpenAI by default)
OPENAI_API_KEY=sk-... npx perishable-proxy Any OpenAI-compatible endpoint works. Redirect OPENAI_BASE_URL at Anthropic, OpenRouter, or a local Ollama and the same session machinery applies.
# Proxy Anthropic / OpenRouter / Ollama instead
OPENAI_API_KEY=sk-ant-... \
OPENAI_BASE_URL=https://api.anthropic.com/v1 \
npx perishable-proxy Call initEntropyCollection early so the client SDK can gather real input signals before it requests a session. Without it, a fresh page has no entropy to mint against.
import { client } from 'perishable';
client.PerishableOpenAI.initEntropyCollection(); Instantiate PerishableOpenAI pointed at your proxy URL and make an OpenAI-shaped call. The SDK requests a fingerprint-bound JWT and refreshes it before expiry; your secret key is never in the bundle.
const ai = new client.PerishableOpenAI({
proxyUrl: 'https://your-proxy.example.com'
});
const res = await ai.createChatCompletion({
model: 'gpt-4',
messages: [{ role: 'user', content: 'Hello!' }]
}); Configure per-fingerprint points-per-window (with an optional block duration) so a casual abuser cannot run up your bill, then deploy the proxy next to your app. Exact config keys are in the docs.
# Perishable applies per-fingerprint rate limiting by default;
# tune points-per-window and block duration in your config,
# then run the proxy behind your normal reverse proxy / TLS. That's the loop
Browse the full feature set, understand the request flow, or read the reference docs.