npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

llm-debugger

v1.0.17

Published

Debug and log LLM API requests/responses with streaming support. Works with OpenAI, Anthropic, and compatible APIs.

Readme

llm-debugger

Debug and log LLM API requests with streaming support.

Quick Start

# Start proxy to OpenAI
npx llm-debugger@latest --target https://api.openai.com

# Start proxy to Anthropic
npx llm-debugger@latest --target https://api.anthropic.com

Usage

Point your LLM client to the proxy instead of the API directly:

# Instead of: https://api.openai.com/v1/chat/completions
# Use:        http://localhost:8000/v1/chat/completions

View logged requests at http://localhost:8000/__viewer__

Routes

| Route | Description | | ------------- | --------------------------------- | | /* | Forwards requests to target API | | /__viewer__ | Web UI to inspect logged requests |

Per-request overrides

Two headers let you override proxy behavior for a single request without restarting:

| Header | Effect | | --------------------------------- | --------------------------------------------------- | | llm-debugger-url: <url> | Override the upstream target URL (full URL only) | | llm-debugger-cache: true\|false | Force snapshot cache on or off for this request |

Both headers are stripped before forwarding and never written into snapshots.

Example:

curl http://localhost:8000/v1/chat/completions \
  -H 'Authorization: Bearer sk-xxx' \
  -H 'llm-debugger-url: https://api.openai.com' \
  -H 'Content-Type: application/json' \
  -d '{"model":"gpt-4o","messages":[{"role":"user","content":"hi"}]}'

Programmatic API

Run the proxy from your own scripts. No config file is read or written — pass everything as options.

import { startProxy } from 'llm-debugger';

const proxy = await startProxy({
  target: 'https://api.openai.com',
});

console.log(proxy.url);  // http://localhost:8000

// ...point your client at proxy.url and run your code...

await proxy.stop();

Options

| Option | Default | Description | | ---------------- | -------------------------- | ----------------------------------------------------------- | | target | — | Upstream URL. | | host | localhost | Bind host. | | port | 8000-8100 | Single port or range; first free port wins. | | cache | true | Enable snapshot replay cache. | | snapshotDir | <cwd>/.snapshots | Where snapshots are stored. | | ignoreRoutes | [] | Glob patterns for paths to skip (no proxy, no log). | | hideFromViewer | [] | Glob patterns for paths to log but hide from the viewer UI. | | enabled | true | Toggle request logging (proxy still works when off). | | maxLogs | 100 | Log retention before rotation; 0 disables rotation. | | logsDir | <cwd>/.llm-debugger/logs | Where logs are written. | | cwd | process.cwd() | Used as the base for logsDir and snapshotDir defaults. |

Return value

{
  url: string;          // e.g. "http://localhost:8000"
  port: number;
  host: string;
  server: http.Server;  // raw Node server, for advanced use
  stop: () => Promise<void>;
}

Configuration

When running via the CLI, config lives at ~/.llm-debugger/config.yaml and logs at ~/.llm-debugger/logs. Override the base directory with:

  • LLM_DEBUGGER_HOME - Base directory

Snapshot cache

When the cache is on, the proxy records each upstream response to a JSON file under <cwd>/.snapshots/ and replays it on a subsequent matching request. The cache key is sha256(method + url + body) truncated to 12 hex chars.

Snapshots are organised as <snapshot_dir>/<sanitized-host-and-path>/<model>/<hash>.json. Model falls back to default when the request has no model field.

Toggle defaults via config:

llm-debugger config set cache true
llm-debugger config set snapshot_dir /path/to/snapshots

Override per request with the llm-debugger-cache header. Browse snapshots in the viewer at http://localhost:8000/__viewer__/snapshots.

Config Commands

npx llm-debugger@latest config show              # Display current config
npx llm-debugger@latest config edit              # Open config in editor
npx llm-debugger@latest config set <key> <value> # Set enabled, max_logs, cache, snapshot_dir

Only true and false strings are coerced to booleans; other strings such as yes are stored unchanged.

License

MIT