The AI Toolkit for TypeScript & JavaScript

Universal AI layer for every app

One SDK for building AI features, agents, and apps — with streaming, structured output, tools, and fallbacks across every major provider.

Works with every major provider

OpenAIAnthropicGoogleMetaMistralxAIAmazon
import { generateText } from 'ai-toolkit';

const { text } = await generateText({
  model: 'openai/gpt-4o',
  prompt: 'Explain the concept of quantum entanglement.',
});

console.log(text);
Copy this recipe and run it locally — or explore the full recipe below.

18.3M

Weekly downloads

26.3K

GitHub stars

695+

Contributors

100+

Models supported

Explore

Everything you need to ship AI

Start from a recipe, wire in a tool, or fork a template. Then see what the community has built.

Featured recipes

Build with AI TOOLKIT today

FAQ

Questions, answered

Everything you need to know before you start building.

AI TOOLKIT is an open-source TypeScript SDK for building AI apps and agents. It gives you one unified interface for streaming, structured output, tools, fallbacks, and multi-model support across every major provider and framework.

Get started

Build with AI TOOLKIT today

Get started with the AI TOOLKIT by using our recipes or templates, or install the core package in seconds.

Install

$ npm install ai