npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@alchemystai/aisdk

v0.0.5

Published

The Vercel AI SDK Integration for Alchemyst AI.

Readme

Alchemyst AI — Vercel AI SDK Integration

Alchemyst AI is the context layer for your LLM applications — it remembers, reasons, and injects contextual intelligence automatically into every call. This package provides a seamless integration with Vercel's AI SDK to enhance your Gen-AI apps with memory, retrieval, and context-aware toolchains — all through a single line of configuration.


🚀 Installation

npm install @alchemystai/aisdk
# or
yarn add @alchemystai/aisdk
#or
pnpm add @alchemystai/aisdk
# or
bun add @alchemystai/aisdk

⚡ Quick Start

Here's how to plug Alchemyst AI into your ai SDK call using the withAlchemyst middleware:

import { google } from '@ai-sdk/google';
import { generateText } from 'ai';
import { withAlchemyst } from '@alchemystai/aisdk';

const generateTextWithMemory = withAlchemyst(generateText, {
  source: "my_app", // optional
  apiKey: "YOUR_ALCHEMYST_API_KEY", // optional, can be left if you have ALCHEMYST_AI_API_KEY
  debug: true // optional, defaults to false
});

const result = await generateTextWithMemory({
  model: google("gemini-2.5-flash"),
  prompt: "Remember that my name is Alice",
  userId: "user-123",
  sessionId: "session-abc",
});

This automatically attaches the Alchemyst Context Engine to your model call — enabling persistent memory and context-aware generation across sessions.


🧩 API Reference

withAlchemyst(fn, options)

| Parameter | Type | Default | Description | | ---------------- | ---------- | ------- | --------------------------------------------------- | | fn | Function | — | The AI SDK function to wrap (e.g., generateText). | | options.source | string | — | Identifier for your application source. | | options.apiKey | string | — | Your Alchemyst AI API key. Required. | | options.debug | boolean | false | Enables debug logging. |

The wrapped function accepts additional parameters:

| Parameter | Type | Description | | ----------- | -------- | ----------------------------------------------- | | userId | string | Unique identifier for the user. | | sessionId | string | Unique identifier for the conversation/session. |

Returns the result from the wrapped AI SDK function.


🧠 What It Does

Once integrated, Alchemyst AI automatically:

  • Persists context across user sessions.
  • Augments prompts with retrieved knowledge from your Alchemyst AI workspace.
  • Supports custom tool functions for domain-specific reasoning.
  • Runs entirely server-side — no extra infrastructure required.

💡 Example: Contextual Chatbot

import { google } from '@ai-sdk/google';
import { generateText } from 'ai';
import { withAlchemyst } from '@alchemystai/aisdk';

const generateTextWithMemory = withAlchemyst(generateText, {
  source: "chatbot",
  apiKey: process.env.ALCHEMYST_API_KEY!,
  debug: false
});

export async function POST(req: Request) {
  const { prompt, userId, sessionId } = await req.json();

  const result = await generateTextWithMemory({
    model: google("gemini-2.5-flash"),
    prompt,
    userId,
    sessionId,
  });

  return new Response(result.text);
}

With this, your AI app will:

  • Remember previous user messages (via Alchemyst context memory)
  • Retrieve relevant knowledge chunks
  • Enrich every prompt dynamically before sending it to the model

🔒 Environment Variables

Set your API key in your environment:

ALCHEMYST_API_KEY=sk-xxxxxx

Then reference it in your code as:

const generateTextWithMemory = withAlchemyst(generateText, {
  source: "my_app",
  apiKey: process.env.ALCHEMYST_API_KEY!,
});

🧰 Supported SDK Methods

Alchemyst AI integrates with all Vercel AI SDK entry points:

| SDK Function | Supported | Notes | | ---------------- | --------- | ------------------------------- | | streamText | ✅ | Real-time streaming generation | | generateText | ✅ | Synchronous generation | | streamObject | ✅ | Structured JSON output | | generateObject | ✅ | Non-streaming structured output |


🧪 Example with Different Conversations

import { google } from '@ai-sdk/google';
import { generateText } from 'ai';
import { withAlchemyst } from '@alchemystai/aisdk';

const generateTextWithMemory = withAlchemyst(generateText, {
  source: "api_sdk_test",
  apiKey: "YOUR_ALCHEMYST_API_KEY",
  debug: true
});

// First conversation
const result1 = await generateTextWithMemory({
  model: google("gemini-2.5-flash"),
  prompt: "What is the capital of France?",
  userId: "12345",
  sessionId: "test-convo-1",
});

// Second conversation
const result2 = await generateTextWithMemory({
  model: google("gemini-2.5-flash"),
  prompt: "What is the capital of Germany?",
  userId: "12345",
  sessionId: "test-convo-2",
});

📜 License

MIT © 2025 Alchemyst AI