@storyshelf/ai
@storyshelf/ai implements the Ai surface that ShelfOptions.ai accepts. It owns the ai core and @ai-sdk/otel (pinned exactly) and never sees provider keys: you install a provider package and pass configured models in. See the AI insights guide and ADR 0016.
Install
Section titled “Install”npm i @storyshelf/aipnpm add @storyshelf/aiyarn add @storyshelf/ai- npm package — install tarballs and version history.
- JSR package — TypeScript-first registry page.
- Source on GitHub — package directory on
main.
import { createAi } from "@storyshelf/ai";import { createShelfApp } from "@storyshelf/app";import { openai } from "@ai-sdk/openai";
const ai = createAi({ profiles: { default: { defaultModel: openai("gpt-4o-mini") } }, budget: { dailyTokens: 2_000_000 },});
const app = createShelfApp({ database, storage, ai });Passing ai turns AI on site-wide; a site admin then enables it per project by choosing a profile in project settings. One export, createAi, plus the option types. Everything else is internal.