Requires Node.js 20.19+ and Express 4.21 or 5. Set FORGE_API_KEY on the server.
server.js
Install: npm install @forgeintel/sdk@0.5.0-beta.17.

Complete example

A paid weather API with Express, @x402/express and Forge, ready to run on Base Sepolia testnet.
Agent context is off by default. agentContext: true asks for it and records it, optional; { required: true } requires agent name and search query on payment-bearing requests and returns HTTP 400 before payment when they are missing. Agent context. Forge intercepts the existing GET /openapi.json response and enriches supported operations. Keep your spec route; pass openapi: { document } when you have a static document, or openapi: { paths: ["/your-spec.json"] } for another path. OpenAPI details. After your server stops accepting requests and drains in-flight work, call await forge.shutdown() to flush pending events. Check forge.diagnostics().enabled and configErrors during setup. Verify collector contact.