prompt-prism
v0.4.3
Published
A transparent local proxy that explains prompt-cache misses.
Maintainers
Readme

While you build and run an Agent, Prompt Prism sits between it and the model provider. Responses—including SSE streams—are forwarded immediately, while a redacted copy is captured locally for inspection.
your agent ──► http://127.0.0.1:1028 ──► model provider
│
└──► Trace + Input Diff + Tools + Output + RawQuick start
Requires Node.js 20 or later.
npm install -g prompt-prism
p2 startOpen http://127.0.0.1:1028/_pp/ (it opens automatically unless --no-open is used), click Proxy URL, and enter your provider's Base URL. Configure your Agent's model API client to use the generated URL—through its framework settings, SDK baseURL, environment variable, CLI option, or custom HTTP client—and keep using the provider's normal API key.
The generated URL looks like http://127.0.0.1:1028/_proxy/<encoded-upstream>. It selects the upstream for that request, so one Prism instance can connect to different providers without restarting.
The following SDK configurations are examples of connecting an Agent; Prompt Prism does not require either SDK.
Anthropic SDK example
import Anthropic from '@anthropic-ai/sdk';
const client = new Anthropic({
apiKey: process.env.ANTHROPIC_API_KEY,
baseURL: 'http://127.0.0.1:1028/_proxy/<encoded-upstream>'
});OpenAI-compatible SDK example
import OpenAI from 'openai';
const client = new OpenAI({
apiKey: process.env.OPENAI_API_KEY,
baseURL: 'http://127.0.0.1:1028/_proxy/<encoded-upstream>'
});For scripts, p2 url https://api.deepseek.com/v1 prints the same kind of URL as the Dashboard generator. It is an alternative to clicking Proxy URL, not an extra startup step.
If the Agent's model API client replaces the Base URL instead of preserving its path prefix, use the fixed --upstream-base-url compatibility mode described in the Guide.
What you can inspect
- Trace — follow model, reasoning, tool call, and tool result events across captures.
- Input Diff — find the first inserted or removed message and understand cache-prefix changes.
- Tools — inspect declared schemas, parsed parameters, and the tools actually called.
- Output — read normalized text, reasoning, usage, errors, and tool arguments.
- Raw — fall back to the original redacted HTTP exchange for unsupported formats.
- Agent Insights — compare trace-level token use, cache reuse, timing, and tool behavior from the CLI.
Compatibility
| Protocol | JSON | SSE | Tools | Normalized dashboard | | --- | --- | --- | --- | --- | | Anthropic Messages | Yes | Yes | Yes | Yes | | OpenAI Chat Completions | Yes | Yes | Yes | Yes | | OpenAI Responses | Yes | Yes | Yes | Yes | | Other HTTP traffic | Forwarded | Forwarded | Raw only | Raw only |
Realtime, Embeddings, Images, and Audio endpoints are not normalized in this release. They are still forwarded and captured in Raw.
Dynamic Proxy URLs are integration-tested with the official OpenAI and Anthropic JavaScript SDKs. Agent frameworks, CLIs, and custom HTTP clients can use the same route when they support a configurable request target and preserve its path prefix; otherwise, use --upstream-base-url. Non-Agent model traffic is also forwarded and remains available in Raw.
Documentation
- Guide — provider setup, CLI options, protocol detection, embedding, and local data.
- Agent Insights — inspect and compare agent runs from the shell.
- Development — run the demo, work on the monorepo, and understand Trace relationships and Input Diff.
- Releasing — prepare, verify, and publish a release manually.
Data and privacy
By default, Prompt Prism saves captures in a data folder inside the directory where you run p2 start (./data). For example, running it from /path/to/your-agent stores the data in /path/to/your-agent/data. Use p2 start --data-dir PATH to choose a different local folder. API keys, authorization headers, and cookies are replaced with [REDACTED]; request and response bodies remain on your machine because they are required for analysis. The default storage cap is 1 GB and the oldest captures are evicted first.
See the Guide before using Prompt Prism with sensitive projects.
