{"_id":"@aifredo/sdk","_rev":"7-cdd4aa844054088d12df9aa79ac96c01","name":"@aifredo/sdk","dist-tags":{"latest":"1.0.4"},"versions":{"0.1.0":{"name":"@aifredo/sdk","version":"0.1.0","keywords":["aifredo","ai","chatbot","agent"],"author":{"name":"Pipe Labs LLC"},"license":"MIT","_id":"@aifredo/sdk@0.1.0","maintainers":[{"name":"mikaelolofsson","email":"mo@pipelabs.xyz"}],"dist":{"shasum":"ab0e40a17cefbb4fcf9dfa4b1820b98212628e94","tarball":"https://registry.npmjs.org/@aifredo/sdk/-/sdk-0.1.0.tgz","fileCount":7,"integrity":"sha512-Y5b1VdYFAwFdlaZhRVLUXxPIqQPTbL29pHUiKjlP6BztLZyn1AsinZ1rfnj2S7QojPjeZ4Wg+2n1upP1t0YWSA==","signatures":[{"sig":"MEUCIQD4w7kpIrb7HbcntTMwvvp+qKx+gsA9+KCRrfTrn+hIvQIgXRlRRL3wk/pDJ2Kjnf4PikY06Xz4ScNK/jArVCXdtrw=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":12538},"main":"dist/index.js","types":"dist/index.d.ts","gitHead":"f51e79d2b9266cb804345302345ef0a3ca5b3506","scripts":{"build":"tsc","prepublishOnly":"npm run build"},"_npmUser":{"name":"mikaelolofsson","email":"mo@pipelabs.xyz"},"_npmVersion":"11.6.2","description":"Embed AiFredo agents in your app — no platform UI required","directories":{},"_nodeVersion":"24.13.0","_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/sdk_0.1.0_1772861903116_0.4374646745934647","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@aifredo/sdk","version":"0.1.1","keywords":["aifredo","ai","chatbot","agent"],"author":{"name":"Pipe Labs LLC"},"license":"MIT","_id":"@aifredo/sdk@0.1.1","maintainers":[{"name":"mikaelolofsson","email":"mo@pipelabs.xyz"}],"dist":{"shasum":"f1f191f2c3630af13b4c85272c8f71e72de9f737","tarball":"https://registry.npmjs.org/@aifredo/sdk/-/sdk-0.1.1.tgz","fileCount":4,"integrity":"sha512-jjm7HNclj2dUrERRIwOt9Z2UtxPmAj0WFf00Pg/rMTF5yUqyOe9FEUhWTJ5QwfgnGcDCYTFD6I6Tk1csyHhfyA==","signatures":[{"sig":"MEUCIQDpHHcdGMo89OK8Ogmhbg9ChImLXT6NpewhGUxdVuKmvAIgN8IisbT/8tNIyEGnMp9HLd1FkdYLxbkiFSqnpa5g9is=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":9633},"main":"dist/index.js","types":"dist/index.d.ts","gitHead":"59fd1ebba647a97df0f3be0b7ca7a9ad7f534fe8","scripts":{"build":"tsc","validate":"node scripts/validate-e2e.js","prepublishOnly":"npm run build"},"_npmUser":{"name":"mikaelolofsson","email":"mo@pipelabs.xyz"},"_npmVersion":"11.6.2","description":"Embed AiFredo agents in your app — no platform UI required","directories":{},"_nodeVersion":"24.13.0","_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/sdk_0.1.1_1772888817737_0.3531309613791107","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"name":"@aifredo/sdk","version":"0.1.2","keywords":["aifredo","ai","chatbot","agent"],"author":{"name":"Pipe Labs LLC"},"license":"MIT","_id":"@aifredo/sdk@0.1.2","maintainers":[{"name":"mikaelolofsson","email":"mo@pipelabs.xyz"}],"dist":{"shasum":"864eb97aababc4147f1ec3745348e7ef62d6d669","tarball":"https://registry.npmjs.org/@aifredo/sdk/-/sdk-0.1.2.tgz","fileCount":4,"integrity":"sha512-/G/7VLuDGUgROsl7uxILNKtRLY2jc4W2JXyfbidzXMhQd6RuCMcNZguTDCJ90Pb3e06gIvJuyj1hjXmbcvqbWQ==","signatures":[{"sig":"MEYCIQCBaqEMo7sbpzG0qA20DiqfEBRxzVWjv5DX0iXnXITGcwIhALJe/NaM2BiyEmeuPqpWEA87D4PQfZAywKC1vCbm0rCv","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":10026},"main":"dist/index.js","types":"dist/index.d.ts","gitHead":"8b83ce5fda1f99d24344dda2761c8801c6164e46","scripts":{"build":"tsc","validate":"node scripts/validate-e2e.js","prepublishOnly":"npm run build"},"_npmUser":{"name":"mikaelolofsson","email":"mo@pipelabs.xyz"},"_npmVersion":"11.6.2","description":"Embed AiFredo agents in your app — no platform UI required","directories":{},"_nodeVersion":"24.13.0","_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/sdk_0.1.2_1772889247252_0.6482865112224376","host":"s3://npm-registry-packages-npm-production"}},"0.1.3":{"name":"@aifredo/sdk","version":"0.1.3","keywords":["aifredo","ai","chatbot","agent"],"author":{"name":"Pipe Labs LLC"},"license":"MIT","_id":"@aifredo/sdk@0.1.3","maintainers":[{"name":"mikaelolofsson","email":"mo@pipelabs.xyz"}],"dist":{"shasum":"98e016c5579a96b41a3945fb8ae22b768876f397","tarball":"https://registry.npmjs.org/@aifredo/sdk/-/sdk-0.1.3.tgz","fileCount":4,"integrity":"sha512-yik8xDuABzg26x1H458bgZ0wojIBbUFt9NfmiRxXQe7eL5UNQCWzgCDvUvgBv8ouMvaBOs58NCXT2Ly6FiypMw==","signatures":[{"sig":"MEQCICwGw2KFQd/6YMjPL78ayg/cqVFk6aRwBBcCe7krX2MHAiBuAAggZRwBXXHBSnKhJnT5O+HdNVzQJJYqJicZujVDgA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":10116},"main":"dist/index.js","types":"dist/index.d.ts","gitHead":"8916fb36b9eebfcdbf8c9cbba92036016edfa907","scripts":{"build":"tsc","validate":"node scripts/validate-e2e.js","prepublishOnly":"npm run build"},"_npmUser":{"name":"mikaelolofsson","email":"mo@pipelabs.xyz"},"_npmVersion":"11.6.2","description":"Embed AiFredo agents in your app — no platform UI required","directories":{},"_nodeVersion":"24.13.0","_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/sdk_0.1.3_1772889389456_0.47900147445535257","host":"s3://npm-registry-packages-npm-production"}},"0.1.4":{"name":"@aifredo/sdk","version":"0.1.4","keywords":["aifredo","ai","chatbot","agent"],"author":{"name":"Pipe Labs LLC"},"license":"MIT","_id":"@aifredo/sdk@0.1.4","maintainers":[{"name":"mikaelolofsson","email":"mo@pipelabs.xyz"}],"dist":{"shasum":"77af4f0e9ce218273892fb34dfd61bfac3a52ad5","tarball":"https://registry.npmjs.org/@aifredo/sdk/-/sdk-0.1.4.tgz","fileCount":4,"integrity":"sha512-iunlBeaVa9kGaK2UhVHrKrFtcI/YT4FKSwL7hDWkxIRjSC0N23AP7e5PC5kyU8A1SmouhVnaS1eIviuQTJPaPw==","signatures":[{"sig":"MEUCIFNcGSPmPIfeheUPvVwyHyL442apYxdvcgeXooQV1ppEAiEA1KXksuXxD4FvwwN7Dtd6EJOAvaMficY9YeXhIy+3ju8=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":10292},"main":"dist/index.js","types":"dist/index.d.ts","gitHead":"eb241fe6b26bf7276bb3a5c289b346648508dd67","scripts":{"build":"tsc","validate":"node scripts/validate-e2e.js","prepublishOnly":"npm run build"},"_npmUser":{"name":"mikaelolofsson","email":"mo@pipelabs.xyz"},"_npmVersion":"11.6.2","description":"Embed AiFredo agents in your app — no platform UI required","directories":{},"_nodeVersion":"24.13.0","_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/sdk_0.1.4_1772889696520_0.7475194602818434","host":"s3://npm-registry-packages-npm-production"}},"0.1.5":{"name":"@aifredo/sdk","version":"0.1.5","keywords":["aifredo","ai","chatbot","agent"],"author":{"name":"Pipe Labs LLC"},"license":"MIT","_id":"@aifredo/sdk@0.1.5","maintainers":[{"name":"mikaelolofsson","email":"mo@pipelabs.xyz"}],"homepage":"https://github.com/aifredoai/sdk#readme","bugs":{"url":"https://github.com/aifredoai/sdk/issues"},"dist":{"shasum":"86d275e91aed04505ededf1836137147d60900c5","tarball":"https://registry.npmjs.org/@aifredo/sdk/-/sdk-0.1.5.tgz","fileCount":4,"integrity":"sha512-6YNTKzOXONAiFqEpTdStHjZMGZFS5CoZz/wpSjaevMShI4jl1wYyiwjP4JgiY0OKp5G6vYEUcF8rHU/nCLwynA==","signatures":[{"sig":"MEUCID3zvUnRrjEmVMTzdmIcNu1pHFerGNQtmaEvZnHFYfLmAiEAgWXybtTpW8p8QwOPikc78PDUjGUffFxdYRZpYu4AcN4=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":11131},"main":"dist/index.js","types":"dist/index.d.ts","gitHead":"4d9c2ea134638fb15ae73d503988974f6fd70fb3","scripts":{"build":"tsc","validate":"node scripts/validate-e2e.js","prepublishOnly":"npm run build"},"_npmUser":{"name":"mikaelolofsson","email":"mo@pipelabs.xyz"},"repository":{"url":"git+https://github.com/aifredoai/sdk.git","type":"git"},"_npmVersion":"11.6.2","description":"Embed AiFredo agents in your app — no platform UI required","directories":{},"_nodeVersion":"24.13.0","_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.0.0"},"_npmOperationalInternal":{"tmp":"tmp/sdk_0.1.5_1772889976756_0.2620297348638325","host":"s3://npm-registry-packages-npm-production"}},"1.0.4":{"name":"@aifredo/sdk","version":"1.0.4","description":"Embed AiFredo agents in your app — no platform UI required","main":"dist/index.js","types":"dist/index.d.ts","scripts":{"build":"tsc","test":"vitest run","test:watch":"vitest","prepublishOnly":"npm run build","validate":"node scripts/validate-e2e.js"},"keywords":["aifredo","ai","chatbot","agent"],"author":{"name":"Pipe Labs LLC"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/aifredoai/sdk.git"},"homepage":"https://github.com/aifredoai/sdk#readme","bugs":{"url":"https://github.com/aifredoai/sdk/issues"},"devDependencies":{"typescript":"^5.0.0","vitest":"^2.0.0"},"gitHead":"fe4e2d2e29a5c5df0762332f102e781b1dfca8f7","_id":"@aifredo/sdk@1.0.4","_nodeVersion":"24.13.0","_npmVersion":"11.6.2","dist":{"integrity":"sha512-ug75ZgwMxpm31bi6BGFsm1yhol820JajHvvIBvsCLD2FMSEfzjtUySQNlUWSBmtcNLKbY8DX7bvAMzfZkiukZg==","shasum":"9491207eb6eca561737ef40f48d67e2e17c0f250","tarball":"https://registry.npmjs.org/@aifredo/sdk/-/sdk-1.0.4.tgz","fileCount":6,"unpackedSize":21940,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIFADmFWbnHQ7bC3+YMAznTjXXhKmf7qdgt23VI0Wh23KAiBbkUrDXSRpt3pzFUNW729UbgFTgn+sFfwEapED53Pgvg=="}]},"_npmUser":{"name":"mikaelolofsson","email":"mo@pipelabs.xyz"},"directories":{},"maintainers":[{"name":"mikaelolofsson","email":"mo@pipelabs.xyz"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/sdk_1.0.4_1772984904599_0.643109288363702"},"_hasShrinkwrap":false}},"time":{"created":"2026-03-07T05:38:23.053Z","modified":"2026-03-08T15:48:24.873Z","0.1.0":"2026-03-07T05:38:23.275Z","0.1.1":"2026-03-07T13:06:57.889Z","0.1.2":"2026-03-07T13:14:07.442Z","0.1.3":"2026-03-07T13:16:29.608Z","0.1.4":"2026-03-07T13:21:36.670Z","0.1.5":"2026-03-07T13:26:16.914Z","1.0.4":"2026-03-08T15:48:24.740Z"},"bugs":{"url":"https://github.com/aifredoai/sdk/issues"},"author":{"name":"Pipe Labs LLC"},"license":"MIT","homepage":"https://github.com/aifredoai/sdk#readme","keywords":["aifredo","ai","chatbot","agent"],"repository":{"type":"git","url":"git+https://github.com/aifredoai/sdk.git"},"description":"Embed AiFredo agents in your app — no platform UI required","maintainers":[{"name":"mikaelolofsson","email":"mo@pipelabs.xyz"}],"readme":"# AiFredo SDK\n\nEmbed AiFredo agents into your own applications — no AiFredo UI, full control over branding and data.\n\n**Target customers:** Businesses and developers who need white-label AI agents, data control for regulated industries, or deep integration into their own CRM, app, or internal tools.\n\n---\n\n## Installation\n\n```bash\nnpm install @aifredo/sdk\n```\n\nLock to a specific version for production: `npm install @aifredo/sdk@1.0.0`\n\n---\n\n## Quick Start\n\n```typescript\nimport { AiFredo } from '@aifredo/sdk'\n\nconst fredo = new AiFredo({\n  apiKey: 'your-api-key',\n  baseUrl: 'https://aifredo.chat',  // optional, for self-hosted\n})\n\nconst reply = await fredo.send('fredo-sdr', 'List my prospects')\nconsole.log(reply)\n```\n\n---\n\n## Creating your agent\n\nThe SDK *talks to* agents — it doesn't create them. Create your agent on the platform first:\n\n1. **Hosted:** Go to [aifredo.chat](https://aifredo.chat) → create or pick an agent\n2. **Self-hosted:** Deploy the platform on your infrastructure, create agents there\n3. Use the SDK with your agent's `botId` — same API either way\n\nYou can use existing agents (e.g. `fredo-sdr`) to try the SDK, or create your own and integrate it into your app.\n\n---\n\n## When do I pay?\n\n- **SDK:** Free and open source (MIT). Download and use it — no payment for the library itself.\n- **Platform usage:** Payment is for *usage* of hosted aifredo.chat (messages, API keys, private bots). Free tier: 5 messages per IP; add funds or subscribe for more.\n- **Self-hosted:** Run the platform on your own infra — no usage fees. Enterprise self-hosted may require a license (see [pricing](https://aifredoai.github.io/sdk/pricing.html)).\n\n---\n\n## API Key\n\nGet your key at [aifredo.chat/settings/keys](https://aifredo.chat/settings/keys). Required for private bots; omit for public bots (5 free messages per IP).\n\n---\n\n## Security\n\n**Never expose API keys in client-side code.** Use environment variables (`process.env.AIFREDO_API_KEY`) on the backend. See [SECURITY.md](./SECURITY.md) for guidance on key storage, widget embedding, and self-hosted deployment.\n\n---\n\n## API Reference\n\n### `new AiFredo({ apiKey, baseUrl?, debug? })`\n\n- **apiKey** (optional): API key for private bots. Use env vars on backend; never expose in client code.\n- **baseUrl** (optional): Base URL of the AiFredo API. Default: `https://aifredo.chat`\n- **debug** (optional): Set `true` to log requests (URL, status) to console for troubleshooting\n\n### `fredo.send(botId, message, sessionId?)`\n\nSends a message to an agent and returns the reply.\n\n- **botId**: Agent ID (e.g. `fredo-sdr`, `your-bot-slug`)\n- **message**: User message text\n- **sessionId** (optional): Session ID for conversation continuity\n\n**Returns:** `{ reply: string, messagesUsed?: number, freeRemaining?: number, limitReached?: boolean }`\n\n**Throws:** `LimitReachedError` when free limit is exceeded and no paid balance\n\n### `fredo.stream(botId, message, onChunk, sessionId?)`\n\nStreams the reply incrementally for a typing effect.\n\n- **botId**: Agent ID\n- **message**: User message text\n- **onChunk**: Callback `(text: string) => void` for each text chunk\n- **sessionId** (optional): Session ID for conversation continuity\n\n**Returns:** `Promise<SendResponse>` when stream completes\n\n### `fredo.health()`\n\nHealth check for uptime monitoring. Calls `GET {baseUrl}/health`. Returns `{ ok: true }` on success. Throws on 5xx or network failure.\n\n### `fredo.status(botId)`\n\nChecks message usage and limits for the current session.\n\n**Returns:** `{ messagesUsed, freeLimit, freeRemaining, isPaying, balance_cents? }`\n\n---\n\n## Self-Hosted\n\nPoint the SDK at your own AiFredo instance:\n\n```typescript\nconst fredo = new AiFredo({\n  apiKey: 'your-key',\n  baseUrl: 'https://your-aifredo-instance.com',\n})\n```\n\nSee [SELF_HOSTING.md](./SELF_HOSTING.md) for details and widget setup. [CONFIGURATION.md](./CONFIGURATION.md) documents the full config schema. [DEPLOYMENT.md](./DEPLOYMENT.md) covers Docker env injection for self-hosted docs.\n\n---\n\n## Examples\n\n```bash\n# Node: quick start (send)\nnode examples/quickstart.js\n\n# Node: streaming\nnode examples/stream.js\n\n# Node: error handling (LimitReachedError, etc.)\nnode examples/error-handling.js\n\n# Python (no SDK — raw API)\npython examples/python_example.py\n\n# curl\n./examples/curl.sh\n```\n\nSet `AIFREDO_API_KEY` for private bots. `AIFREDO_BOT_ID` defaults to `fredo-sdr`.\n\n**Widget (no npm):** Add a chat bubble to any site with one script tag. See `examples/browser-widget.html`.\n\n---\n\n## Troubleshooting\n\n| Issue | Fix |\n|-------|-----|\n| `Bot not found` | Check `botId` — use slug (e.g. `fredo-sdr`) or bot ID from dashboard |\n| `This agent is private` | Add `apiKey` and ensure your key has access to the bot |\n| `LimitReachedError` | Free limit (5 msg) exceeded — sign up and add funds, or use API key with balance |\n| `fetch failed` / CORS | Use API key (avoids cookie/session). For browser, ensure `baseUrl` allows your origin |\n| Self-hosted 404 | Verify platform is running, SPA fallback is configured (see SELF_HOSTING.md) |\n\n---\n\n## License\n\nMIT\n\n---\n\n## Links\n\n- [Get SDK](https://aifredoai.github.io/sdk/) — Install & run guide (GitHub Pages)\n- [AiFredo Platform](https://aifredo.chat)\n- [Platform Docs](https://aifredo.chat/docs)\n- [GitHub](https://github.com/aifredoai/sdk)\n- [npm](https://www.npmjs.com/package/@aifredo/sdk)\n- [Pipe Labs LLC](https://pipelabs.xyz)\n","readmeFilename":"README.md"}