Welcome to core-ai
core-ai is a type-safe abstraction layer over LLM provider SDKs for TypeScript. Write provider-agnostic code with a unified API for chat completion, streaming, embeddings, image generation, and tool calling.Why core-ai?
Switch between OpenAI, Anthropic, Google Gemini, and Mistral without changing your application code. core-ai provides a consistent interface across all providers while maintaining full type safety and access to provider-specific features when you need them.Installation
Get started with npm, yarn, or pnpm
Quickstart
Build your first chat completion in 2 minutes
API Reference
Explore the complete API documentation
Examples
See real-world implementation examples
Key features
Unified API
Write once, run on any provider. Switch between OpenAI, Anthropic, Mistral, and Google GenAI without code changes.
Full type safety
Strict TypeScript types across the whole API and zero
any types for complete type safety.Streaming support
Replayable async iterable streams with
.result and .events for both text (ChatStream) and structured outputs (ObjectStream).Structured outputs
Schema-validated object generation and streaming, with results typed from your schema.
Tool calling
Define tools with any Standard Schema library, such as Zod, or plain JSON Schema, and send them to any provider.
Multi-modal
Support for text, images (base64 and URL), and file inputs across compatible providers.
Embeddings & images
First-class support for embeddings and image generation, not just chat completions.
Lightweight
Thin wrappers over native SDKs with no heavy runtime dependencies.
Supported providers
Next steps
1
Install core-ai
Choose your package manager and install the core package with your preferred provider.Go to installation →
2
Run your first example
Create a simple chat completion in under 10 lines of code.Go to quickstart →
3
Explore features
Learn about streaming, structured outputs, tool calling, and more.Browse examples →