{"_id":"@darklrd/x402-agent-client","_rev":"3-733a2db0caa323683ab323883830f2d9","name":"@darklrd/x402-agent-client","dist-tags":{"latest":"0.1.2"},"versions":{"0.1.0":{"name":"@darklrd/x402-agent-client","version":"0.1.0","keywords":["x402","http-402","payment","ai-agent","client","micropayment"],"author":{"name":"Shashwat Srivastava","email":"shashwat@iflychat.com"},"license":"MIT","_id":"@darklrd/x402-agent-client@0.1.0","maintainers":[{"name":"darklrd","email":"darklrd@gmail.com"}],"homepage":"https://github.com/darklrd/x402-toolkit#readme","bugs":{"url":"https://github.com/darklrd/x402-toolkit/issues"},"dist":{"shasum":"e4b2e49527db96514b51436554c04933ba013c17","tarball":"https://registry.npmjs.org/@darklrd/x402-agent-client/-/x402-agent-client-0.1.0.tgz","fileCount":21,"integrity":"sha512-diwjRCRKiSfTKj6WibKDBen7HM+UGi/cHojvl0n/8KlN0KRDv3/xXJIUDIcdZNEAg7nGM7MnpSOw602l1pT9Cw==","signatures":[{"sig":"MEYCIQCQGcaKPayBEbCScZFb+cYAwO6YogdzPKW/rZZMYiQW1wIhAIuC+MqiB9NQ1XaGqroqBN1BsX7gHZbLDQiZKtcu6Ta9","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":24663},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"e93e0244b05a52469617dc7164435b98b4df9240","scripts":{"build":"tsc -p tsconfig.json","clean":"rimraf dist *.tsbuildinfo","typecheck":"tsc --noEmit"},"_npmUser":{"name":"darklrd","email":"darklrd@gmail.com"},"repository":{"url":"git+https://github.com/darklrd/x402-toolkit.git","type":"git","directory":"packages/x402-agent-client"},"_npmVersion":"10.9.4","description":"Client library that auto-handles HTTP 402 payment challenges","directories":{},"_nodeVersion":"22.22.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"openai":"^4.104.0","rimraf":"^5.0.10","typescript":"^5.5.4","@types/node":"^20.14.0"},"peerDependencies":{"openai":"^4.80.0"},"peerDependenciesMeta":{"openai":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/x402-agent-client_0.1.0_1773509353354_0.6070440777844452","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@darklrd/x402-agent-client","version":"0.1.1","keywords":["x402","http-402","payment","ai-agent","client","micropayment"],"author":{"name":"Shashwat Srivastava","email":"shashwat@iflychat.com"},"license":"MIT","_id":"@darklrd/x402-agent-client@0.1.1","maintainers":[{"name":"darklrd","email":"darklrd@gmail.com"}],"homepage":"https://github.com/darklrd/x402-toolkit#readme","bugs":{"url":"https://github.com/darklrd/x402-toolkit/issues"},"dist":{"shasum":"fb45a471b2a8c321d010846905b333e4afff1648","tarball":"https://registry.npmjs.org/@darklrd/x402-agent-client/-/x402-agent-client-0.1.1.tgz","fileCount":22,"integrity":"sha512-YR5BsswKS0xYDfrnkf5apmE76LSsTIWqyQ3SlhEEP0hbMQDAIi0ZaJpdD1LAB2flidB9r/+zAdHTJ4i+A8Rumw==","signatures":[{"sig":"MEUCIBWlT1rjwgtBp6jfJYZei/MGuyQuvczRHVuFoykboNJyAiEAjJFKw/mba3Lw9HWtuOStZBgM/LzP6dUB/L+S79JMBE4=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":26259},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"6d54d14d3bfef48ca18828696b4db9c10ea40fca","scripts":{"build":"tsc -p tsconfig.json","clean":"rimraf dist *.tsbuildinfo","typecheck":"tsc --noEmit"},"_npmUser":{"name":"darklrd","email":"darklrd@gmail.com"},"repository":{"url":"git+https://github.com/darklrd/x402-toolkit.git","type":"git","directory":"packages/x402-agent-client"},"_npmVersion":"10.9.4","description":"Client library that auto-handles HTTP 402 payment challenges","directories":{},"_nodeVersion":"22.22.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"openai":"^4.104.0","rimraf":"^5.0.10","typescript":"^5.5.4","@types/node":"^20.14.0"},"peerDependencies":{"openai":"^4.80.0"},"peerDependenciesMeta":{"openai":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/x402-agent-client_0.1.1_1773509882318_0.1184639794879987","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"name":"@darklrd/x402-agent-client","version":"0.1.2","description":"Client library that auto-handles HTTP 402 payment challenges","license":"MIT","type":"module","main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"import":"./dist/index.js","types":"./dist/index.d.ts"}},"scripts":{"build":"tsc -p tsconfig.json","clean":"rimraf dist *.tsbuildinfo","typecheck":"tsc --noEmit"},"peerDependencies":{"openai":"^4.80.0"},"peerDependenciesMeta":{"openai":{"optional":true}},"devDependencies":{"@types/node":"^20.14.0","openai":"^4.104.0","rimraf":"^5.0.10","typescript":"^5.5.4"},"author":{"name":"Shashwat Srivastava","email":"shashwat@iflychat.com"},"repository":{"type":"git","url":"git+https://github.com/darklrd/x402-toolkit.git","directory":"packages/x402-agent-client"},"homepage":"https://github.com/darklrd/x402-toolkit#readme","bugs":{"url":"https://github.com/darklrd/x402-toolkit/issues"},"publishConfig":{"access":"public"},"keywords":["x402","http-402","payment","ai-agent","client","micropayment"],"_id":"@darklrd/x402-agent-client@0.1.2","gitHead":"64d92d09bf3fd02720f94a10eba64cfa3c2098bd","_nodeVersion":"22.22.0","_npmVersion":"10.9.4","dist":{"integrity":"sha512-xqAfP0eHvbAH447mGvOzZlAbmhhJgaSpKY14retHze/ecaSS2kn1ygcJuObVbQdrnUdK7dZoF5NFCfNdyz6M5A==","shasum":"9e3d59e734507bb5745b5e3e9a0a196d08fc97d5","tarball":"https://registry.npmjs.org/@darklrd/x402-agent-client/-/x402-agent-client-0.1.2.tgz","fileCount":22,"unpackedSize":26259,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIEFPExBvxpYuWfksfB/J0cHEqNT2Nu0P/yFh0wtzG/6OAiEAl4uC1Spk9x/YW6ZlJwVZE/SCA3nG3NUFwkmuG+vy3tY="}]},"_npmUser":{"name":"darklrd","email":"darklrd@gmail.com"},"directories":{},"maintainers":[{"name":"darklrd","email":"darklrd@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/x402-agent-client_0.1.2_1773592540461_0.5452321782896592"},"_hasShrinkwrap":false}},"time":{"created":"2026-03-14T17:29:13.291Z","modified":"2026-03-15T16:35:40.771Z","0.1.0":"2026-03-14T17:29:13.504Z","0.1.1":"2026-03-14T17:38:02.450Z","0.1.2":"2026-03-15T16:35:40.645Z"},"bugs":{"url":"https://github.com/darklrd/x402-toolkit/issues"},"author":{"name":"Shashwat Srivastava","email":"shashwat@iflychat.com"},"license":"MIT","homepage":"https://github.com/darklrd/x402-toolkit#readme","keywords":["x402","http-402","payment","ai-agent","client","micropayment"],"repository":{"type":"git","url":"git+https://github.com/darklrd/x402-toolkit.git","directory":"packages/x402-agent-client"},"description":"Client library that auto-handles HTTP 402 payment challenges","maintainers":[{"name":"darklrd","email":"darklrd@gmail.com"}],"readme":"# @darklrd/x402-agent-client\n\nClient library that auto-handles HTTP 402 payment challenges. Your AI agent makes a normal `fetch` call — the client intercepts 402 responses, pays via Solana USDC, and retries transparently.\n\n## Install\n\n```bash\npnpm add @darklrd/x402-agent-client x402-adapters\n```\n\n## Quick Start\n\n### x402Fetch (drop-in fetch replacement)\n\n```ts\nimport { x402Fetch } from '@darklrd/x402-agent-client';\nimport { MockPayer } from 'x402-adapters';\n\nconst payer = new MockPayer();\nconst res = await x402Fetch('http://api.example.com/weather?city=London', { payer });\nconst data = await res.json();\n```\n\n### createTool (structured tool wrapper)\n\n```ts\nimport { createTool } from '@darklrd/x402-agent-client';\nimport { MockPayer } from 'x402-adapters';\n\nconst tool = createTool({\n  name: 'weather',\n  url: 'http://api.example.com/weather',\n  method: 'GET',\n  payer: new MockPayer(),\n});\n\nconst result = await tool.invoke({ city: 'London' });\n```\n\n### OpenAI Function Calling\n\n```ts\nimport { toOpenAITools, executeToolCall } from '@darklrd/x402-agent-client';\n\nconst tools = toOpenAITools(myToolDefinitions);\n// Pass to OpenAI chat completion, then:\nconst result = await executeToolCall(toolCall, myToolDefinitions);\n```\n\n## Features\n\n- Drop-in `fetch` replacement with automatic 402 handling\n- Structured tool wrapper for agent frameworks\n- OpenAI function calling adapter\n- Pluggable payer interface (mock or real Solana USDC)\n\n## Links\n\n- [GitHub](https://github.com/darklrd/x402-toolkit)\n- [Playground](https://darklrd.github.io/x402-toolkit/)\n- [x402 Protocol](https://x402.org)\n","readmeFilename":"README.md"}