Installation
core-ai is distributed as npm packages. Install the core package along with your preferred provider adapter.Requirements
- Node.js 22 or higher
- Zod 4 (
zod@^4.0.0) - TypeScript 5.7+ (recommended)
Install the core package
Install a provider adapter
You need at least one provider adapter to use core-ai. Install the package for your preferred LLM provider:- OpenAI
- Anthropic
- Google GenAI
- Mistral
The OpenAI adapter supports chat completion, streaming, structured outputs, embeddings, and image generation.
Add observability (optional)
core-ai provides middleware packages for tracing and monitoring model operations. See the Observability docs for full setup guides.- OpenTelemetry
- Langfuse
Get API keys
You need an API key from your chosen provider. Set it as an environment variable:Verify installation
Create a simple test file to verify your installation:test.ts
core-ai uses ES modules (
"type": "module"). Make sure your package.json includes this or use .mts file extensions.Next steps
Quickstart
Build your first chat completion in 2 minutes
Examples
Explore real-world implementation examples