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

@agent-relay/credential-proxy

v6.0.14

Published

JWT-authenticated credential proxy for upstream LLM providers

Readme

@agent-relay/credential-proxy

JWT-authenticated credential proxy for upstream LLM providers. Lets sandboxed agents call provider APIs (OpenAI, Anthropic, OpenRouter) without being given raw provider credentials — the proxy holds the keys, agents present per-session JWTs, and the proxy enforces per-credential token budgets.

What it is

A Hono app plus a handful of helpers:

  • createCredentialProxyApp(options) — mounts the HTTP router (/health, /usage, and a catch-all provider-forwarding route under *). Use it directly in Node (via @hono/node-server) or bind it inside a Cloudflare Worker.
  • mintProxyToken(...) / verifyProxyToken(...) — JWT helpers built on jose. HS256 by default, audience relay-llm-proxy.
  • MeteringCollector + checkBudget — in-memory usage accounting with pessimistic reservations so concurrent requests can't bypass the declared budget.
  • Provider adapters under providers/ — translate incoming JWT claims to the correct upstream HTTP request for OpenAI / Anthropic / OpenRouter.

Environment variables

Required at runtime (the host of the proxy):

| Variable | Purpose | | ----------------------------------- | ------------------------------------------------------------ | | CREDENTIAL_PROXY_JWT_SECRET | HS256 secret the proxy uses to verify per-session JWTs. | | CREDENTIAL_PROXY_ADMIN_JWT_SECRET | Secret for admin-scoped tokens (e.g. the /usage endpoint). | | CREDENTIAL_PROXY_ADMIN_AUDIENCE | Audience claim the proxy requires on admin tokens. | | OPENAI_API_KEY | Upstream credential for the OpenAI provider adapter. | | ANTHROPIC_API_KEY | Upstream credential for the Anthropic provider adapter. | | OPENROUTER_API_KEY | Upstream credential for the OpenRouter provider adapter. |

Only the provider keys you actually forward to need to be set — missing keys surface as 502 credential_unavailable on the relevant route.

The agent side (whichever process mints tokens and launches the sandboxed CLI) uses CREDENTIAL_PROXY_JWT_SECRET to sign tokens and puts them into the agent's environment as CREDENTIAL_PROXY_TOKEN (alias: RELAY_LLM_PROXY_TOKEN) plus RELAY_LLM_PROXY / RELAY_LLM_PROXY_URL so the SDK's proxy-env helpers can wire up per-CLI OPENAI_BASE_URL / ANTHROPIC_BASE_URL overrides.

Usage

import { serve } from '@hono/node-server';
import { createCredentialProxyApp } from '@agent-relay/credential-proxy';

const app = createCredentialProxyApp({
  // Defaults to process.env.CREDENTIAL_PROXY_JWT_SECRET / ADMIN_JWT_SECRET.
});

serve({ fetch: app.fetch, port: Number(process.env.PORT ?? 3001) });

For the SDK-side wiring that lets workflow agents use the proxy transparently, see @agent-relay/sdk/workflows's proxy-env module and the credentialProxy field on SwarmConfig.

Development

npm run build      # tsc → dist/
npm run test       # vitest
npm run dev        # builds then runs the proxy on PORT (default 3001)