AI Core
Core AI infrastructure module that provides AI provider management, request routing, usage tracking, and foundational services for all AI-powered features in the ERP system.
Features
- AI Provider Management - Configure and manage multiple AI providers (OpenAI, Anthropic, Google, local models)
- Request Routing - Intelligent routing of AI requests to appropriate providers based on task type and availability
- Usage Tracking - Monitor AI usage, costs, and performance across all modules
- API Key Management - Secure storage and rotation of API keys for different providers
- Provider Switching - Seamlessly switch between AI providers without code changes
Requirements
| Requirement | Details |
|---|---|
| Dependencies | SystemCore |
| PHP Version | 8.2+ |
| AI Provider | At least one AI provider configured (OpenAI, Anthropic, Google, or local) |
Installation
- Enable the module in your admin panel under Settings > Modules
- Configure at least one AI provider with valid API credentials
- Set default provider preferences for different task types
Configuration
Navigate to Settings > AI Core to configure:
- Default Provider - Select the primary AI provider for general tasks
- Fallback Provider - Configure backup provider when primary is unavailable
- Usage Limits - Set daily/monthly usage limits per user or organization
- Model Selection - Choose specific models for different task categories
Usage
Basic AI Request
use Modules\AICore\Services\AIService;
$aiService = app(AIService::class);
$response = $aiService->complete([
'prompt' => 'Summarize this document...',
'max_tokens' => 500,
]);
Provider-Specific Request
$response = $aiService->complete([
'provider' => 'openai',
'model' => 'gpt-5.2-instant',
'prompt' => 'Your prompt here',
]);
Included OpenAI Models
AI Core comes with OpenAI provider pre-configured. Available models:
| Model Family | Models | Description |
|---|---|---|
| GPT-5.2 Series | gpt-5.2-instant, gpt-5.2-thinking, gpt-5.2-pro, gpt-5.2-codex | Latest GPT models with 400K context |
| o3 Series | o3-pro, o3, o3-mini, o4-mini | Advanced reasoning models |
| GPT-4.1 Series | gpt-4.1, gpt-4.1-mini, gpt-4.1-nano | 1M token context models |
| GPT-4o Series | gpt-4o, gpt-4o-mini | Multimodal with vision/audio |
| Embeddings | text-embedding-3-large, text-embedding-3-small | Semantic search |
| Image | dall-e-3, dall-e-2 | Image generation |
| Audio | whisper-1, tts-1, tts-1-hd | Transcription & text-to-speech |
API Endpoints
| Method | Endpoint | Description |
|---|---|---|
| GET | /api/v1/ai/providers | List available AI providers |
| POST | /api/v1/ai/complete | Send completion request |
| GET | /api/v1/ai/usage | Get usage statistics |
Notes
- AI Core is the foundation for all AI-powered modules
- Usage is tracked and can be limited per user or organization
- Supports both cloud-based and local AI providers
- All AI interactions are logged for audit purposes