# ADR 0001: Use the WordPress AI Client boundary

Status: Accepted (2026-08-07)

## Context

CatalogFrame 1.0.0 stored an OpenAI API key and called OpenAI's Images endpoint directly. WordPress 7.0 now provides a provider-neutral AI Client and centralized credential management through Settings > Connectors. Keeping a second provider and credential boundary would duplicate site configuration, couple the plugin to one vendor, and conflict with current WordPress guidance.

## Decision

CatalogFrame requires WordPress 7.0 and sends image prompts through `wp_ai_client_prompt()` from its existing feature-specific REST endpoint. WordPress selects a compatible configured model and owns provider credentials. CatalogFrame feature-detects image support before queueing work, accepts only provider-neutral aspect preferences, validates returned raster files, and keeps Media Library and SKU mapping behavior inside the plugin.

The 1.0.1 upgrade deletes the obsolete encrypted CatalogFrame key. The plugin does not require a specific provider plugin because any WordPress AI Client provider with image-generation capability may satisfy the contract.

## Alternatives considered

- Keep the direct OpenAI integration: rejected because it duplicates credentials and remains provider-specific.
- Bundle the pre-7.0 PHP AI Client for backward compatibility: rejected because it adds dependency and autoloader complexity to support an old boundary.
- Use the general client-side AI REST API: rejected because WordPress recommends narrow server-side endpoints for distributed plugins, where each feature can enforce its own permission and input checks.

## Consequences

Site owners configure a compatible provider once in WordPress. Exact model, image format, quality, moderation, price, and provider retention rules are provider-controlled. CatalogFrame can request an aspect ratio but must accept and validate the provider's actual output.
