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
npm install @core-ai/core-ai
yarn add @core-ai/core-ai
pnpm add @core-ai/core-ai
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
npm install @core-ai/openai
The OpenAI adapter supports chat completion, streaming, structured outputs, embeddings, and image generation.
npm install @core-ai/anthropic
yarn add @core-ai/anthropic
pnpm add @core-ai/anthropic
The Anthropic adapter supports chat completion, streaming, structured outputs, tool calling, vision, and reasoning with Claude models.
npm install @core-ai/google-genai
yarn add @core-ai/google-genai
pnpm add @core-ai/google-genai
The Google GenAI adapter supports chat, streaming, structured outputs, embeddings, multimodal input, and image generation.
npm install @core-ai/mistral
yarn add @core-ai/mistral
pnpm add @core-ai/mistral
The Mistral adapter supports chat completion, streaming, structured outputs, tool calling, multimodal input, reasoning output, and embeddings.
Add observability (optional)
core-ai provides middleware packages for tracing and monitoring model operations. See the Observability docs for full setup guides.
OpenTelemetry
Axiom
Langfuse
npm install @core-ai/opentelemetry @opentelemetry/api
yarn add @core-ai/opentelemetry @opentelemetry/api
pnpm add @core-ai/opentelemetry @opentelemetry/api
npm install @core-ai/axiom @opentelemetry/api @opentelemetry/sdk-node @opentelemetry/exporter-trace-otlp-http
yarn add @core-ai/axiom @opentelemetry/api @opentelemetry/sdk-node @opentelemetry/exporter-trace-otlp-http
pnpm add @core-ai/axiom @opentelemetry/api @opentelemetry/sdk-node @opentelemetry/exporter-trace-otlp-http
npm install @core-ai/langfuse @langfuse/otel @langfuse/tracing
yarn add @core-ai/langfuse @langfuse/otel @langfuse/tracing
pnpm add @core-ai/langfuse @langfuse/otel @langfuse/tracing
Get API keys
You need an API key from your chosen provider. Set it as an environment variable:
export OPENAI_API_KEY="your-api-key-here"
export ANTHROPIC_API_KEY="your-api-key-here"
export GOOGLE_API_KEY="your-api-key-here"
export MISTRAL_API_KEY="your-api-key-here"
Use a .env file with dotenv to manage your environment variables during development:Then add import 'dotenv/config'; at the top of your entry file.
Verify installation
Create a simple test file to verify your installation:
import { generate } from '@core-ai/core-ai';
import { createOpenAI } from '@core-ai/openai';
const openai = createOpenAI({ apiKey: process.env.OPENAI_API_KEY });
const model = openai.chatModel('gpt-5-mini');
const result = await generate({
model,
messages: [{ role: 'user', content: 'Hello!' }],
});
console.log(result.content);
Run it with:
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