{"_id":"@elliotpadfield/openclaw-x402","_rev":"2-018a956af7c6d318bf00543875b8b426","name":"@elliotpadfield/openclaw-x402","dist-tags":{"latest":"0.1.1"},"versions":{"0.1.0":{"name":"@elliotpadfield/openclaw-x402","version":"0.1.0","keywords":["openclaw","openclaw-plugin","x402","payments","coinbase","agent-tools"],"author":{"name":"Elliot Padfield"},"license":"Apache-2.0","_id":"@elliotpadfield/openclaw-x402@0.1.0","maintainers":[{"name":"elliotpadfield","email":"elliot@elliotpadfield.com"}],"homepage":"https://github.com/ElliotPadfield/openclaw-x402#readme","bugs":{"url":"https://github.com/ElliotPadfield/openclaw-x402/issues"},"dist":{"shasum":"70fa404bed7f32c4b1809c1dd8a62a6922120c6b","tarball":"https://registry.npmjs.org/@elliotpadfield/openclaw-x402/-/openclaw-x402-0.1.0.tgz","fileCount":22,"integrity":"sha512-Ko5Plxjhpf5OscU/HulH4LptsVWYOF+iWATJNFSU+JBWZj5HZMZWpXQHr764Zny7V1CKaxmGINeDjYc0RoiD7g==","signatures":[{"sig":"MEUCIExwQ5bSaAkrKuHRr2zvD57dVWWKAD0AI3b0GVfC9vKaAiEA7b64hC36Zhxg2fuOiZ1eHjknQmZjbI3ah5wDrVthMsk=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":73610},"main":"index.ts","type":"module","gitHead":"7b708e192741597a97ba90b9727d373c2ad4a90d","scripts":{"test":"node --import tsx --test test/**/*.test.ts","typecheck":"tsc --noEmit","smoke:public:unpaid":"node --import tsx scripts/smoke-public-unpaid.ts"},"_npmUser":{"name":"elliotpadfield","email":"elliot@elliotpadfield.com"},"openclaw":{"extensions":["./index.ts"]},"repository":{"url":"git+https://github.com/ElliotPadfield/openclaw-x402.git","type":"git"},"_npmVersion":"11.4.2","description":"OpenClaw plugin for discovering and calling x402-paid APIs","directories":{},"_nodeVersion":"22.15.1","dependencies":{"viem":"2.47.0","yaml":"2.8.2","@x402/evm":"2.6.0","@x402/svm":"2.6.0","@x402/core":"2.6.0","@scure/base":"2.0.0","@solana/kit":"6.1.0","@sinclair/typebox":"0.34.48"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"4.20.5","openclaw":"2026.3.2","typescript":"5.9.3","@types/node":"25.3.5"},"peerDependencies":{"openclaw":"*"},"_npmOperationalInternal":{"tmp":"tmp/openclaw-x402_0.1.0_1772918996211_0.8886959162292658","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@elliotpadfield/openclaw-x402","version":"0.1.1","description":"OpenClaw plugin for discovering and calling x402-paid APIs","license":"Apache-2.0","main":"index.ts","type":"module","author":{"name":"Elliot Padfield"},"homepage":"https://github.com/ElliotPadfield/openclaw-x402#readme","repository":{"type":"git","url":"git+https://github.com/ElliotPadfield/openclaw-x402.git"},"bugs":{"url":"https://github.com/ElliotPadfield/openclaw-x402/issues"},"keywords":["openclaw","openclaw-plugin","x402","payments","coinbase","agent-tools"],"scripts":{"typecheck":"tsc --noEmit","test":"node --import tsx --test test/**/*.test.ts","smoke:public:unpaid":"node --import tsx scripts/smoke-public-unpaid.ts"},"publishConfig":{"access":"public"},"dependencies":{"@scure/base":"2.0.0","@sinclair/typebox":"0.34.48","@solana/kit":"6.1.0","@x402/core":"2.6.0","@x402/evm":"2.6.0","@x402/svm":"2.6.0","viem":"2.47.0","yaml":"2.8.2"},"devDependencies":{"@types/node":"25.3.5","openclaw":"2026.3.2","tsx":"4.20.5","typescript":"5.9.3"},"peerDependencies":{"openclaw":"*"},"openclaw":{"extensions":["./index.ts"]},"_id":"@elliotpadfield/openclaw-x402@0.1.1","gitHead":"12110b363b17499c23065c9dec7fe20e87e87291","_nodeVersion":"22.15.1","_npmVersion":"11.4.2","dist":{"integrity":"sha512-0gOT4ojlFH1sh6GrXuZ4Skq8tz0KvtZrqyaYZZJwebd2uCLcxyCP2+AiZpR09Y4A4a+mJFv2mPN2SovT3FKNPA==","shasum":"81df47bb274d10236c1988f2a01dc04e47919aab","tarball":"https://registry.npmjs.org/@elliotpadfield/openclaw-x402/-/openclaw-x402-0.1.1.tgz","fileCount":22,"unpackedSize":73754,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIDRYjmDQJK8zevIgLkJ+18++VEX6x/+suWdj0X/K7ksVAiEA/kD9sJYMeQKqm0RDQ8zXDBT45nknlopMmK5EP21CsTY="}]},"_npmUser":{"name":"elliotpadfield","email":"elliot@elliotpadfield.com"},"directories":{},"maintainers":[{"name":"elliotpadfield","email":"elliot@elliotpadfield.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/openclaw-x402_0.1.1_1772919996475_0.37620992209119875"},"_hasShrinkwrap":false}},"time":{"created":"2026-03-07T21:29:56.144Z","modified":"2026-03-07T21:46:36.771Z","0.1.0":"2026-03-07T21:29:56.370Z","0.1.1":"2026-03-07T21:46:36.644Z"},"bugs":{"url":"https://github.com/ElliotPadfield/openclaw-x402/issues"},"author":{"name":"Elliot Padfield"},"license":"Apache-2.0","homepage":"https://github.com/ElliotPadfield/openclaw-x402#readme","keywords":["openclaw","openclaw-plugin","x402","payments","coinbase","agent-tools"],"repository":{"type":"git","url":"git+https://github.com/ElliotPadfield/openclaw-x402.git"},"description":"OpenClaw plugin for discovering and calling x402-paid APIs","maintainers":[{"name":"elliotpadfield","email":"elliot@elliotpadfield.com"}],"readme":"# @elliotpadfield/openclaw-x402\n\nInstallable OpenClaw plugin for discovering and calling `x402`-paid HTTP APIs.\n\nThis plugin fits the existing OpenClaw ecosystem:\n\n- install it as a standard OpenClaw plugin\n- let the agent use `x402_fetch` for payable HTTP calls\n- use `x402_openapi_import` to inspect OpenAPI specs and save local API indexes\n- use `x402_api_search` to search configured x402 services and imported APIs\n- optionally bundle planner guidance via the included `x402` skill\n\nIt does not rewrite every other plugin's HTTP stack. It makes x402 work through\nits own tools without needing OpenClaw core changes.\n\n## Status\n\nAlpha.\n\nWhat is already proven:\n\n- loads as an OpenClaw plugin\n- registers tools correctly\n- handles `402 -> sign -> retry` with Coinbase's x402 libraries\n- works against a real public x402 endpoint\n\nWhat is not fully proven yet:\n\n- end-to-end settlement with a funded wallet against multiple public services\n- automatic generation of first-class OpenClaw tools from imported OpenAPI specs\n\n## Ecosystem Shape\n\nThis package is structured to match how current OpenClaw plugins are distributed:\n\n- published to npm\n- installable with `openclaw plugins install <npm-spec>`\n- public source repo with docs and issue tracker\n- package metadata compatible with OpenClaw's plugin loader\n\nThat matches the current OpenClaw community plugin guidance and the shape used by\npublished packages like `@openclaw/voice-call` and `@icesword760/openclaw-wechat`.\n\n## Install\n\nFrom npm:\n\n```bash\nopenclaw plugins install @elliotpadfield/openclaw-x402\n```\n\nFrom a local tarball while developing:\n\n```bash\nnpm pack\nopenclaw plugins install ./openclaw-x402-0.1.1.tgz\n```\n\nInstalled plugins are enabled by default. You can verify load status with:\n\n```bash\nopenclaw plugins list\nopenclaw plugins info openclaw-x402\n```\n\n## Setup\n\nOpenClaw plugin config belongs under `plugins.entries.openclaw-x402.config`.\n\nMinimal example:\n\n```json\n{\n  \"plugins\": {\n    \"entries\": {\n      \"openclaw-x402\": {\n        \"enabled\": true,\n        \"config\": {\n          \"defaultBudgetUsd\": 5,\n          \"approvalThresholdUsd\": 0.25,\n          \"allowedNetworks\": [\"eip155:8453\", \"eip155:84532\"],\n          \"allowedDomains\": [\"api.example.com\", \"*.x402.org\"]\n        }\n      }\n    }\n  }\n}\n```\n\nYou can also set it through the CLI:\n\n```bash\nopenclaw config set plugins.entries.openclaw-x402.enabled true --json\nopenclaw config set plugins.entries.openclaw-x402.config.defaultBudgetUsd 5 --json\nopenclaw config set plugins.entries.openclaw-x402.config.approvalThresholdUsd 0.25 --json\nopenclaw config set plugins.entries.openclaw-x402.config.allowedNetworks '[\"eip155:8453\"]' --json\n```\n\nSigner env vars:\n\n```bash\nexport OPENCLAW_X402_EVM_PRIVATE_KEY=0x...\nexport OPENCLAW_X402_SVM_PRIVATE_KEY=...\n```\n\nIf you want custom env var names:\n\n```json\n{\n  \"plugins\": {\n    \"entries\": {\n      \"openclaw-x402\": {\n        \"enabled\": true,\n        \"config\": {\n          \"evmPrivateKeyEnv\": \"MY_X402_EVM_KEY\",\n          \"svmPrivateKeyEnv\": \"MY_X402_SVM_KEY\"\n        }\n      }\n    }\n  }\n}\n```\n\nRestart the Gateway after config changes.\n\n## Configuration\n\nSupported config fields:\n\n- `stateDir`: override the default state directory\n- `evmPrivateKeyEnv`: env var name used for the EVM signer\n- `svmPrivateKeyEnv`: env var name used for the SVM signer\n- `defaultBudgetUsd`: hard budget for cumulative spend\n- `approvalThresholdUsd`: requests above this are blocked\n- `allowUnknownAssets`: allow payment requirements without a usable USD estimate\n- `allowPrivateHosts`: allow `localhost` and private network targets\n- `maxResponseBytes`: response body cap\n- `defaultTimeoutMs`: default request timeout\n- `allowedDomains`: outbound domain allowlist\n- `allowedNetworks`: x402 network allowlist\n- `allowedPayees`: payee allowlist\n- `registry`: static list of known x402 services for `x402_api_search`\n\nExample registry entry:\n\n```json\n{\n  \"plugins\": {\n    \"entries\": {\n      \"openclaw-x402\": {\n        \"enabled\": true,\n        \"config\": {\n          \"registry\": [\n            {\n              \"id\": \"spraay\",\n              \"name\": \"Spraay Gateway\",\n              \"baseUrl\": \"https://gateway.spraay.app\",\n              \"docsUrl\": \"https://github.com/plagtech/spraay-x402-gateway\",\n              \"description\": \"Public x402 gateway\",\n              \"tags\": [\"ai\", \"gateway\", \"search\"]\n            }\n          ]\n        }\n      }\n    }\n  }\n}\n```\n\nSee [.env.example](./.env.example) for a starter env file.\n\n## Tools\n\n### `x402_fetch`\n\nCalls an arbitrary HTTP endpoint. If the endpoint returns `402 Payment Required`\nand policy allows it, the plugin signs the payment payload with Coinbase's x402\nSDKs, retries the request, and stores a receipt.\n\nPayment status is explicit:\n\n- `payment.attempted: false`: no x402 flow happened\n- `payment.attempted: true` and `payment.paid: false`: retry happened, but the remote service still rejected payment\n- `payment.attempted: true` and `payment.paid: true`: payment retry succeeded\n\n### `x402_openapi_import`\n\nFetches or parses an OpenAPI document, summarizes operations, and optionally\nsaves an import snapshot into the plugin state directory.\n\n### `x402_api_search`\n\nSearches configured registry entries plus locally saved imports.\n\n## External Smoke Test\n\nAs of March 7, 2026, this public endpoint returns a real x402 `402 Payment Required`\nresponse when called without a valid funded signer:\n\n- `https://gateway.spraay.app/api/v1/models`\n\nRaw curl check:\n\n```bash\ncurl -i https://gateway.spraay.app/api/v1/models\n```\n\nExpected result:\n\n- HTTP `402`\n- a `PAYMENT-REQUIRED` header\n\nPlugin behavior with a throwaway unfunded EVM key:\n\n- the plugin reaches the public endpoint\n- parses the x402 requirement\n- signs and retries\n- the server rejects with `402 insufficient_funds`\n- the plugin returns `payment.attempted: true` and `payment.paid: false`\n\nThis is a safe public smoke test because no funded wallet is required.\n\n## State\n\nBy default the plugin stores state under:\n\n```text\n<workspace>/.openclaw-x402/\n```\n\nThis includes:\n\n- `receipts.jsonl`\n- `imports/*.json`\n\n## Development\n\n```bash\nnpm install\nnpm run typecheck\nnpm test\nnpm pack --dry-run\n```\n\nSee [CONTRIBUTING.md](./CONTRIBUTING.md) for local install and smoke-test steps.\n\n## License\n\nApache-2.0. See [LICENSE](./LICENSE).\n","readmeFilename":"README.md"}