Skip to content
Night Owls.dev
Jump to a page

@nightowlsdev/provider-openai

Adapter/Model

OpenAI model provider for Night Owls swarms, backed by the native AI SDK.

What it does

Exposes `openaiModels(opts?)`, a model factory for `defineSwarm({ modelFactory })`. It wraps `@ai-sdk/openai`'s `createOpenAI`, mapping a model id (e.g. `gpt-4o`) to an AI SDK `LanguageModelV3`. Reads `OPENAI_API_KEY` from the environment by default; pass `{ apiKey }` to override. Also exports a declarative `nightOwlsPlugin` manifest for CLI scaffolding of env/config; model providers compose, so this adapter can sit alongside the other `provider-*` packages and be routed per agent by `createModelFactory`.

Install

pnpm add @nightowlsdev/provider-openai

Key exports

  • openaiModels
  • nightOwlsPlugin

Usage

provider-openai.ts
import { defineSwarm } from "@nightowlsdev/core";
import { openaiModels } from "@nightowlsdev/provider-openai";

// Reads OPENAI_API_KEY from the env by default.
const swarm = defineSwarm({ agents, modelFactory: openaiModels() });