{"_id":"@4o2/sdk","_rev":"5-1d3037579cfde0b38e70218a0f786563","name":"@4o2/sdk","dist-tags":{"latest":"0.3.3"},"versions":{"0.2.0":{"name":"@4o2/sdk","version":"0.2.0","keywords":["x402","402","warming-pool","agent-payments","usdc","base","ai-agents"],"license":"MIT","_id":"@4o2/sdk@0.2.0","maintainers":[{"name":"lnvestor","email":"brambre0@gmail.com"}],"homepage":"https://4o2.dev","bugs":{"url":"https://github.com/lnvestor/4o2/issues"},"dist":{"shasum":"0919485a02875ff41ce07e3b3459cb7b463fd464","tarball":"https://registry.npmjs.org/@4o2/sdk/-/sdk-0.2.0.tgz","fileCount":23,"integrity":"sha512-vkiVRVp94gVjH8x6T9zXpyR6+3IybnvBXTZH+THRnxyKHx/ej6aFYm4CxidHo8EpyqW/WuC/rUVORej9C2aPUw==","signatures":[{"sig":"MEUCIG4j9jVjA+GPIbrQDPi2nAkoPSjXGHztS0raaPKOZ1TcAiEAkQoW5H+1CWPsVOdTrmpTRqwtZAB3Ib7L7IZK6urArbA=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":129355},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./hono":{"types":"./dist/hono.d.ts","import":"./dist/hono.js"},"./next":{"types":"./dist/next.d.ts","import":"./dist/next.js"},"./fetch":{"types":"./dist/fetch.d.ts","import":"./dist/fetch.js"},"./verify":{"types":"./dist/verify.d.ts","import":"./dist/verify.js"},"./express":{"types":"./dist/express.d.ts","import":"./dist/express.js"}},"gitHead":"00353badd517bf4afb3cd6cd5e9cce7dbe30a111","scripts":{"dev":"tsup --watch","build":"tsup","typecheck":"tsc --noEmit","prepublishOnly":"pnpm typecheck && pnpm build"},"_npmUser":{"name":"lnvestor","email":"brambre0@gmail.com"},"repository":{"url":"git+https://github.com/lnvestor/4o2.git","type":"git"},"_npmVersion":"11.8.0","description":"Drop-in /warmup endpoint for any HTTP server. Joins your API to the 4o2 warming pool — climbs agent search rankings via real on-chain micropayments to your splitter, with zero compute on your end.","directories":{},"_nodeVersion":"25.5.0","_hasShrinkwrap":false,"devDependencies":{"hono":"^4.6.0","next":"^16.0.0","tsup":"^8.3.0","express":"^4.21.0","typescript":"^5","@types/node":"^20","@types/express":"^4.17.21"},"peerDependencies":{"hono":">=4","next":">=14","express":">=4"},"peerDependenciesMeta":{"hono":{"optional":true},"next":{"optional":true},"express":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/sdk_0.2.0_1778004529552_0.29070000405573704","host":"s3://npm-registry-packages-npm-production"}},"0.3.0":{"name":"@4o2/sdk","version":"0.3.0","keywords":["x402","402","warming-pool","agent-payments","usdc","base","ai-agents"],"license":"MIT","_id":"@4o2/sdk@0.3.0","maintainers":[{"name":"lnvestor","email":"brambre0@gmail.com"}],"homepage":"https://4o2.dev","bugs":{"url":"https://github.com/lnvestor/4o2/issues"},"dist":{"shasum":"f1da5d9d6a301b899f61424371da718ea4ea4950","tarball":"https://registry.npmjs.org/@4o2/sdk/-/sdk-0.3.0.tgz","fileCount":24,"integrity":"sha512-jdLl5TnMWyUmwRkS73pG7iNMaLgtY+WRZCSY7ueyr3zZmirIVcQd02cm3+WhlSRBdBakGj//v1idT9olDR9tjA==","signatures":[{"sig":"MEQCIDnnE/yDKc43EsngIR4G8pXLG3X57NvCSKrt9D4zA5ccAiAOKCPUtVFfUqOlnzTp2UbP5nCRvj6kHEo8XKDVvj48cQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":257166},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./hono":{"types":"./dist/hono.d.ts","import":"./dist/hono.js"},"./next":{"types":"./dist/next.d.ts","import":"./dist/next.js"},"./fetch":{"types":"./dist/fetch.d.ts","import":"./dist/fetch.js"},"./verify":{"types":"./dist/verify.d.ts","import":"./dist/verify.js"},"./express":{"types":"./dist/express.d.ts","import":"./dist/express.js"}},"gitHead":"ca447b176dc6760db95cff41af594374aaa3b85d","scripts":{"dev":"tsup --watch","build":"tsup","typecheck":"tsc --noEmit","prepublishOnly":"pnpm typecheck && pnpm build"},"_npmUser":{"name":"lnvestor","email":"brambre0@gmail.com"},"repository":{"url":"git+https://github.com/lnvestor/4o2.git","type":"git"},"_npmVersion":"11.8.0","description":"Drop-in /warmup endpoint for any HTTP server. Joins your API to the 4o2 warming pool — climbs agent search rankings via real on-chain micropayments to your splitter, with zero compute on your end.","directories":{},"_nodeVersion":"25.5.0","dependencies":{"@coinbase/x402":"^2.1.0"},"_hasShrinkwrap":false,"devDependencies":{"hono":"^4.6.0","next":"^16.0.0","tsup":"^8.3.0","express":"^4.21.0","typescript":"^5","@types/node":"^20","@types/express":"^4.17.21"},"peerDependencies":{"hono":">=4","next":">=14","express":">=4"},"peerDependenciesMeta":{"hono":{"optional":true},"next":{"optional":true},"express":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/sdk_0.3.0_1778276348311_0.30010769725207864","host":"s3://npm-registry-packages-npm-production"}},"0.3.1":{"name":"@4o2/sdk","version":"0.3.1","keywords":["x402","402","warming-pool","agent-payments","usdc","base","ai-agents"],"license":"MIT","_id":"@4o2/sdk@0.3.1","maintainers":[{"name":"lnvestor","email":"brambre0@gmail.com"}],"homepage":"https://4o2.dev","bugs":{"url":"https://github.com/lnvestor/4o2/issues"},"dist":{"shasum":"9903f99ec4ff5ee46c7b101623cb78bee89b78d1","tarball":"https://registry.npmjs.org/@4o2/sdk/-/sdk-0.3.1.tgz","fileCount":24,"integrity":"sha512-CZzFVxsWV5RgeJGfRvOorF2lyoqggqui0pabOw8MGAbAX9pjJkrSswKkl1wbxrCjKe0Rj0AEMGJ1s5q0NkIEUA==","signatures":[{"sig":"MEUCIAleJaPB1G53JZncN6AcjmzJkg2kFcWhgC/9n9TVkS2hAiEAwuuznJ5H+KYLB3WuZAPFPIVpTgpzGOZFC6y9OjbuKmk=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":255745},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./hono":{"types":"./dist/hono.d.ts","import":"./dist/hono.js"},"./next":{"types":"./dist/next.d.ts","import":"./dist/next.js"},"./fetch":{"types":"./dist/fetch.d.ts","import":"./dist/fetch.js"},"./verify":{"types":"./dist/verify.d.ts","import":"./dist/verify.js"},"./express":{"types":"./dist/express.d.ts","import":"./dist/express.js"}},"gitHead":"85d64c1c87ff7166d3d52064bdb8e33b88f4cabd","scripts":{"dev":"tsup --watch","build":"tsup","typecheck":"tsc --noEmit","prepublishOnly":"pnpm typecheck && pnpm build"},"_npmUser":{"name":"lnvestor","email":"brambre0@gmail.com"},"repository":{"url":"git+https://github.com/lnvestor/4o2.git","type":"git"},"_npmVersion":"11.8.0","description":"x402 helper — wrap your existing paid handler, or mount a standalone /warmup route. Settles on Base via EIP-3009.","directories":{},"_nodeVersion":"25.5.0","dependencies":{"@coinbase/x402":"^2.1.0"},"_hasShrinkwrap":false,"devDependencies":{"hono":"^4.6.0","next":"^16.0.0","tsup":"^8.3.0","express":"^4.21.0","typescript":"^5","@types/node":"^20","@types/express":"^4.17.21"},"peerDependencies":{"hono":">=4","next":">=14","express":">=4"},"peerDependenciesMeta":{"hono":{"optional":true},"next":{"optional":true},"express":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/sdk_0.3.1_1778276492048_0.3737607533977694","host":"s3://npm-registry-packages-npm-production"}},"0.3.2":{"name":"@4o2/sdk","version":"0.3.2","keywords":["x402","402","warming-pool","agent-payments","usdc","base","ai-agents"],"license":"MIT","_id":"@4o2/sdk@0.3.2","maintainers":[{"name":"lnvestor","email":"brambre0@gmail.com"}],"homepage":"https://4o2.dev","bugs":{"url":"https://github.com/lnvestor/4o2/issues"},"dist":{"shasum":"58c2f496f15fb3aaa3d2856458210c3fc72b4c20","tarball":"https://registry.npmjs.org/@4o2/sdk/-/sdk-0.3.2.tgz","fileCount":24,"integrity":"sha512-8iVl8QrFOJ9HMeZym3VpTKfPuvsYIbvpAyvfbWTWhDc3lupHr0kB5vfJKTY0wES5QZRoEeGCl/F+Ba1uLQ/zWA==","signatures":[{"sig":"MEYCIQCsKVUk1pqcMnvPYHwKw5KkichMdNaIZU/Ub2SfgBzdOwIhAKADKyULdkeI8GDa1Uv3VMdBVFRfSgpB4DLlVvPLV4ed","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":255932},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./hono":{"types":"./dist/hono.d.ts","import":"./dist/hono.js"},"./next":{"types":"./dist/next.d.ts","import":"./dist/next.js"},"./fetch":{"types":"./dist/fetch.d.ts","import":"./dist/fetch.js"},"./verify":{"types":"./dist/verify.d.ts","import":"./dist/verify.js"},"./express":{"types":"./dist/express.d.ts","import":"./dist/express.js"}},"gitHead":"88e292edc1ae56dc5c5b0c30de69e1dd27171118","scripts":{"dev":"tsup --watch","build":"tsup","typecheck":"tsc --noEmit","prepublishOnly":"pnpm typecheck && pnpm build"},"_npmUser":{"name":"lnvestor","email":"brambre0@gmail.com"},"repository":{"url":"git+https://github.com/lnvestor/4o2.git","type":"git"},"_npmVersion":"11.8.0","description":"x402 helper — wrap your existing paid handler, or mount a standalone /warmup route. Settles on Base via EIP-3009.","directories":{},"_nodeVersion":"25.5.0","dependencies":{"@coinbase/x402":"^2.1.0"},"_hasShrinkwrap":false,"devDependencies":{"hono":"^4.6.0","next":"^16.0.0","tsup":"^8.3.0","express":"^4.21.0","typescript":"^5","@types/node":"^20","@types/express":"^4.17.21"},"peerDependencies":{"hono":">=4","next":">=14","express":">=4"},"peerDependenciesMeta":{"hono":{"optional":true},"next":{"optional":true},"express":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/sdk_0.3.2_1778276669218_0.010187806013324918","host":"s3://npm-registry-packages-npm-production"}},"0.3.3":{"name":"@4o2/sdk","version":"0.3.3","description":"x402 helper — wrap your existing paid handler, or mount a standalone /warmup route. Settles on Base via EIP-3009.","license":"MIT","homepage":"https://4o2.dev","repository":{"type":"git","url":"git+https://github.com/lnvestor/4o2.git"},"keywords":["x402","402","warming-pool","agent-payments","usdc","base","ai-agents"],"type":"module","main":"./dist/index.js","module":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./next":{"types":"./dist/next.d.ts","import":"./dist/next.js"},"./hono":{"types":"./dist/hono.d.ts","import":"./dist/hono.js"},"./express":{"types":"./dist/express.d.ts","import":"./dist/express.js"},"./fetch":{"types":"./dist/fetch.d.ts","import":"./dist/fetch.js"},"./verify":{"types":"./dist/verify.d.ts","import":"./dist/verify.js"}},"dependencies":{"@coinbase/x402":"^2.1.0"},"scripts":{"build":"tsup","dev":"tsup --watch","typecheck":"tsc --noEmit","postinstall":"node scripts/postinstall.cjs || true","prepublishOnly":"pnpm typecheck && pnpm build"},"devDependencies":{"@types/express":"^4.17.21","@types/node":"^20","express":"^4.21.0","hono":"^4.6.0","next":"^16.0.0","tsup":"^8.3.0","typescript":"^5"},"peerDependencies":{"express":">=4","hono":">=4","next":">=14"},"peerDependenciesMeta":{"express":{"optional":true},"hono":{"optional":true},"next":{"optional":true}},"gitHead":"9fd99e191d7bd6b1fa74805d27d7a6d445a9fb25","_id":"@4o2/sdk@0.3.3","bugs":{"url":"https://github.com/lnvestor/4o2/issues"},"_nodeVersion":"25.5.0","_npmVersion":"11.8.0","dist":{"integrity":"sha512-DB/Q6m+h5mSr12DrqRhhT0cMAUQ3PmWtL2vKdBR+UgVaUc6Bz2f7sXA4unC38Uw2TvUCI/HRDn4TbS7hhrNPJw==","shasum":"028c117dd8424b64bcf34389a179b4dde85b4ec8","tarball":"https://registry.npmjs.org/@4o2/sdk/-/sdk-0.3.3.tgz","fileCount":25,"unpackedSize":256901,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCS5KgPkORSROEGno5q0lG9V+yEjLvs4anAyc88M0DrfAIhAN3YWzTW7+XRe9riWSlezW8za9OodLRTHcSa1miH43N6"}]},"_npmUser":{"name":"lnvestor","email":"brambre0@gmail.com"},"directories":{},"maintainers":[{"name":"lnvestor","email":"brambre0@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/sdk_0.3.3_1778322986922_0.49410405363038157"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-05T18:08:49.360Z","modified":"2026-05-09T10:36:27.285Z","0.2.0":"2026-05-05T18:08:49.697Z","0.3.0":"2026-05-08T21:39:08.498Z","0.3.1":"2026-05-08T21:41:32.206Z","0.3.2":"2026-05-08T21:44:29.396Z","0.3.3":"2026-05-09T10:36:27.092Z"},"bugs":{"url":"https://github.com/lnvestor/4o2/issues"},"license":"MIT","homepage":"https://4o2.dev","keywords":["x402","402","warming-pool","agent-payments","usdc","base","ai-agents"],"repository":{"type":"git","url":"git+https://github.com/lnvestor/4o2.git"},"description":"x402 helper — wrap your existing paid handler, or mount a standalone /warmup route. Settles on Base via EIP-3009.","maintainers":[{"name":"lnvestor","email":"brambre0@gmail.com"}],"readme":"# @4o2/sdk\n\n[![npm version](https://img.shields.io/npm/v/@4o2/sdk?style=flat&colorA=111&colorB=111)](https://www.npmjs.com/package/@4o2/sdk)\n[![website](https://img.shields.io/badge/website-4o2.dev-111?style=flat)](https://4o2.dev)\n[![license](https://img.shields.io/badge/license-MIT-111?style=flat)](./LICENSE)\n\nx402 helper for paid endpoints — drop in front of your existing handler, or mount as a standalone `/warmup` route.\n\n→ **[4o2.dev](https://4o2.dev)** — get an API key, manage your listing, see live activity.\n\n## Install\n\n```bash\npnpm add @4o2/sdk\n```\n\n## Quick start\n\nWrap any existing paid handler. Unsigned traffic falls through to your handler unchanged; signed warming traffic gets the SDK's challenge.\n\n```ts\n// app/api/predict/route.ts\nimport { wrap } from \"@4o2/sdk/next\";\n\nasync function realPOST(req: Request) {\n  // your existing paid handler\n}\n\nexport const POST = wrap(realPOST);\n```\n\nOr mount as a standalone route:\n\n```ts\n// app/api/warmup/route.ts\nexport { POST } from \"@4o2/sdk/next\";\n```\n\n## Other runtimes\n\n```ts\n// Hono\nimport { wrap } from \"@4o2/sdk/hono\";\napp.post(\"/predict\", wrap(async (c) => { /* ... */ }));\n\n// Express\nimport { wrap } from \"@4o2/sdk/express\";\napp.post(\"/predict\", wrap(async (req, res) => { /* ... */ }));\n\n// Bun / Cloudflare Workers / any fetch runtime\nimport { wrap } from \"@4o2/sdk/fetch\";\nconst handler = wrap(async (req) => { /* ... */ });\n```\n\n## Configuration\n\nSet one env var:\n\n```env\nFOUR_O_TWO_API_KEY=4o2_<slug>_<secret>\n```\n\nGet the key from your dashboard at [4o2.dev](https://4o2.dev). The SDK fetches the rest of its config (splitter address, network, asset) at first request and caches it.\n\n## Verify\n\n```bash\ncurl -X POST https://your-domain.com/api/predict\n```\n\nExpected: `HTTP/1.1 402 Payment Required` with an x402 v2 challenge body. That confirms the wrap is wired correctly.\n\n## License\n\nMIT.\n","readmeFilename":"README.md"}