{"_id":"@alchemystai/aisdk","_rev":"6-8f2d869a363a231e0e247c96b988b749","name":"@alchemystai/aisdk","dist-tags":{"latest":"0.0.5"},"versions":{"0.0.1-alpha":{"name":"@alchemystai/aisdk","version":"0.0.1-alpha","keywords":["genai","context engineering","rag","context","vercel","ai-sdk","aisdk"],"_id":"@alchemystai/aisdk@0.0.1-alpha","maintainers":[{"name":"anuran-roy","email":"anuranroy02@gmail.com"}],"homepage":"https://github.com/alchemyst-ai/aisdk#readme","bugs":{"url":"https://github.com/alchemyst-ai/aisdk/issues"},"dist":{"shasum":"97bfb9c37a5952c55122f66817be9386895ea719","tarball":"https://registry.npmjs.org/@alchemystai/aisdk/-/aisdk-0.0.1-alpha.tgz","fileCount":12,"integrity":"sha512-ZSfKD/QT9bA2QlP97YgentMUJPUbBVwvo1r2o305PSjBjYBC1OfKumO++okTjlhXObNzImiXoQxG/4nhrgYCEg==","signatures":[{"sig":"MEYCIQDaZWZZRh1Kf5vrGsOZqAQE2GsxAOy4ga2HNRQOXlOO9AIhAMept7w0TznFJ3ha9NMubMXMpbpjoI6kLUbOT2DsARMJ","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":129946},"type":"module","module":"index.ts","gitHead":"c680ac3abed5d0f71251fd5aff0f22d4a5e24b0c","_npmUser":{"name":"anuran-roy","email":"anuranroy02@gmail.com"},"repository":{"url":"git+https://github.com/alchemyst-ai/aisdk.git"},"_npmVersion":"11.5.1","description":"The Vercel AI SDK Integration for Alchemyst AI.","directories":{},"_nodeVersion":"24.7.0","dependencies":{"ai":"^5.0.60","zod":"^4.1.11","jest":"^30.2.0","biome":"^0.3.3","dotenv":"^17.2.3","@types/jest":"^30.0.0","@alchemystai/sdk":"^0.5.0"},"_hasShrinkwrap":false,"devDependencies":{"@types/bun":"latest"},"peerDependencies":{"typescript":"^5"},"_npmOperationalInternal":{"tmp":"tmp/aisdk_0.0.1-alpha_1759615546981_0.4049578073535298","host":"s3://npm-registry-packages-npm-production"}},"0.0.1-beta":{"name":"@alchemystai/aisdk","version":"0.0.1-beta","keywords":["genai","context engineering","rag","context","vercel","ai-sdk","aisdk"],"_id":"@alchemystai/aisdk@0.0.1-beta","maintainers":[{"name":"anuran-roy","email":"anuranroy02@gmail.com"}],"homepage":"https://github.com/alchemyst-ai/aisdk#readme","bugs":{"url":"https://github.com/alchemyst-ai/aisdk/issues"},"dist":{"shasum":"5b3f09658b2267a471d927997c31fec0e2ec6bd4","tarball":"https://registry.npmjs.org/@alchemystai/aisdk/-/aisdk-0.0.1-beta.tgz","fileCount":14,"integrity":"sha512-MlU+9FZtSVD2mbm4kRDSOKdDWSqbA/JAcVXts1hQHJJApNVpmOu3BzNTbaz+rr3PWYReMb6uc3rCt3mWGRtYHQ==","signatures":[{"sig":"MEQCIDVUQ2Q0kpIGC9sVHteZSYXNIhcU6jkrX+5flPEG7KjgAiBdVoQE9yZ17bX+HOu3PPsbMKk4/ez3TAoaY0JLBDylaw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":133632},"type":"module","module":"index.ts","gitHead":"eda722a9ec8a3ac77b47d9ddf3eba0738689a428","_npmUser":{"name":"anuran-roy","email":"anuranroy02@gmail.com"},"repository":{"url":"git+https://github.com/alchemyst-ai/aisdk.git"},"_npmVersion":"11.5.1","description":"The Vercel AI SDK Integration for Alchemyst AI.","directories":{},"_nodeVersion":"24.7.0","dependencies":{"ai":"^5.0.60","zod":"^4.1.11","jest":"^30.2.0","biome":"^0.3.3","dotenv":"^17.2.3","@types/jest":"^30.0.0","@alchemystai/sdk":"^0.5.0"},"_hasShrinkwrap":false,"devDependencies":{"@types/bun":"latest"},"peerDependencies":{"typescript":"^5"},"_npmOperationalInternal":{"tmp":"tmp/aisdk_0.0.1-beta_1759861248179_0.6762620366211276","host":"s3://npm-registry-packages-npm-production"}},"0.0.2":{"name":"@alchemystai/aisdk","version":"0.0.2","keywords":["genai","context engineering","rag","context","vercel","ai-sdk","aisdk"],"_id":"@alchemystai/aisdk@0.0.2","maintainers":[{"name":"anuran-roy","email":"anuranroy02@gmail.com"}],"homepage":"https://github.com/alchemyst-ai/aisdk#readme","bugs":{"url":"https://github.com/alchemyst-ai/aisdk/issues"},"dist":{"shasum":"16bb949db52eb7cc5fc4d31a9c07a283d22d1def","tarball":"https://registry.npmjs.org/@alchemystai/aisdk/-/aisdk-0.0.2.tgz","fileCount":14,"integrity":"sha512-7lz5nCsDS1W56iIxQpCrcwsEQd2ii9qNvio8/ppW4aNBWS826PgxyrR+cTWt4wJ8bWNPsL4jW8ZrXJN63IrwMg==","signatures":[{"sig":"MEUCIC1qhmk/Yl9Jvkzoc+kAWlMm5iSWSLIFCbmsRm00EuECAiEAx5V6jrcwL7rWmw4WAYLJ3dSbRCRwYSw5Sr+rZYRqlMg=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":136294},"type":"module","module":"index.ts","gitHead":"8518ed55b617e091c9adec280282bb6241eb601e","_npmUser":{"name":"anuran-roy","email":"anuranroy02@gmail.com"},"repository":{"url":"git+https://github.com/alchemyst-ai/aisdk.git"},"_npmVersion":"11.6.1","description":"The Vercel AI SDK Integration for Alchemyst AI.","directories":{},"_nodeVersion":"24.11.0","dependencies":{"ai":"^5.0.60","zod":"^4.1.11","jest":"^30.2.0","biome":"^0.3.3","dotenv":"^17.2.3","@types/jest":"^30.0.0","@alchemystai/sdk":"^0.7.0"},"_hasShrinkwrap":false,"devDependencies":{"@types/bun":"latest"},"peerDependencies":{"typescript":"^5"},"_npmOperationalInternal":{"tmp":"tmp/aisdk_0.0.2_1764866692622_0.4615212167019245","host":"s3://npm-registry-packages-npm-production"}},"0.0.3":{"name":"@alchemystai/aisdk","version":"0.0.3","keywords":["genai","context engineering","rag","context","vercel","ai-sdk","aisdk"],"_id":"@alchemystai/aisdk@0.0.3","maintainers":[{"name":"anuran-roy","email":"anuranroy02@gmail.com"}],"homepage":"https://github.com/alchemyst-ai/aisdk#readme","bugs":{"url":"https://github.com/alchemyst-ai/aisdk/issues"},"dist":{"shasum":"f95d96be5913b0795a025d9205d6ddbb98f0ca4b","tarball":"https://registry.npmjs.org/@alchemystai/aisdk/-/aisdk-0.0.3.tgz","fileCount":18,"integrity":"sha512-V4NBozu6Dbe83tlZlftG2s1B4WPOnxHqyR1+NHn0nUE+ckCmBef07Bc5MHwMEeCayU+zSFsiJD2R8YkYelo4KQ==","signatures":[{"sig":"MEQCIAzPul/WCkG0Q0bTWzrlEFFF2nN1zSyxkkmlISUpD/MxAiAXwqVHOa8kXt0HMG1E+3l2n3kn5p5oZa6lLU0U77OoqA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":214837},"type":"module","module":"index.ts","gitHead":"f4e5c53845c0b47c430d5a2e91811b7522ded245","_npmUser":{"name":"anuran-roy","email":"anuranroy02@gmail.com"},"repository":{"url":"git+https://github.com/alchemyst-ai/aisdk.git"},"_npmVersion":"11.6.1","description":"The Vercel AI SDK Integration for Alchemyst AI.","directories":{},"_nodeVersion":"24.11.0","dependencies":{"zod":"^3.23.8","jest":"^30.2.0","biome":"^0.3.3","dotenv":"^17.2.3","latest":"^0.2.0","@types/jest":"^30.0.0","@ai-sdk/google":"^3.0.8","@alchemystai/sdk":"^0.11.1"},"_hasShrinkwrap":false,"devDependencies":{"ai":"^6.0.0","@types/bun":"latest"},"peerDependencies":{"ai":"^5.0.0 || ^6.0.0","typescript":"^5"},"_npmOperationalInternal":{"tmp":"tmp/aisdk_0.0.3_1768480726646_0.12273694920053235","host":"s3://npm-registry-packages-npm-production"}},"0.0.4":{"name":"@alchemystai/aisdk","version":"0.0.4","keywords":["genai","context engineering","rag","context","vercel","ai-sdk","aisdk"],"_id":"@alchemystai/aisdk@0.0.4","maintainers":[{"name":"anuran-roy","email":"anuranroy02@gmail.com"}],"homepage":"https://github.com/alchemyst-ai/aisdk#readme","bugs":{"url":"https://github.com/alchemyst-ai/aisdk/issues"},"dist":{"shasum":"82589103f1f72db94f5b2ba01b23b713b0d2bc7b","tarball":"https://registry.npmjs.org/@alchemystai/aisdk/-/aisdk-0.0.4.tgz","fileCount":20,"integrity":"sha512-fvoN5+dyUdkj2HDzBKssTRexrzxZ9sJO6ku54Owmnz8MsftYFSzrVZ/7CqWzpzieo5FQvCRQKTYzKprUZFk3/w==","signatures":[{"sig":"MEQCIEV509P5M2e5Cuul/V3QZ53tusyDC9QEnD4gi1l+BtQIAiBJ5RQFJB2GEtZVCd7vk2VnTZZmcDk1xLCvVdwLYs9TnQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":231727},"type":"module","module":"index.ts","gitHead":"f0a1a2a72e2d20794599d95680fe2498c30ef5dc","_npmUser":{"name":"anuran-roy","email":"anuranroy02@gmail.com"},"repository":{"url":"git+https://github.com/alchemyst-ai/aisdk.git"},"_npmVersion":"11.6.1","description":"The Vercel AI SDK Integration for Alchemyst AI.","directories":{},"_nodeVersion":"24.11.0","dependencies":{"zod":"^3.23.8","jest":"^30.2.0","biome":"^0.3.3","dotenv":"^17.2.3","latest":"^0.2.0","@types/jest":"^30.0.0","@ai-sdk/google":"^3.0.8","@alchemystai/sdk":"^0.11.1"},"_hasShrinkwrap":false,"devDependencies":{"ai":"^6.0.0","@types/bun":"latest"},"peerDependencies":{"ai":"^5.0.0 || ^6.0.0","typescript":"^5"},"_npmOperationalInternal":{"tmp":"tmp/aisdk_0.0.4_1770816707904_0.911203209953013","host":"s3://npm-registry-packages-npm-production"}},"0.0.5":{"name":"@alchemystai/aisdk","description":"The Vercel AI SDK Integration for Alchemyst AI.","version":"0.0.5","module":"index.ts","type":"module","repository":{"url":"git+https://github.com/alchemyst-ai/aisdk.git"},"keywords":["genai","context engineering","rag","context","vercel","ai-sdk","aisdk"],"devDependencies":{"@types/bun":"latest","ai":"^6.0.79"},"peerDependencies":{"ai":"^5.0.0 || ^6.0.0","typescript":"^5"},"dependencies":{"@ai-sdk/google":"^3.0.8","@ai-sdk/openai":"^3.0.26","@alchemystai/sdk":"^0.11.1","@types/jest":"^30.0.0","biome":"^0.3.3","dotenv":"^17.2.3","jest":"^30.2.0","latest":"^0.2.0","zod":"^3.23.8"},"gitHead":"f4bace28029559a5404b5b6097ffc6958388aedb","_id":"@alchemystai/aisdk@0.0.5","bugs":{"url":"https://github.com/alchemyst-ai/aisdk/issues"},"homepage":"https://github.com/alchemyst-ai/aisdk#readme","_nodeVersion":"24.11.0","_npmVersion":"11.6.1","dist":{"integrity":"sha512-5S0RzsVM6XboclKF/dDSmkttKEDQQKfaNsU85Jjrhb7ONjN+4/7sk4Wvqo2UwjW0N5CkCauHhs397er2myL4Mg==","shasum":"265d3b134cfe960f789e9705ec9ebfa559122607","tarball":"https://registry.npmjs.org/@alchemystai/aisdk/-/aisdk-0.0.5.tgz","fileCount":21,"unpackedSize":241222,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCJRtG5X5RRrPdOusNgb/41XAFjuo8znYSw4EKmincqjwIgVndo3NfiHCoxxLCyq+ogjM2WddYtlTnxR81xVXYuQlc="}]},"_npmUser":{"name":"anuran-roy","email":"anuranroy02@gmail.com"},"directories":{},"maintainers":[{"name":"anuran-roy","email":"anuranroy02@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/aisdk_0.0.5_1771399153095_0.8330238000637857"},"_hasShrinkwrap":false}},"time":{"created":"2025-10-04T22:05:46.759Z","modified":"2026-02-18T07:19:13.439Z","0.0.1-alpha":"2025-10-04T22:05:47.171Z","0.0.1-beta":"2025-10-07T18:20:48.380Z","0.0.2":"2025-12-04T16:44:52.775Z","0.0.3":"2026-01-15T12:38:46.788Z","0.0.4":"2026-02-11T13:31:48.101Z","0.0.5":"2026-02-18T07:19:13.309Z"},"bugs":{"url":"https://github.com/alchemyst-ai/aisdk/issues"},"homepage":"https://github.com/alchemyst-ai/aisdk#readme","keywords":["genai","context engineering","rag","context","vercel","ai-sdk","aisdk"],"repository":{"url":"git+https://github.com/alchemyst-ai/aisdk.git"},"description":"The Vercel AI SDK Integration for Alchemyst AI.","maintainers":[{"name":"anuran-roy","email":"anuranroy02@gmail.com"}],"readme":"# Alchemyst AI — Vercel AI SDK Integration\n\n**Alchemyst AI** is the **context layer** for your LLM applications — it remembers, reasons, and injects contextual intelligence automatically into every call.\nThis package provides a seamless integration with [**Vercel's AI SDK**](https://ai-sdk.dev) to enhance your Gen-AI apps with **memory**, **retrieval**, and **context-aware toolchains** — all through a single line of configuration.\n\n---\n\n## 🚀 Installation\n\n```bash\nnpm install @alchemystai/aisdk\n# or\nyarn add @alchemystai/aisdk\n#or\npnpm add @alchemystai/aisdk\n# or\nbun add @alchemystai/aisdk\n\n```\n\n---\n\n## ⚡ Quick Start\n\nHere's how to plug Alchemyst AI into your `ai` SDK call using the `withAlchemyst` middleware:\n\n```typescript\nimport { google } from '@ai-sdk/google';\nimport { generateText } from 'ai';\nimport { withAlchemyst } from '@alchemystai/aisdk';\n\nconst generateTextWithMemory = withAlchemyst(generateText, {\n  source: \"my_app\", // optional\n  apiKey: \"YOUR_ALCHEMYST_API_KEY\", // optional, can be left if you have ALCHEMYST_AI_API_KEY\n  debug: true // optional, defaults to false\n});\n\nconst result = await generateTextWithMemory({\n  model: google(\"gemini-2.5-flash\"),\n  prompt: \"Remember that my name is Alice\",\n  userId: \"user-123\",\n  sessionId: \"session-abc\",\n});\n```\n\nThis automatically attaches the **Alchemyst Context Engine** to your model call — enabling persistent memory and context-aware generation across sessions.\n\n---\n\n## 🧩 API Reference\n\n### `withAlchemyst(fn, options)`\n\n| Parameter        | Type       | Default | Description                                         |\n| ---------------- | ---------- | ------- | --------------------------------------------------- |\n| `fn`             | `Function` | —       | The AI SDK function to wrap (e.g., `generateText`). |\n| `options.source` | `string`   | —       | Identifier for your application source.             |\n| `options.apiKey` | `string`   | —       | Your **Alchemyst AI API key**. Required.            |\n| `options.debug`  | `boolean`  | `false` | Enables debug logging.                              |\n\nThe wrapped function accepts additional parameters:\n\n| Parameter   | Type     | Description                                     |\n| ----------- | -------- | ----------------------------------------------- |\n| `userId`    | `string` | Unique identifier for the user.                 |\n| `sessionId` | `string` | Unique identifier for the conversation/session. |\n\nReturns the result from the wrapped AI SDK function.\n\n---\n\n## 🧠 What It Does\n\nOnce integrated, Alchemyst AI automatically:\n\n* Persists **context** across user sessions.\n* Augments prompts with **retrieved knowledge** from your Alchemyst AI workspace.\n* Supports **custom tool functions** for domain-specific reasoning.\n* Runs entirely **server-side** — no extra infrastructure required.\n\n---\n\n## 💡 Example: Contextual Chatbot\n\n```typescript\nimport { google } from '@ai-sdk/google';\nimport { generateText } from 'ai';\nimport { withAlchemyst } from '@alchemystai/aisdk';\n\nconst generateTextWithMemory = withAlchemyst(generateText, {\n  source: \"chatbot\",\n  apiKey: process.env.ALCHEMYST_API_KEY!,\n  debug: false\n});\n\nexport async function POST(req: Request) {\n  const { prompt, userId, sessionId } = await req.json();\n\n  const result = await generateTextWithMemory({\n    model: google(\"gemini-2.5-flash\"),\n    prompt,\n    userId,\n    sessionId,\n  });\n\n  return new Response(result.text);\n}\n```\n\nWith this, your AI app will:\n\n* Remember previous user messages (via Alchemyst context memory)\n* Retrieve relevant knowledge chunks\n* Enrich every prompt dynamically before sending it to the model\n\n---\n\n## 🔒 Environment Variables\n\nSet your API key in your environment:\n\n```bash\nALCHEMYST_API_KEY=sk-xxxxxx\n```\n\nThen reference it in your code as:\n\n```typescript\nconst generateTextWithMemory = withAlchemyst(generateText, {\n  source: \"my_app\",\n  apiKey: process.env.ALCHEMYST_API_KEY!,\n});\n```\n\n---\n\n## 🧰 Supported SDK Methods\n\nAlchemyst AI integrates with all Vercel AI SDK entry points:\n\n| SDK Function     | Supported | Notes                           |\n| ---------------- | --------- | ------------------------------- |\n| `streamText`     | ✅         | Real-time streaming generation  |\n| `generateText`   | ✅         | Synchronous generation          |\n| `streamObject`   | ✅         | Structured JSON output          |\n| `generateObject` | ✅         | Non-streaming structured output |\n\n---\n\n## 🧪 Example with Different Conversations\n\n```typescript\nimport { google } from '@ai-sdk/google';\nimport { generateText } from 'ai';\nimport { withAlchemyst } from '@alchemystai/aisdk';\n\nconst generateTextWithMemory = withAlchemyst(generateText, {\n  source: \"api_sdk_test\",\n  apiKey: \"YOUR_ALCHEMYST_API_KEY\",\n  debug: true\n});\n\n// First conversation\nconst result1 = await generateTextWithMemory({\n  model: google(\"gemini-2.5-flash\"),\n  prompt: \"What is the capital of France?\",\n  userId: \"12345\",\n  sessionId: \"test-convo-1\",\n});\n\n// Second conversation\nconst result2 = await generateTextWithMemory({\n  model: google(\"gemini-2.5-flash\"),\n  prompt: \"What is the capital of Germany?\",\n  userId: \"12345\",\n  sessionId: \"test-convo-2\",\n});\n```\n\n---\n\n## 📜 License\n\nMIT © 2025 [Alchemyst AI](https://getalchemystai.com)\n\n","readmeFilename":"README.md"}