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
  • TypeScript 5.7+ (recommended)

Install the core package

npm install @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:
npm install @core-ai/openai
The OpenAI adapter supports chat completion, streaming, embeddings, and image generation with DALL-E.

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"
Use a .env file with dotenv to manage your environment variables during development:
npm install dotenv
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
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:
npx tsx test.ts
Core AI uses ES modules ("type": "module"). Make sure your package.json includes this or use .mts file extensions.

Next steps