ADR 03: AI through Vercel AI Gateway
Cheap models, OIDC auth, no per-provider keys.
Status: adopted (2026-07-14)
Context
The editing agent needs an LLM. The owner explicitly does not want the Claude API for this (“too expensive”). Billing should flow through Vercel.
Decision
Use the Vercel AI Gateway with the AI SDK. Default model moonshotai/kimi-k2, overridable per request from an allowlist of prefixes and via the EDIT_MODEL env var. On deployment, OIDC handles auth so no API key is stored. The editor UI offers a model picker fed by the gateway’s catalog.
Consequences
- Model swaps are config, not code.
- The string-replacement edit contract (exact old_string/new_string pairs, validated server-side for uniqueness) keeps cheap models safe: a bad generation fails validation instead of corrupting a page.
- All generation prompts carry the design rubric and voice rules.