{"_id":"@08byte/sdk","_rev":"3-66a24ca5c04787021254a23ab5ce19ea","name":"@08byte/sdk","dist-tags":{"latest":"0.1.2"},"versions":{"0.1.0":{"name":"@08byte/sdk","version":"0.1.0","keywords":["08byte","web-scraping","llm","ai-agent","token-compression","x402"],"license":"MIT","_id":"@08byte/sdk@0.1.0","maintainers":[{"name":"08byte","email":"huybt2012@gmail.com"}],"homepage":"https://github.com/Sec1702/08byte#readme","bugs":{"url":"https://github.com/Sec1702/08byte/issues"},"dist":{"shasum":"fc0d605099c504a03717c8a5015e7890dde713fb","tarball":"https://registry.npmjs.org/@08byte/sdk/-/sdk-0.1.0.tgz","fileCount":10,"integrity":"sha512-Pyvai3uKmSQCwg3aoDV4p2Oi5me9wsSktMqTVYgND50fVMHwEBGAGWZ7GfQr+rNX26KRX4JkHDDbcQQUQW6M5w==","signatures":[{"sig":"MEUCIHh+q6T5RGkWbRRmzFXO7GRruq2LmggvfqxKN80DakTZAiEA7zLIIKtmxhZ16QDqYc0SRSVUmOpWifLejU/0ZYPyFaA=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":12577},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"7c939fa41363a45f399eab2c186fc83bf702dd9a","scripts":{"build":"tsc -p tsconfig.json","typecheck":"tsc -p tsconfig.json --noEmit"},"_npmUser":{"name":"08byte","email":"huybt2012@gmail.com"},"repository":{"url":"git+https://github.com/Sec1702/08byte.git","type":"git","directory":"packages/sdk-ts"},"_npmVersion":"11.19.0","description":"Official TypeScript/JavaScript SDK for the 08byte Edge Data Parser & Token Compression API.","directories":{},"_nodeVersion":"26.7.0","_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.6.0","@types/node":"^20.0.0"},"_npmOperationalInternal":{"tmp":"tmp/sdk_0.1.0_1787321812630_0.7781411586812144","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@08byte/sdk","version":"0.1.1","keywords":["08byte","web-scraping","llm","ai-agent","token-compression","x402"],"license":"MIT","_id":"@08byte/sdk@0.1.1","maintainers":[{"name":"08byte","email":"huybt2012@gmail.com"}],"homepage":"https://github.com/Sec1702/08byte#readme","bugs":{"url":"https://github.com/Sec1702/08byte/issues"},"dist":{"shasum":"ef0fb9a59071e089f09de9d68ef1d7525d6e4fb9","tarball":"https://registry.npmjs.org/@08byte/sdk/-/sdk-0.1.1.tgz","fileCount":10,"integrity":"sha512-V73ezCbti8P4ILyT28Xq4mTCxkmqWT5oKsmmLIjzN9SH+GuG9O6Wid1j7e6DgjKIl1Efgg4mXk4XZyOPJDfGaA==","signatures":[{"sig":"MEUCIQDsseihkb5QoP8oCum1AEnYglRHScc77ExFM4aJFTjbvwIgNDV0FyU7+s+Cuk1mlYWMvQ0E1VGx62yJE6vDMo820ck=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":14855},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"gitHead":"e9a591630d2294aaeaa7fae3f036a53d1639cd7b","scripts":{"build":"tsc -p tsconfig.json","typecheck":"tsc -p tsconfig.json --noEmit"},"_npmUser":{"name":"08byte","email":"huybt2012@gmail.com"},"repository":{"url":"git+https://github.com/Sec1702/08byte.git","type":"git","directory":"packages/sdk-ts"},"_npmVersion":"11.19.0","description":"Official TypeScript/JavaScript SDK for the 08byte Edge Data Parser & Token Compression API.","directories":{},"_nodeVersion":"26.7.0","_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.6.0","@types/node":"^20.0.0"},"_npmOperationalInternal":{"tmp":"tmp/sdk_0.1.1_1787385400742_0.676176341017531","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"name":"@08byte/sdk","version":"0.1.2","description":"Official TypeScript/JavaScript SDK for the 08byte Edge Data Parser & Token Compression API.","type":"module","main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"build":"tsc -p tsconfig.json","typecheck":"tsc -p tsconfig.json --noEmit"},"keywords":["08byte","web-scraping","llm","ai-agent","token-compression","x402"],"license":"MIT","repository":{"type":"git","url":"git+https://github.com/Sec1702/08byte.git","directory":"packages/sdk-ts"},"devDependencies":{"typescript":"^5.6.0","@types/node":"^20.0.0"},"engines":{"node":">=18"},"gitHead":"3f6de7a873f6b58e53e74789a86c9b8b1568d6c2","_id":"@08byte/sdk@0.1.2","bugs":{"url":"https://github.com/Sec1702/08byte/issues"},"homepage":"https://github.com/Sec1702/08byte#readme","_nodeVersion":"26.7.0","_npmVersion":"11.19.0","dist":{"integrity":"sha512-LzY6oUzzIu+SUifB+za3XvxazI0z9tRY2H6mVfUVB4S7ytCnerlaVsQ+1P57UspJdl8keSdtBmKg69uB7/jbPg==","shasum":"dcd7c814c3c51d12c112b8a232111496102c13f1","tarball":"https://registry.npmjs.org/@08byte/sdk/-/sdk-0.1.2.tgz","fileCount":10,"unpackedSize":15811,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCEzGw48grhVrDLq0HRSnwAyI4T8IF6ecNoOeByBYZPkgIhAJbmBm1wyAZLfA18jfevf4RRtDXWyyn8Eoi/w1zqC6CP"}]},"_npmUser":{"name":"08byte","email":"huybt2012@gmail.com"},"directories":{},"maintainers":[{"name":"08byte","email":"huybt2012@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/sdk_0.1.2_1787395183242_0.9506091937454155"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-21T14:16:52.498Z","modified":"2026-08-22T10:39:43.550Z","0.1.0":"2026-08-21T14:16:52.783Z","0.1.1":"2026-08-22T07:56:40.877Z","0.1.2":"2026-08-22T10:39:43.383Z"},"bugs":{"url":"https://github.com/Sec1702/08byte/issues"},"license":"MIT","homepage":"https://github.com/Sec1702/08byte#readme","keywords":["08byte","web-scraping","llm","ai-agent","token-compression","x402"],"repository":{"type":"git","url":"git+https://github.com/Sec1702/08byte.git","directory":"packages/sdk-ts"},"description":"Official TypeScript/JavaScript SDK for the 08byte Edge Data Parser & Token Compression API.","maintainers":[{"name":"08byte","email":"huybt2012@gmail.com"}],"readme":"# @08byte/sdk\n\nOfficial TypeScript / JavaScript SDK for the [08byte](https://08byte.com) Edge Data Parser & Token Compression API.\n\n```bash\nnpm install @08byte/sdk\n```\n\n## Usage\n\n```ts\nimport { Zero8Byte } from \"@08byte/sdk\";\n\nconst client = new Zero8Byte({ apiKey: process.env.ZERO8BYTE_API_KEY! });\n\n// Mode-preset extraction\nconst news = await client.parse(\"https://techcrunch.com/article-url\", { mode: \"news\" });\nconsole.log(news.data.headline, news.data.what_happened);\n\n// Custom schema extraction\nconst product = await client.extract(\"https://example.com/product/123\", {\n  schema: {\n    properties: {\n      title: { type: \"string\" },\n      price: { type: \"number\" },\n      in_stock: { type: \"boolean\" },\n      features: { type: \"array\" },\n    },\n    required: [\"title\", \"price\"],\n  },\n});\n\n// Batch parsing (up to 50 URLs per call)\nconst batch = await client.batchParseAndWait({\n  urls: [\"https://a.example.com\", \"https://b.example.com\"],\n  mode: \"product\",\n});\nconsole.log(batch.status, batch.results);\n\n// Or fire-and-forget with a webhook instead of polling:\nconst accepted = await client.batchParse({\n  urls: [\"https://a.example.com\", \"https://b.example.com\"],\n  webhookUrl: \"https://your-server.com/webhooks/08byte\",\n  webhookSecret: \"whsec_your_own_secret\",\n});\n```\n\n## Machine-to-Machine x402 Micropayments (Base USDC)\n\nFor autonomous agents and developers who want pay-per-call access without pre-funding an API key:\n\n```ts\nimport { Zero8Byte, type X402Challenge } from \"@08byte/sdk\";\n\n// Option A: Pre-signed X-PAYMENT header\nconst client = new Zero8Byte({\n  x402Payment: \"eyJ4NDAyVmVyc2lvbiI6MSwic2NoZW1lIjoiZXhhY3QiLC...\",\n});\nconst res = await client.parse(\"https://en.wikipedia.org/wiki/Artificial_intelligence\");\n\n// Option B: Dynamic auto-signing callback for 402 challenges\nconst agentClient = new Zero8Byte({\n  signPayment: async (challenge: X402Challenge) => {\n    // Sign the payment challenge using your wallet (e.g. viem, ethers)\n    // and return the Base64-encoded payment string\n    return signWithEVMWallet(challenge);\n  },\n});\nconst data = await agentClient.parse(\"https://news.ycombinator.com\");\n```\n\n## Verifying inbound batch webhooks\n\n```ts\nimport { verifyWebhookSignature } from \"@08byte/sdk\";\n\n// req.rawBody MUST be the exact bytes received — not a re-serialized\n// JSON.parse(...) round-trip — or the signature will never match.\nconst valid = verifyWebhookSignature(\n  req.rawBody,\n  req.headers[\"x-08byte-signature\"],\n  process.env.ZERO8BYTE_WEBHOOK_SECRET!\n);\n```\n\n## Error handling\n\nEvery non-2xx response throws `Zero8ByteError` (`.status`, `.code`, `.message`):\n\n```ts\nimport { Zero8ByteError } from \"@08byte/sdk\";\n\ntry {\n  await client.parse(\"http://169.254.169.254/\");\n} catch (err) {\n  if (err instanceof Zero8ByteError) {\n    console.log(err.status, err.code); // 422 \"INVALID_URL\"\n  }\n}\n```\n\n## Requirements\n\nNode.js >= 18 (needs global `fetch` and `node:crypto`'s `timingSafeEqual`).\n","readmeFilename":"README.md"}