AI as infrastructure, not a feature. A central wrapper that routes every call through cost controls, model selection, and logging. Haiku for the high-volume work. Sonnet for the complex reasoning. Budget caps that prevent surprises.
The AI layer isn’t one feature — it’s the infrastructure that makes multiple AI features manageable. Without a central wrapper, every AI call is a separate implementation: different error handling, different models, different logging (or none). With it, adding a new AI feature means writing the business logic and passing a task name. Cost tracking, model selection, and failure handling are handled once and inherited by everything.
[client]_ai_request() function, model selection by task name, daily cap checks, HTTP request with timeout, and per-call logging. The interface all AI features use so model changes and policy changes happen in one place.