Skip to content

@storyshelf/ai

View as Markdown

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

Terminal window
npm i @storyshelf/ai

JSR JSR Score

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.