@forgeintel/sdk/core is the Forge logic without any framework. The Express middleware is a thin wrapper around it, and future adapters (Hono, Next.js) will be too. Use it directly when your framework has no adapter yet, or when you run the x402 flow yourself with @x402/core.

The four calls

1

forge.route(request): Forge's own routes

Call it first for every request. It answers /feedback, /feedback/rate, /feedback/summary and (with openapi.document) /openapi.json, and returns null for everything else.
2

forge.call(request): one per request to a paid route

Mints a feedback ID if the request carries a payment header.
3

call.requestUrl() and call.requestBody(): on the way in

Read the agent’s self-reported agent context and drop it before your own logic, so your validators never see it.
4

call.headers() and call.json(): on the way out

On a 402, pass your PAYMENT-REQUIRED value. You get it back with the sentence and extension added. On a paid 2xx, you get Forge-Feedback-Id.
For text responses, use call.text(status, contentType, text) instead of call.json.
5

call.finish(status): after the response is sent

Reports the challenge or interaction event.
Every call method is fail-safe: on any internal error it returns your input unchanged, so it never breaks a paid response.

Complete example

A plain node:http server running the manual @x402/core flow (the same steps as x402’s own “custom” server example), with Forge’s core. From examples/node-http-core in the Forge SDK repository. Forge lines are marked (forge).
server.ts
Run it on Base Sepolia:
See the Core API reference for every type.