Transform LLM Interactions with Type Safety
Alchemy is a TypeScript framework for building structured, type-safe LLM pipelines. Define recipes, transform multimodal inputs, and get validated outputs — all with full type inference.
import { Alchemist } from "@edv4h/alchemy-node";
import { OpenAITransmuter } from "@edv4h/alchemy-plugin-transmuter-openai";
import { JsonRefiner } from "@edv4h/alchemy-core";
import { z } from "zod";
const alchemist = new Alchemist({
transmuter: new OpenAITransmuter({ apiKey: "sk-..." }),
});
const result = await alchemist.transmute({
recipe: {
spell: { output: "Summarize this text in 3 bullet points" },
refiner: new JsonRefiner(z.object({
bullets: z.array(z.string()).length(3),
})),
},
materials: [{ type: "text", text: "Your long document here..." }],
});
console.log(result.output.bullets);
// → ["Point 1", "Point 2", "Point 3"] ✓ Fully typed!
Why Alchemy?
Built for developers who demand structure and reliability from LLM interactions.
Type-Safe Output
Define output schemas with Zod. Get fully typed, validated responses from any LLM. No more parsing JSON strings by hand.
Multimodal Input
Text, images, audio, video, documents, data — all as first-class Material types. Build rich, multi-input pipelines with ease.
Pluggable Architecture
Swap LLM providers via Transmuters. Add preprocessing with Transforms. Customize output parsing with Refiners.
Packages
A modular architecture — use what you need.
@edv4h/alchemy-core
Type definitions, Refiners (Text, JSON/Zod), Material utilities, and Transform helpers. Zero runtime dependencies beyond Zod.
@edv4h/alchemy-node
The Alchemist orchestrator class with core re-exports. Provides the main entry point for Node.js server-side usage.
@edv4h/alchemy-react
React hooks — useAlchemy, useTransmute, useGenerate — for building interactive LLM-powered UIs with full state management.
@edv4h/alchemy-plugin-transmuter-openai
OpenAI transmuter plugin — connects Alchemy to GPT-4o, GPT-4o-mini and other OpenAI models.
@edv4h/alchemy-plugin-transmuter-anthropic
Anthropic transmuter plugin — connects Alchemy to Claude models via the Anthropic SDK.
@edv4h/alchemy-plugin-transmuter-google
Google transmuter plugin — connects Alchemy to Gemini models via the Google Generative AI SDK.
@edv4h/alchemy-plugin-transforms-node
Node.js transform helpers — imageUrlToBase64, documentToText, and other server-side material transforms.
The Transmutation Pipeline
Every request flows through a clear, composable pipeline.