OpenAI API + Magento Integration — A Complete Working Extension
Most OpenAI + Magento tutorials stop at a curl example. This one ships a full module — Panth_AiAssist — with an admin grid for prompt templates, a backend client that retries on 429/5xx with exponential backoff, a per-call cost log so you can audit monthly spend per template, model fallback from gpt-4 to gpt-3.5-turbo when a soft budget is exceeded, and a CLI batch runner. Compatible with both OpenAI and Anthropic via a single LlmProviderInterface. API keys live in app/etc/env.php encrypted via Magento's EncryptorInterface — never in CLAUDE.md, never in git.