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

n8n-nodes-spendguard

v0.1.2

Published

SpendGuard pre-call budget enforcement for n8n AI Agent workflows — drop a sub-node between Chat Model and AI Agent.

Readme

n8n-nodes-spendguard

SpendGuard pre-call budget enforcement for n8n AI Agent workflows. Drop a sub-node between any Chat Model and the AI Agent — the AI Agent's run manager fires LLM_CALL_PRE against the SpendGuard sidecar before the provider HTTP fires.

Self-hosted n8n only. n8n Cloud's runner policy blocks UDS / local FS mounts; v0.1.x targets self-hosted.

Install

# Enable community packages on your self-hosted n8n.
export N8N_COMMUNITY_PACKAGES_ENABLED=true

# Install the package.
n8n npm install n8n-nodes-spendguard

In the n8n editor, add a SpendGuard API credential (tenant ID, sidecar UDS path, budget ID, window instance ID) and drop the SpendGuard Chat Model node between any ai_languageModel-producing node and your AI Agent.

Wiring

[Anthropic Chat Model] ──(ai_languageModel)──> [SpendGuard Chat Model] ──(ai_languageModel)──> [AI Agent]

The SpendGuard Chat Model node's supplyData():

  1. Reads the SpendGuard API credential.
  2. Resolves the upstream BaseChatModel via getInputConnectionData(AiLanguageModel, 0).
  3. Attaches a @spendguard/langchain SpendGuardCallbackHandler to the model's callbacks array (no Proxy, no clone — the same model reference is returned downstream).
  4. Returns the upstream model verbatim.

When the AI Agent invokes the model, the callback handler fires LLM_CALL_PRE against the SpendGuard sidecar UDS. DENY throws DecisionDenied; n8n's run manager surfaces it as NodeApiError(httpCode: "403") with the SpendGuard decisionId in the description.

Behaviour

| Sidecar verdict | n8n surface | | -------------------- | ----------------------------------------------------------- | | ALLOW | Model invokes normally; handleLLMEnd commits real usage. | | DENY | NodeApiError(httpCode: "403") — no upstream HTTP. | | APPROVAL_REQUIRED | NodeApiError(httpCode: "428") with approvalRequestId. | | UNAVAILABLE | NodeApiError(httpCode: "503"). | | HANDSHAKE failure | NodeApiError(httpCode: "502"). |

Run identity

The SpendGuard sessionId is n8n's executionId; the stepId is the node display name. The runId is composed via the node's Run ID Source parameter:

  • Execution ID + Node Name (default) → ${executionId}:${nodeName}.
  • Node NamenodeName.
  • Custom Expression → user-supplied expression (or ${executionId}:${nodeName} when empty).

The SpendGuard idempotency key is derived via @spendguard/sdk::deriveIdempotencyKey so audit-chain dedup works across Python, TS, and every other SpendGuard adapter.

Limitations

  • Self-hosted only. n8n Cloud is blocked by UDS / local FS policy.
  • n8n ≥ 1.50. Earlier releases used string literals instead of NodeConnectionType enum constants.
  • CJS only. n8n's community-node loader does not support ESM.
  • AiLanguageModel only. ai_tool and ai_memory are contract-layer concerns; out of scope for v0.1.x.

Worked example

See examples/n8n/workflows/n8n_real.workflow.json for an importable workflow with Manual Trigger → AI Agent + Chat Model → SpendGuard Chat Model → AI Agent.

Demo

make demo-up DEMO_MODE=n8n_real

3-step matrix — ALLOW + DENY + STREAM — against the in-network mock SpendGuard sidecar. Asserts INV-1 (DENY skips upstream) + INV-5 (real usage commits) at the SpendGuard ledger layer.

License

Apache-2.0. See LICENSE_NOTICES.md.