Skip to main content

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:
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.

Get API keys

You need an API key from your chosen provider. Set it as an environment variable:
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:
test.ts
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