One place in Magento to configure your AI providers, one client every module can use to call them, and a dashboard that shows what each module spends.
![]() |
![]() |
| Stores > Configuration > Mage-OS > AI Configuration | Reports > AI Token Usage |
- Provider configuration. OpenAI, Anthropic, Google Gemini, Azure OpenAI, DeepSeek, OpenRouter, Hugging Face, Ollama, LM Studio and any OpenAI-compatible gateway. Add a provider more than once, name each row, switch rows off, test the connection and refresh the model list from the form. API keys are encrypted at rest and never shown again.
- One client for every provider. Chat, streaming, tool calls and reasoning through a single
interface. Options like
max_tokensandtool_choiceare translated per provider, and failures come back as typed exceptions you can retry or skip. - Let the admin choose. A ready-made source model for your own
system.xml, so a store picks which configured service your feature uses. - Usage tracking. Token counts per module, service and store, on a dashboard, a grid and a CLI report. Prompts and responses are never stored.
- Extensible. Add your own provider with one class and a few lines of
di.xml.
composer require mage-os/module-ai-base
bin/magento module:enable MageOS_AiBase
bin/magento setup:upgradeRequires Magento 2.4.8+ or Mage-OS 1.1+, and PHP 8.2+. OpenAI and Anthropic work out of the box; every other provider needs its Symfony AI bridge package, which the admin form names when it's missing.
The client is built on symfony/ai-platform 0.14, which is
experimental. This module's Api interfaces absorb its changes; code that reaches the Symfony
platform directly does not.
use MageOS\AiBase\Api\AiClientFactoryInterface;
class ProductSummary
{
public function __construct(
private readonly AiClientFactoryInterface $aiClientFactory,
) {
}
public function summarize(string $description): string
{
return $this->aiClientFactory
->create(consumer: 'Vendor_ProductSummary')
->complete('Summarize this product description: ' . $description);
}
}chat() and streamChat() cover conversations, tools and streaming. The
Consumer Guide has the full picture.
- Consumer Guide: make AI calls, handle failures, let the admin pick a service, what's stable
- Provider Guide: add a provider, wire a client bridge, the admin form
- Usage Tracking: what is recorded, where to see it, retention
- Architecture: components, data flows, security model, design decisions
See CONTRIBUTING.md and our Code of Conduct.
Please report vulnerabilities privately, as described in SECURITY.md, not in a public issue.

