Skip to content

AI Integration

Baan integrates AI throughout the admin panel — not as a gimmick, but as a practical tool for each step of the writing workflow. You bring your own API keys and choose which provider (and which model) handles each feature individually.

ProviderExample Models (as of 2026-04)
Claude (Anthropic)claude-opus-4-6, claude-sonnet-4-5-20250929, claude-haiku-4-5-20251001 (default)
OpenAIgpt-5, gpt-5-mini, gpt-4.1, gpt-4.1-mini (default), gpt-4.1-nano, o3, o4-mini
Gemini (Google)gemini-3.1-pro-preview, gemini-3-flash-preview, gemini-2.5-pro, gemini-2.5-flash (default), gemini-2.5-flash-lite

You can configure multiple providers simultaneously and assign different providers to different features. The exact model list is defined in lib/ai/config/ai-models.ts and can drift between releases — check Admin → Settings → AI for the current options in your installation.

Available in the post editor’s full-screen mode via the AI sidebar:

  • Draft from title/outline — generate an initial draft based on a title or bullet points
  • Edit and improve — rewrite selected text for clarity, tone, or length
  • Translate — translate the current article into another supported locale
  • Summarize — generate a description for the frontmatter from the article body

Go to Admin → Settings → Theme → Create new theme and enter a prompt describing your desired visual style. Baan sends the prompt to your AI provider and generates a complete theme with:

  • Component files (layout, header, footer, post cards)
  • CSS variables for colors, typography, and spacing
  • theme.json metadata

Example prompts: “Minimalist dark mode with serif headings”, “Colorful magazine layout inspired by mid-century design”.

In Admin → Knowledge Graph, select an article and click Extract Entities. The AI reads the article body and extracts named entities (people, places, organizations, concepts, events, products), then attempts to enrich them with Wikidata IDs and descriptions.

The result is structured JSON-LD embedded in your article pages, making content more interpretable by AI search engines (ChatGPT, Perplexity, Google AI Overview).

In Admin → Settings → AI Optimization, Baan can generate an llms.txt file — a plain-text summary of your site intended for AI crawlers. You can write it manually, auto-generate from your content, or use AI to draft and refine it.

In Admin → Settings → AI, you can assign different models to each feature:

FeatureWhy you might use a different model
Writing AssistantUse a capable model (claude-opus-4-6, gpt-5) for quality
TranslationA faster/cheaper model (gemini-2.5-flash, gpt-4.1-mini) is sufficient
Knowledge GraphExtraction works well with mid-tier models
Theme GenerationUse the most capable model for best results

The three providers behave noticeably differently. Choosing the right model per feature is the difference between a snappy admin UI and one that hangs for 30+ seconds on every meta description.

OpenAI — two families with different APIs

Section titled “OpenAI — two families with different APIs”
FamilyModelsReasoningLatency
GPT-4.1gpt-4.1, gpt-4.1-mini, gpt-4.1-nanoNone — direct generationFast (< 3 s)
GPT-5 / o-seriesgpt-5, gpt-5-mini, o3, o4-miniInternal “thinking”3–60 s

Reasoning models reject temperature (locked to 1) and max_tokens (use max_completion_tokens). Baan auto-detects them and sends reasoning_effort: 'low' to keep latency reasonable on short admin tasks.

ModelSpeedQuality$ / MTok (in / out)
Haiku 4.5 (default)FastestGood$1 / $5
Sonnet 4.5FastHigh$3 / $15
Opus 4.6SlowHighest$5 / $25

No reasoning-effort knob — latency tracks model size.

ModelSpeedQuality$ / MTok
2.5 Flash LiteFastestAdequate$0.075 / $0.30
2.5 Flash (default)FastHigh$0.15 / $0.60
2.5 ProSlowHighest$1.25 / $5
3 Flash Preview / 3.1 Pro Previewvariesfrontier (preview)preview
TaskSpeed-firstBalanced (default)Quality-first
Meta description (~160 chars)gpt-4.1-nano, gemini-2.5-flash-litegpt-4.1-mini, claude-haiku-4-5claude-sonnet-4-5
FAQ generationgpt-4.1-miniclaude-haiku-4-5, gemini-2.5-flashclaude-sonnet-4-5
Outline / structuregpt-4.1-miniclaude-sonnet-4-5gpt-5, claude-opus-4-6
Summarygpt-4.1-nanogpt-4.1-miniclaude-sonnet-4-5
Translation (short / medium)gpt-4.1-miniclaude-sonnet-4-5, gemini-2.5-flashclaude-opus-4-6, gpt-5
Translation (long / specialized)claude-sonnet-4-5claude-opus-4-6, gpt-5
Entity extraction (JSON)gpt-4.1-minigpt-4.1, claude-haiku-4-5gpt-5, claude-sonnet-4-5
Theme generation (code)gpt-5-mini, claude-sonnet-4-5gpt-5, claude-opus-4-6
Proofreadinggpt-4.1-miniclaude-haiku-4-5claude-sonnet-4-5
AEO scoregpt-4.1-nanoclaude-haiku-4-5gpt-4.1
AI Assistant chatgpt-4.1-miniclaude-sonnet-4-5gpt-5, claude-opus-4-6
ClassTime per request
Direct chat (gpt-4.1*, Flash, Haiku)< 3 s
Reasoning low (gpt-5 family with reasoning_effort=low)3–10 s
Reasoning medium (default)10–30 s
Reasoning high or large model30–60+ s

Self-hosted: Set your API key(s) in .env or your process environment. The Admin UI reads masked keys from the environment and stores provider/model assignments in the database.

Serverless (Vercel): Add keys as environment variables in your Vercel project settings (they cannot be written to the file system at runtime):

ANTHROPIC_API_KEY=sk-ant-...
OPENAI_API_KEY=sk-...
GEMINI_API_KEY=AI...

Then go to Admin → Settings → AI to select your active provider and configure per-feature model assignments.

In Admin → Settings → AI:

  1. Choose your default provider (the fallback for any feature without a specific assignment)
  2. Optionally assign specific providers/models per feature
  3. Save

The AI settings page shows cumulative token usage per provider so you can monitor costs.