{"_id":"@allem-sdk/ai","_rev":"4-b9ae405bcf80810e949a54c3a0706525","name":"@allem-sdk/ai","dist-tags":{"latest":"0.1.3"},"versions":{"0.1.0":{"name":"@allem-sdk/ai","version":"0.1.0","keywords":["allem-sdk","ai","react","hooks","useChat","useAgent","vercel-ai-sdk","llm"],"author":{"name":"Ahmed Allem"},"license":"MIT","_id":"@allem-sdk/ai@0.1.0","maintainers":[{"name":"kingofmit","email":"allem.ahmed@gmail.com"}],"homepage":"https://github.com/kingofmit/allem-sdk#readme","bugs":{"url":"https://github.com/kingofmit/allem-sdk/issues"},"dist":{"shasum":"d6f51be5ca0559295cbfa94d5e4bd9b0aa9c3ece","tarball":"https://registry.npmjs.org/@allem-sdk/ai/-/ai-0.1.0.tgz","fileCount":16,"integrity":"sha512-9DHGcdHXOmQAawPP3Jj2Ks2u2dHdmzlRXG+UdUewDcx0e0wSFQImxdQbzGSLUhHR95BA2tc4645EJWBpEA6DeQ==","signatures":[{"sig":"MEQCICFAOAWR+Msa/wv4AxeFienleeuGSLrLgeqKSX95PNH/AiBiQKWFJLNXciNgrLIrUii7wtaLyOgWdje6XW+yg32/Lg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":40785},"main":"./dist/index.js","_from":"file:allem-sdk-ai-0.1.0.tgz","types":"./dist/index.d.ts","module":"./dist/index.mjs","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"},"./client":{"types":"./dist/client.d.ts","import":"./dist/client.mjs","require":"./dist/client.js"},"./server":{"types":"./dist/server.d.ts","import":"./dist/server.mjs","require":"./dist/server.js"}},"scripts":{"dev":"tsup --watch","test":"vitest run","build":"tsup","clean":"rm -rf dist"},"_npmUser":{"name":"kingofmit","email":"allem.ahmed@gmail.com"},"_resolved":"/private/var/folders/4v/rph2hgm54rqf12vzbjxpn5kc0000gn/T/108ae4c8c86697f45cd13cce08b91d9d/allem-sdk-ai-0.1.0.tgz","_integrity":"sha512-9DHGcdHXOmQAawPP3Jj2Ks2u2dHdmzlRXG+UdUewDcx0e0wSFQImxdQbzGSLUhHR95BA2tc4645EJWBpEA6DeQ==","repository":{"url":"git+https://github.com/kingofmit/allem-sdk.git","type":"git","directory":"packages/ai"},"_npmVersion":"11.12.1","description":"AI hooks for React — useChat, useAgent, useStreaming. Built on Vercel AI SDK.","directories":{},"sideEffects":false,"_nodeVersion":"26.0.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"ai":"^6.0.185","tsup":"^8.4.0","react":"^19.0.0","vitest":"^3.0.0","typescript":"^5.8.0","@types/react":"^19.0.0","@ai-sdk/react":"^3.0.187","@ai-sdk/google":"^3.0.75","@ai-sdk/openai":"^3.0.64","@ai-sdk/anthropic":"^3.0.78"},"peerDependencies":{"ai":">=6.0.0","react":">=18.0.0","@ai-sdk/react":">=3.0.0","@ai-sdk/google":">=3.0.0","@ai-sdk/openai":">=3.0.0","@ai-sdk/anthropic":">=3.0.0"},"peerDependenciesMeta":{"@ai-sdk/google":{"optional":true},"@ai-sdk/openai":{"optional":true},"@ai-sdk/anthropic":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/ai_0.1.0_1779452658744_0.2705434007171861","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@allem-sdk/ai","version":"0.1.1","keywords":["allem-sdk","ai","react","hooks","useChat","useAgent","vercel-ai-sdk","llm"],"author":{"name":"Ahmed Allem"},"license":"MIT","_id":"@allem-sdk/ai@0.1.1","maintainers":[{"name":"kingofmit","email":"allem.ahmed@gmail.com"}],"homepage":"https://github.com/kingofmit/allem-sdk#readme","bugs":{"url":"https://github.com/kingofmit/allem-sdk/issues"},"dist":{"shasum":"745850fa68209f4fa3d503920cd4af38cf07993a","tarball":"https://registry.npmjs.org/@allem-sdk/ai/-/ai-0.1.1.tgz","fileCount":16,"integrity":"sha512-XA8PFkP8KZ/WS1GQ+eR1v69o7lP315KIVTN/tx8fTf9FSdxagx4Yb+zzpHNdpj0ByJ5ovEw+tmk9ibM2AjdIsw==","signatures":[{"sig":"MEUCIQCpeYpmGGaU/yrWB4Mwhd1SNdGXAYsZMToOFk8TbSQZ5QIgM9U0VZPOq5NqKcjHZippFsozFUO1rHqvra+OATet5ak=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":40783},"main":"./dist/index.js","_from":"file:allem-sdk-ai-0.1.1.tgz","types":"./dist/index.d.ts","module":"./dist/index.mjs","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"},"./client":{"types":"./dist/client.d.ts","import":"./dist/client.mjs","require":"./dist/client.js"},"./server":{"types":"./dist/server.d.ts","import":"./dist/server.mjs","require":"./dist/server.js"}},"scripts":{"dev":"tsup --watch","test":"vitest run","build":"tsup","clean":"rm -rf dist"},"_npmUser":{"name":"kingofmit","email":"allem.ahmed@gmail.com"},"_resolved":"/private/var/folders/4v/rph2hgm54rqf12vzbjxpn5kc0000gn/T/51b210f71d1410754a369043f234b67d/allem-sdk-ai-0.1.1.tgz","_integrity":"sha512-XA8PFkP8KZ/WS1GQ+eR1v69o7lP315KIVTN/tx8fTf9FSdxagx4Yb+zzpHNdpj0ByJ5ovEw+tmk9ibM2AjdIsw==","repository":{"url":"git+https://github.com/kingofmit/allem-sdk.git","type":"git","directory":"packages/ai"},"_npmVersion":"11.12.1","description":"AI hooks for React — useChat, useAgent, useStreaming. Built on Vercel AI SDK.","directories":{},"sideEffects":false,"_nodeVersion":"26.0.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"ai":"^6.0.185","tsup":"^8.4.0","react":"^19.0.0","vitest":"^3.0.0","typescript":"^5.8.0","@types/react":"^19.0.0","@ai-sdk/react":"^3.0.187","@ai-sdk/google":"^3.0.75","@ai-sdk/openai":"^3.0.64","@ai-sdk/anthropic":"^3.0.78"},"peerDependencies":{"ai":">=6.0.0","react":">=18.0.0","@ai-sdk/react":">=3.0.0","@ai-sdk/google":">=3.0.0","@ai-sdk/openai":">=3.0.0","@ai-sdk/anthropic":">=3.0.0"},"peerDependenciesMeta":{"@ai-sdk/google":{"optional":true},"@ai-sdk/openai":{"optional":true},"@ai-sdk/anthropic":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/ai_0.1.1_1779454895124_0.3982069726443862","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"name":"@allem-sdk/ai","version":"0.1.2","keywords":["allem-sdk","ai","react","react-hooks","chatbot","streaming","vercel-ai-sdk","ai-sdk","llm","google-gemini","anthropic-claude","openai","multi-provider","typescript","nextjs"],"author":{"name":"Ahmed Allem"},"license":"MIT","_id":"@allem-sdk/ai@0.1.2","maintainers":[{"name":"kingofmit","email":"allem.ahmed@gmail.com"}],"homepage":"https://github.com/kingofmit/allem-sdk#readme","bugs":{"url":"https://github.com/kingofmit/allem-sdk/issues"},"dist":{"shasum":"82ade75662caacdd19d035965200b958c14adfa7","tarball":"https://registry.npmjs.org/@allem-sdk/ai/-/ai-0.1.2.tgz","fileCount":16,"integrity":"sha512-4GdokkIiLKpbJUyXJdTA4oc3ik6rVO6LRYmZDVetKCNZMbdagy7JgTYSTFeUP2gzGkCMZJiEH4eydA8vmx6fKw==","signatures":[{"sig":"MEUCIDun//EXCJhlZrG4nk+tTIOC0j0J6tO9qnjcRF4ayhWNAiEAp+jlCAgGMzAXC+1EtWDOzXCgO1gQsMC2JQNzrrKlk1A=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":41222},"main":"./dist/index.js","_from":"file:allem-sdk-ai-0.1.2.tgz","types":"./dist/index.d.ts","module":"./dist/index.mjs","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"},"./client":{"types":"./dist/client.d.ts","import":"./dist/client.mjs","require":"./dist/client.js"},"./server":{"types":"./dist/server.d.ts","import":"./dist/server.mjs","require":"./dist/server.js"}},"scripts":{"dev":"tsup --watch","test":"vitest run","build":"tsup","clean":"rm -rf dist"},"_npmUser":{"name":"kingofmit","email":"allem.ahmed@gmail.com"},"_resolved":"/private/var/folders/4v/rph2hgm54rqf12vzbjxpn5kc0000gn/T/0d6b2554c96a1efbd7c4297a8c09dbe1/allem-sdk-ai-0.1.2.tgz","_integrity":"sha512-4GdokkIiLKpbJUyXJdTA4oc3ik6rVO6LRYmZDVetKCNZMbdagy7JgTYSTFeUP2gzGkCMZJiEH4eydA8vmx6fKw==","repository":{"url":"git+https://github.com/kingofmit/allem-sdk.git","type":"git","directory":"packages/ai"},"_npmVersion":"11.12.1","description":"AI chat and completion hooks for React. Multi-provider streaming (Google Gemini, Anthropic Claude, OpenAI GPT). Built on Vercel AI SDK v6.","directories":{},"sideEffects":false,"_nodeVersion":"26.0.0","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"ai":"^6.0.185","tsup":"^8.4.0","react":"^19.0.0","vitest":"^3.0.0","typescript":"^5.8.0","@types/react":"^19.0.0","@ai-sdk/react":"^3.0.187","@ai-sdk/google":"^3.0.75","@ai-sdk/openai":"^3.0.64","@ai-sdk/anthropic":"^3.0.78"},"peerDependencies":{"ai":">=6.0.0","react":">=18.0.0","@ai-sdk/react":">=3.0.0","@ai-sdk/google":">=3.0.0","@ai-sdk/openai":">=3.0.0","@ai-sdk/anthropic":">=3.0.0"},"peerDependenciesMeta":{"@ai-sdk/google":{"optional":true},"@ai-sdk/openai":{"optional":true},"@ai-sdk/anthropic":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/ai_0.1.2_1779499471650_0.11115661274430866","host":"s3://npm-registry-packages-npm-production"}},"0.1.3":{"name":"@allem-sdk/ai","version":"0.1.3","description":"AI chat and completion hooks for React. Multi-provider streaming (Google Gemini, Anthropic Claude, OpenAI GPT). Built on Vercel AI SDK v6.","license":"MIT","author":{"name":"Ahmed Allem"},"main":"./dist/index.js","module":"./dist/index.mjs","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.mjs","require":"./dist/index.js"},"./client":{"types":"./dist/client.d.ts","import":"./dist/client.mjs","require":"./dist/client.js"},"./server":{"types":"./dist/server.d.ts","import":"./dist/server.mjs","require":"./dist/server.js"}},"sideEffects":false,"devDependencies":{"@ai-sdk/anthropic":"^3.0.78","@ai-sdk/google":"^3.0.75","@ai-sdk/openai":"^3.0.64","@ai-sdk/react":"^3.0.187","@types/react":"^19.0.0","ai":"^6.0.185","react":"^19.0.0","tsup":"^8.4.0","typescript":"^5.8.0","vitest":"^3.0.0"},"peerDependencies":{"@ai-sdk/anthropic":">=3.0.0","@ai-sdk/google":">=3.0.0","@ai-sdk/openai":">=3.0.0","@ai-sdk/react":">=3.0.0","ai":">=6.0.0","react":">=18.0.0"},"peerDependenciesMeta":{"@ai-sdk/google":{"optional":true},"@ai-sdk/anthropic":{"optional":true},"@ai-sdk/openai":{"optional":true}},"repository":{"type":"git","url":"git+https://github.com/kingofmit/allem-sdk.git","directory":"packages/ai"},"keywords":["allem-sdk","ai","react","react-hooks","chatbot","streaming","vercel-ai-sdk","ai-sdk","llm","google-gemini","anthropic-claude","openai","multi-provider","typescript","nextjs"],"publishConfig":{"access":"public"},"scripts":{"build":"tsup","dev":"tsup --watch","clean":"rm -rf dist","test":"vitest run"},"_id":"@allem-sdk/ai@0.1.3","bugs":{"url":"https://github.com/kingofmit/allem-sdk/issues"},"homepage":"https://github.com/kingofmit/allem-sdk#readme","_integrity":"sha512-JLQNYD+tZdUDr23lHw6gKJzR0o4QkGEN/9yxOXXRQHEptJBx7S47i3axUPIIl19INBy3XT1wO5n5ixBUBjIlgQ==","_resolved":"/private/var/folders/4v/rph2hgm54rqf12vzbjxpn5kc0000gn/T/801aaf21f8d4acace430fbb48e5591c8/allem-sdk-ai-0.1.3.tgz","_from":"file:allem-sdk-ai-0.1.3.tgz","_nodeVersion":"26.0.0","_npmVersion":"11.12.1","dist":{"integrity":"sha512-JLQNYD+tZdUDr23lHw6gKJzR0o4QkGEN/9yxOXXRQHEptJBx7S47i3axUPIIl19INBy3XT1wO5n5ixBUBjIlgQ==","shasum":"dc69856eed47efec4bcb2f1bfa547e2698661309","tarball":"https://registry.npmjs.org/@allem-sdk/ai/-/ai-0.1.3.tgz","fileCount":16,"unpackedSize":41222,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIA+TRiRbEfrI0iwZnj+OuXrFJs8F6X+fEGIBa3clF4/EAiAaP4ibOnpR9op4a+v3VrpBrGf+HQ9/FGiEhPxy2Mze+A=="}]},"_npmUser":{"name":"kingofmit","email":"allem.ahmed@gmail.com"},"directories":{},"maintainers":[{"name":"kingofmit","email":"allem.ahmed@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/ai_0.1.3_1779571359717_0.9763565623869257"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-22T12:24:18.655Z","modified":"2026-05-23T21:22:40.029Z","0.1.0":"2026-05-22T12:24:19.002Z","0.1.1":"2026-05-22T13:01:35.279Z","0.1.2":"2026-05-23T01:24:31.800Z","0.1.3":"2026-05-23T21:22:39.869Z"},"bugs":{"url":"https://github.com/kingofmit/allem-sdk/issues"},"author":{"name":"Ahmed Allem"},"license":"MIT","homepage":"https://github.com/kingofmit/allem-sdk#readme","keywords":["allem-sdk","ai","react","react-hooks","chatbot","streaming","vercel-ai-sdk","ai-sdk","llm","google-gemini","anthropic-claude","openai","multi-provider","typescript","nextjs"],"repository":{"type":"git","url":"git+https://github.com/kingofmit/allem-sdk.git","directory":"packages/ai"},"description":"AI chat and completion hooks for React. Multi-provider streaming (Google Gemini, Anthropic Claude, OpenAI GPT). Built on Vercel AI SDK v6.","maintainers":[{"name":"kingofmit","email":"allem.ahmed@gmail.com"}],"readme":"<p align=\"center\">\n  <img src=\"https://raw.githubusercontent.com/kingofmit/allem-sdk/main/.github/AllemSDK.png\" alt=\"Allem SDK\" />\n</p>\n\n<p align=\"center\">\n  <a href=\"https://www.npmjs.com/package/@allem-sdk/ai\"><img src=\"https://img.shields.io/npm/v/@allem-sdk/ai.svg\" alt=\"npm version\" /></a>\n  <a href=\"https://github.com/kingofmit/allem-sdk/blob/main/LICENSE\"><img src=\"https://img.shields.io/badge/license-MIT-blue.svg\" alt=\"License\" /></a>\n  <img src=\"https://img.shields.io/badge/react-19-61dafb\" alt=\"React 19\" />\n  <img src=\"https://img.shields.io/badge/typescript-strict-blue\" alt=\"TypeScript\" />\n  <img src=\"https://img.shields.io/badge/AI_SDK-v6-black\" alt=\"AI SDK v6\" />\n</p>\n\n# @allem-sdk/ai\n\nAI hooks for React built on [Vercel AI SDK v6](https://sdk.vercel.ai). Multi-provider support (Google, Anthropic, OpenAI) with a unified API.\n\n## Installation\n\n```bash\nnpm install @allem-sdk/ai ai @ai-sdk/react\n\n# Install at least one provider\nnpm install @ai-sdk/google    # Google Gemini\nnpm install @ai-sdk/anthropic # Anthropic Claude\nnpm install @ai-sdk/openai    # OpenAI GPT\n```\n\n## Client Usage\n\n```tsx\nimport { useState } from \"react\";\nimport { AllemAIProvider, useAllemChat } from \"@allem-sdk/ai\";\n\nfunction App() {\n  return (\n    <AllemAIProvider api=\"/api/chat\" provider=\"google\">\n      <Chat />\n    </AllemAIProvider>\n  );\n}\n\nfunction Chat() {\n  const [input, setInput] = useState(\"\");\n  const { messages, sendMessage, status } = useAllemChat();\n  const isLoading = status === \"submitted\" || status === \"streaming\";\n\n  return (\n    <div>\n      {messages.map((m) => (\n        <div key={m.id}>\n          {m.parts?.filter((p) => p.type === \"text\").map((p) => p.text).join(\"\")}\n        </div>\n      ))}\n      <form onSubmit={async (e) => {\n        e.preventDefault();\n        const text = input;\n        setInput(\"\");\n        await sendMessage({ text });\n      }}>\n        <input value={input} onChange={(e) => setInput(e.target.value)} disabled={isLoading} />\n        <button type=\"submit\">Send</button>\n      </form>\n    </div>\n  );\n}\n```\n\n## Server Usage\n\n```ts\n// app/api/chat/route.ts (Next.js)\nimport { createAllemChatHandler } from \"@allem-sdk/ai\";\nimport { google } from \"@ai-sdk/google\";\nimport { anthropic } from \"@ai-sdk/anthropic\";\n\nexport const POST = createAllemChatHandler({\n  providers: {\n    google: (model) => google(model ?? \"gemini-2.0-flash\"),\n    anthropic: (model) => anthropic(model ?? \"claude-sonnet-4-20250514\"),\n  },\n  defaultProvider: \"google\",\n});\n```\n\n## Exports\n\n| Export | Type | Description |\n|--------|------|-------------|\n| `useAllemChat` | Hook | Chat hook with streaming, provider context, and message history |\n| `useAllemCompletion` | Hook | Text completion hook for single-turn prompts |\n| `useAllemAIConfig` | Hook | Access the current provider context values (api, provider, model, headers) |\n| `AllemAIProvider` | Component | React context provider for default API and provider config |\n| `createAllemChatHandler` | Server | Server-side API route handler with multi-provider routing |\n\n## Part of [Allem SDK](https://github.com/kingofmit/allem-sdk)\n\nThis package can be used standalone or as part of the full SDK. Install `allem-sdk` to get all packages in one install.\n\n## Support\n\nIf you find Allem SDK useful, consider supporting its development:\n\n<a href=\"https://buymeacoffee.com/kingofmit\" target=\"_blank\"><img src=\"https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png\" alt=\"Buy Me A Coffee\" height=\"50\" /></a>\n\n## License\n\n[MIT](https://github.com/kingofmit/allem-sdk/blob/main/LICENSE) - [Ahmed Allem](https://kingallem.com)\n","readmeFilename":"README.md"}