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

@agentgazer/proxy

v0.4.14

Published

AgentGazer proxy server for buffering and forwarding agent events

Readme

@agentgazer/proxy

Transparent HTTP proxy for LLM API calls. Forwards requests to upstream providers, extracts usage metrics from responses (including SSE streams), and buffers them for delivery to an AgentGazer server.

Supported providers

  • OpenAI (api.openai.com)
  • Anthropic (api.anthropic.com)
  • Google (generativelanguage.googleapis.com)
  • Mistral (api.mistral.ai)
  • DeepSeek (api.deepseek.com)
  • Moonshot (api.moonshot.cn)
  • Zhipu / GLM (open.bigmodel.cn)
  • MiniMax (api.minimax.chat)
  • Baichuan (api.baichuan-ai.com)

How it works

  1. Your LLM client sends requests to the proxy instead of the provider directly
  2. The proxy detects the provider from the Host header or request path
  3. If configured, a provider API key is injected into the request headers
  4. If configured, a per-provider rate limit is enforced (429 on excess)
  5. The request is forwarded to the real upstream API
  6. The response is streamed back to your client in real-time
  7. Token counts, model, latency, and cost are extracted and buffered
  8. Buffered events are flushed to the AgentGazer server periodically

Both standard JSON responses and SSE streaming responses are supported.

Usage

As part of the CLI (typical)

npx agentgazer start
# Proxy starts on port 4000

Standalone CLI

agentgazer-proxy --api-key <token> --agent-id proxy \
  --provider-keys '{"openai":"sk-..."}' \
  --rate-limits '{"openai":{"maxRequests":100,"windowSeconds":60}}'

Programmatic

import { startProxy } from "@agentgazer/proxy";

const { server, shutdown } = startProxy({
  port: 4000,
  apiKey: "your-token",
  agentId: "proxy",
  endpoint: "http://localhost:18880/api/events",
  providerKeys: {
    openai: "sk-...",
    anthropic: "sk-ant-...",
  },
  rateLimits: {
    openai: { maxRequests: 100, windowSeconds: 60 },
  },
});

// Later
await shutdown();

Provider detection

The proxy auto-detects the target provider from the Host header. Set your LLM client's base URL to http://localhost:18900 and the proxy handles routing.

If auto-detection fails, set the x-target-url header to specify the upstream base URL explicitly.

API key injection

When providerKeys is configured, the proxy injects the correct auth header per provider:

| Provider | Header | |----------|--------| | OpenAI, Mistral, DeepSeek, Moonshot, Zhipu, MiniMax, Baichuan | Authorization: Bearer <key> | | Anthropic | x-api-key: <key> | | Google | x-goog-api-key: <key> |

If the client already provides the auth header, the proxy does not override it.

Rate limiting

When rateLimits is configured, the proxy enforces a sliding-window rate limit per provider. Requests exceeding the limit receive a 429 response with a Retry-After header.

Health check

GET http://localhost:18900/health

Options

| Option | Type | Default | Description | |--------|------|---------|-------------| | port | number | 4000 | Proxy listen port | | apiKey | string | required | Auth token for the AgentGazer server | | agentId | string | required | Agent ID for recorded events | | endpoint | string | — | Event ingestion URL | | flushInterval | number | 5000 | Event buffer flush interval in ms | | maxBufferSize | number | 50 | Max buffered events before auto-flush | | providerKeys | Record<string, string> | — | Provider API keys to inject | | rateLimits | Record<string, RateLimitConfig> | — | Per-provider rate limits |

License

Apache-2.0