Module v1.0.0

OpenAI Integration

Connect core CRM AI features to OpenAI, configure standard models and controlled fine-tuning, and understand the exact privacy, model and job behaviour.

Setup, access and model configuration

Activate the provider, store credentials and select the model and token settings used by core CRM AI features.

Open connected topic →
01OpenAI Integration module overviewConnect the CRM AI-provider registry to OpenAI, configure the standard model and optionally use a CRM-trained fine-tuned model.Admin Area → Setup → Settings → AI → OpenAI02Install and activate OpenAI Integration v1.0.0Activate the bundled provider module and verify that its settings child appears under the CRM AI settings group.Admin Area → Setup → Modules → OpenAI Integration → Activate03Verify the CRM and PHP requirements for OpenAI IntegrationCheck the supplied version requirements before activation or upgrade.Server diagnostics and Admin Area → Setup → Modules → OpenAI Integration04Open the OpenAI settings workspaceUse the real settings path rather than looking for a standalone OpenAI menu.Admin Area → Setup → Settings → AI → OpenAI05Enter the OpenAI API keyStore the provider credential used to construct the OpenAI client.Admin Area → Setup → Settings → AI → OpenAI06Choose the standard OpenAI modelSelect the model used when fine-tuning is disabled or no fine-tuned model is selected.Admin Area → Setup → Settings → AI → OpenAI07Set the OpenAI maximum token valueControl the max_tokens value sent with each chat request.Admin Area → Setup → Settings → AI → OpenAI08Configure the CRM AI system promptSet the parent CRM AI system instruction that OpenAI uses as the developer message and fine-tuning system message.Admin Area → Setup → Settings → AI09Save and verify OpenAI provider settingsConfirm that the API key, model and maximum-token values persist and the provider is registered.Admin Area → Setup → Settings → AI → OpenAI10Use the OpenAI module action linksOpen either the provider-specific settings or the parent AI settings from the module list.Admin Area → Setup → Modules → OpenAI Integration → action links11Understand the OpenAI provider registry keyKnow how the module becomes available to core CRM AI features.Code-backed reference → openai.php → openai_module_init12Extend the standard model list with the openai_models filterAdd supported model entries without editing the provider class.Development integration → hook openai_models13Deactivate OpenAI Integration safelyDisable the provider module without assuming its stored options are deleted.Admin Area → Setup → Modules → OpenAI Integration → Deactivate14Troubleshoot a missing OpenAI settings sectionCheck module activation, CRM version and parent AI settings registration when the child section is absent.Admin Area → Setup → Settings → AI → OpenAI

Chat and text-enhancement flow

Understand exactly how prompts, the developer message, model selection, stored responses and HTML enhancement are processed.

Open connected topic →
01Use OpenAI through a core CRM AI actionRun a supported core AI action after configuring the provider.Open a CRM editor or AI-enabled feature → choose the configured AI action02Understand standard versus fine-tuned model selectionKnow which model is used for each request.Admin Area → Setup → Settings → AI → OpenAI03Understand the OpenAI chat message rolesReview the exact messages sent by the provider.Code-backed reference → OpenAiProvider::chat04Understand stored OpenAI chat responsesAccount for the store=true option in every normal chat request.Code-backed reference → OpenAiProvider::chat05Understand maximum-token handling in chat requestsConfirm how the configured numeric value is applied.Code-backed reference → OpenAiProvider constructor and chat06Understand response-choice handlingKnow which part of the provider response is returned to the CRM.Code-backed reference → OpenAiProvider::chat07Understand HTML code-fence strippingReview how a response wrapped in an html code fence is cleaned.Code-backed reference → OpenAiProvider::chat08Enhance CRM editor text with OpenAIUse the host AI enhancement action to request a more polite, formal or friendly result.Open an AI-enabled CRM TinyMCE editor → select text → AI enhancement action09Understand HTML-to-Markdown conversion before enhancementKnow how existing formatted content is prepared for the enhancement prompt.Code-backed reference → OpenAiProvider text-enhancement flow10Understand TinyMCE-compatible enhancement outputReview the expected output format and paragraph-wrapper handling.Open an AI-enabled TinyMCE editor → AI enhancement action11Extend AI text enhancement with the before_ai_tickets_enhance_text filterAlter the source text through the registered filter before it is sent.Development integration → hook before_ai_tickets_enhance_text12Troubleshoot an empty or malformed AI responseCheck credentials, model access, limits and first-choice content when no usable text is returned.Open the host CRM AI action and review application logs

Fine-tuning data sources and eligibility

Prepare eligible public knowledge-base articles and predefined replies and understand the minimum-data checks.

Open connected topic →
01Open the OpenAI fine-tuning workspaceAccess training-source counts, job status and model controls from the OpenAI settings page.Admin Area → Setup → Settings → AI → OpenAI → Advanced Features → OpenAI Fine Tuning02Understand fine-tuning permissionsSeparate read access from job, model and option changes.Admin Area → Setup → Settings → AI → OpenAI → Advanced Features → OpenAI Fine Tuning03Choose a fine-tuning base modelSelect the supported base model used for the next fine-tuning job.Admin Area → Setup → Settings → AI → OpenAI → Advanced Features → OpenAI Fine Tuning04Prepare eligible knowledge-base articles for fine-tuningPublish active public articles that the training collector can read.Admin Area → Support/Knowledge Base → Articles, then OpenAI Fine Tuning05Prepare predefined replies for fine-tuningCreate approved reusable replies that the training collector can include.Admin Area → Setup/Support → Predefined Replies, then OpenAI Fine Tuning06Meet the minimum fine-tuning source requirementProvide enough eligible content for the Start Fine Tuning action.Admin Area → OpenAI Fine Tuning → Training Data Sources07Review knowledge-base and predefined-reply source countsUse the displayed counts before starting a job.Admin Area → Setup → Settings → AI → OpenAI → Advanced Features → OpenAI Fine Tuning08Understand the default fine-tuning training promptKnow how each source item is converted into a user/assistant example.Code-backed reference → OpenAiProvider::formatTrainingData09Extend eligible knowledge-base sources with the openai_fine_tuning_knowledge_base filterAdjust the collected public article array through the supported hook.Development integration → hook openai_fine_tuning_knowledge_base10Extend predefined-reply sources with the openai_fine_tuning_predefined_replies filterAdjust the predefined-reply training array through the supported hook.Development integration → hook openai_fine_tuning_predefined_replies11Alter formatted training examples with the openai_fine_tuning_training_data filterModify the final message arrays before JSONL encoding.Development integration → hook openai_fine_tuning_training_data12Troubleshoot insufficient fine-tuning dataResolve the start-job rejection when neither source reaches the required count.Admin Area → Setup → Settings → AI → OpenAI → Advanced Features → OpenAI Fine Tuning

Fine-tuning job lifecycle

Create the JSONL training file, upload it, start a job, check status and understand saved identifiers and failure handling.

Open connected topic →
01Start an OpenAI fine-tuning jobCreate and upload training JSONL and submit a job with the selected base model.Admin Area → Setup → Settings → AI → OpenAI → Advanced Features → OpenAI Fine Tuning02Understand previous pcrm-model cleanup before a new jobKnow why module-owned fine-tuned models may be deleted when training starts.Code-backed reference → OpenAiProvider::createFineTuningJob03Understand OpenAI training JSONL generationReview the exact line-oriented format sent to the provider.Code-backed reference → OpenAiProvider::formatTrainingData04Understand the temporary training-file path and cleanupReview local temporary-file handling during job creation.Server temporary directory → pcrm_training_{timestamp}.jsonl05Understand the OpenAI training-file uploadKnow the purpose and file identifier used for the provider upload.Code-backed reference → OpenAI files upload06Understand the fine-tuning job suffixIdentify module-created jobs and models.Code-backed reference → OpenAI fineTuning createJob07Review saved fine-tuning job and file identifiersFind the options used for later status and cleanup operations.Admin Area → Setup → Settings → AI → OpenAI → Advanced Features → OpenAI Fine Tuning08Refresh the last fine-tuning job statusRetrieve current provider status from the workspace.Admin Area → Setup → Settings → AI → OpenAI → Advanced Features → OpenAI Fine Tuning → Refresh Status09Understand fine-tuning job statuses and timestampsInterpret status, created time, finished time and error information returned by the provider.Admin Area → Setup → Settings → AI → OpenAI → Advanced Features → OpenAI Fine Tuning10Understand automatic model selection after successful trainingKnow when the returned model becomes selected and enabled.Admin Area → Setup → Settings → AI → OpenAI → Advanced Features → OpenAI Fine Tuning11Review fine-tuning errors in CRM activity logsFind provider or file/job errors captured by the module.Admin Area → Utilities/Activity Log and server logs12Start a replacement fine-tuning job safelyReview the destructive pcrm-model cleanup and source quality before retraining.Admin Area → Setup → Settings → AI → OpenAI → Advanced Features → OpenAI Fine Tuning

Fine-tuned model management

Review, activate, enable and delete pcrm-owned fine-tuned models safely.

Open connected topic →
01Review available fine-tuned OpenAI modelsRead the model ID, creation time, owner, active marker and available actions.Admin Area → Setup → Settings → AI → OpenAI → Advanced Features → OpenAI Fine Tuning02Understand pcrm-owned model identificationKnow which models the module treats as its own.Admin Area → Setup → Settings → AI → OpenAI → Advanced Features → OpenAI Fine Tuning03Set a fine-tuned model as activeChoose the exact model ID used when fine-tuning is enabled.Admin Area → Setup → Settings → AI → OpenAI → Advanced Features → OpenAI Fine Tuning → Fine Tuned Models → Set as Active04Enable or disable use of fine tuningToggle whether normal chat chooses the selected fine-tuned model.Admin Area → Setup → Settings → AI → OpenAI → Advanced Features → OpenAI Fine Tuning → Enable Fine Tuning05Delete a pcrm-owned fine-tuned modelRemove a module-owned provider model from the list.Admin Area → Setup → Settings → AI → OpenAI → Advanced Features → OpenAI Fine Tuning → Fine Tuned Models → Delete06Understand why an external fine-tuned model cannot be deleted hereRecognise the ownership guard in the model table.Admin Area → Setup → Settings → AI → OpenAI → Advanced Features → OpenAI Fine Tuning07Understand recommended and checkpoint model labelsInterpret the model-table badges accurately.Admin Area → Setup → Settings → AI → OpenAI → Advanced Features → OpenAI Fine Tuning08Understand fine-tuned model list orderingKnow why some models appear before others.Admin Area → Setup → Settings → AI → OpenAI → Advanced Features → OpenAI Fine Tuning09Extend fine-tuning base models with the openai_fine_tuning_models filterAdd an allowed base-model option without editing the provider.Development integration → hook openai_fine_tuning_models10Troubleshoot a missing or unusable fine-tuned modelCheck job status, ownership, selected ID and enable toggle.Admin Area → Setup → Settings → AI → OpenAI → Advanced Features → OpenAI Fine Tuning

Security, privacy, limitations and troubleshooting

Protect API credentials and submitted content and diagnose provider, model, training and output errors without inventing unsupported controls.

Open connected topic →
01Protect the OpenAI API keyApply least privilege and secret-handling controls to the stored credential.Admin Area → Setup → Settings → AI → OpenAI02Assess personal-data transfer to OpenAIReview lawful basis, minimisation and provider terms before using CRM data in prompts.Data protection review → CRM AI features03Review AI-generated content before usePrevent unverified output from becoming an official CRM communication or decision.Any CRM feature using OpenAI → review generated result04Monitor OpenAI cost and usage externallyUse provider-side controls because this module has no usage dashboard.OpenAI provider account → Usage/Billing05Understand the absence of OpenAI module cron and webhooksDo not expect background polling or inbound provider events from this module.Code-backed reference → supplied OpenAI module hooks/controllers06Understand the absence of API-key rotation controlsPlan credential lifecycle outside the module.OpenAI provider account and Admin Area → Setup → Settings → AI → OpenAI07Review OpenAI activity and PHP logsUse the available evidence when provider calls fail.Admin Area → Utilities/Activity Log and server PHP logs08Troubleshoot OpenAI authentication or model-access errorsVerify key validity, account access and the selected model.Admin Area → Setup → Settings → AI → OpenAI09Troubleshoot OpenAI rate-limit, quota or token errorsReduce request frequency/size or correct provider account limits.Admin Area → Setup → Settings → AI → OpenAI10Run the OpenAI Integration production verification checklistVerify settings, controlled output, fine-tuning access and privacy controls before release.Admin Area → Setup → Settings → AI → OpenAI