Debug and log LLM API requests/responses with streaming support. Works with OpenAI, Anthropic, and compatible APIs.
npm install llm-debuggerDebug and log LLM API requests with streaming support.
``bashStart proxy to OpenAI
npx llm-debugger@latest --target https://api.openai.com
Usage
Point your LLM client to the proxy instead of the API directly:
`bash
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 |
| /__proxy__/ | Forwards requests to configured alias |
| /__viewer__ | Web UI to inspect logged requests |Aliases
Configure aliases to proxy to multiple APIs without restarting. When aliases are configured,
--target becomes optional.`bash
Add aliases for common LLM providers
npx llm-debugger@latest config add-alias openai https://api.openai.com
npx llm-debugger@latest config add-alias anthropic https://api.anthropic.com
npx llm-debugger@latest config add-alias openrouter https://openrouter.ai/api
npx llm-debugger@latest config add-alias poe https://api.poe.comStart without --target (aliases only)
npx llm-debugger@latestStart with an alias as the default target
npx llm-debugger@latest --target openaiPersist a default alias for root requests
npx llm-debugger@latest config set-default-alias openai
npx llm-debugger@latest
`Then use the alias path:
`bash
OpenAI via alias
curl http://localhost:8000/__proxy__/openai/v1/chat/completionsAnthropic via alias
curl http://localhost:8000/__proxy__/anthropic/v1/messagesOpenRouter via alias
curl http://localhost:8000/__proxy__/openrouter/v1/chat/completionsPoe via alias
curl http://localhost:8000/__proxy__/poe/v1/chat/completions
`Configuration
Config lives at
~/.llm-debugger/config.yaml and logs at ~/.llm-debugger/logs. Override the base directory with:-
LLM_DEBUGGER_HOME - Base directory$3
`bash
npx llm-debugger@latest config show # Display current config
npx llm-debugger@latest config edit # Open config in editor
npx llm-debugger@latest config add-alias # Add an alias
npx llm-debugger@latest config remove-alias # Remove an alias
npx llm-debugger@latest config set-default-alias # Set default alias for root requests
``MIT