Skip to main content

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

RequirementDetails
DependenciesSystemCore
PHP Version8.2+
AI ProviderAt least one AI provider configured (OpenAI, Anthropic, Google, or local)

Installation

  1. Enable the module in your admin panel under Settings > Modules
  2. Configure at least one AI provider with valid API credentials
  3. 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 FamilyModelsDescription
GPT-5.2 Seriesgpt-5.2-instant, gpt-5.2-thinking, gpt-5.2-pro, gpt-5.2-codexLatest GPT models with 400K context
o3 Serieso3-pro, o3, o3-mini, o4-miniAdvanced reasoning models
GPT-4.1 Seriesgpt-4.1, gpt-4.1-mini, gpt-4.1-nano1M token context models
GPT-4o Seriesgpt-4o, gpt-4o-miniMultimodal with vision/audio
Embeddingstext-embedding-3-large, text-embedding-3-smallSemantic search
Imagedall-e-3, dall-e-2Image generation
Audiowhisper-1, tts-1, tts-1-hdTranscription & text-to-speech

API Endpoints

MethodEndpointDescription
GET/api/v1/ai/providersList available AI providers
POST/api/v1/ai/completeSend completion request
GET/api/v1/ai/usageGet 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