AIConfig
The configuration for all AI-related functionalities.
Provides configuration properties for both AI features and AI adapters (which connect to the external AI services),
ClassicEditor
.create( {
ai: {
// ...
}
} )
.then( ... )
.catch( ... );
Properties
assistant : AIAssistantConfig | undefinedmodule:ai/aiconfig~AIConfig#assistantThe configuration of the AI Assistant feature.
Read more in
AIAssistantConfig.availableReplyActions : Array<'applySuggestion' | 'insertSuggestion'> | undefinedmodule:ai/aiconfig~AIConfig#availableReplyActionsDefines what actions are available for the user when interacting with AI responses in AI Chat and AI Quick Actions features.
Users can perform following two actions:
'applySuggestion'- applies the presented change directly into the editor content.'insertSuggestion'- applies the presented change as a suggestion, which can be later on accepted or rejected.
This setting impacts:
- The action buttons located below an AI reply in the chat feed.
- The buttons located in the header of each change preview in the chat feed.
- The buttons located in the balloon which shows the change preview.
Through this configuration option, you can change how users use the AI replies. For example, if you want to force users to always insert AI-proposed changes as suggestions, omit
'applySuggestion'action.Please note other factors that impact the availability of these actions:
- Buttons related to
'applySuggestion'action are hidden if track changes feature is turned on. - Buttons related to
'insertSuggestion'action are hidden if track changes feature is not loaded in the editor.
Please note, that due to these factors, it is possible to accidentally configure the editor in a way, that no UI elements are presented to the user.
Defaults to
[ 'applySuggestion', 'insertSuggestion' ]chat : AIChatConfig | undefinedmodule:ai/aiconfig~AIConfig#chatThe configuration of the AI Chat feature.
Read more in
AIChatConfig.container : AIContainerConfig | undefinedmodule:ai/aiconfig~AIConfig#containerThe configuration of the AI user interface provided by the
AITabsplugin.defaultContext : AIDefaultContext | undefinedmodule:ai/aiconfig~AIConfig#defaultContextA list of context references that are automatically attached to AI features. Each entry references an administrator-managed context, which is a reusable collection of prompts and files defined through the AI service and identified by its
id.Note: The headless gateway APIs (
AIReviewGateway,AITranslateGateway, andAIDocumentProcessingGateway) are config-independent by design and do not apply this option. Pass their context references explicitly through thecontextsrun option instead.Each entry is a context reference optionally narrowed down to specific features via
features. Whenfeaturesis omitted, the entry is attached to every AI feature:ClassicEditor .create( { // ... Other configuration options ... ai: { defaultContext: [ // Attached to every AI feature. { id: 'style-guide' }, // Attached only to the `translate.*` quick actions and to every review command. { id: 'glossary', features: { quickActions: /^translate\./, review: true } } ] } } ) .then( ... ) .catch( ... );Copy codeRead more in
AIDefaultContext.extraHttpHeaders : AIExtraHttpHeaders | () => AIExtraHttpHeaders | undefinedmodule:ai/aiconfig~AIConfig#extraHttpHeadersExtra HTTP headers that the AI service should attach when it fetches document images that live behind authentication (for example a private CDN or a token-protected asset server) during image analysis.
The value is a list of entries, each pairing a
domainwith theheadersto attach. A header set is attached when the image URL starts with the entry'sdomain.Because the match is a plain string prefix, always scope each
domainto a full origin ending with a slash, for examplehttps://assets.example.com/, so it cannot match a look-alike host such ashttps://assets.example.com.incorrect.example/.It is applied only to the AI Chat message flow and the document processing flow, as these are the only cases where the AI service works with images embedded in the document.
ClassicEditor.create( { ai: { extraHttpHeaders: [ { domain: 'https://assets.example.com/', headers: { authorization: 'Bearer <token>' } } ] } } );Copy codeBecause authorization tokens expire and rotate, the value can also be a function. It is called for every request, so it can return fresh headers each time:
ClassicEditor.create( { ai: { extraHttpHeaders: () => ( [ { domain: 'https://assets.example.com/', headers: { authorization: `Bearer ${ getFreshToken() }` } } ] ) } } );Copy codemodels : AIModelsConfig | undefinedmodule:ai/aiconfig~AIConfig#modelsThe configuration for AI models used across all AI features (Chat and Review).
ClassicEditor.create( { ai: { models: { defaultModelId: 'gpt-5.4', displayedModels: [ 'gpt', 'claude' ], showModelSelector: true } } } ) .then( ... ) .catch( ... );Copy codequickActions : AIQuickActionsConfig | undefinedmodule:ai/aiconfig~AIConfig#quickActionsThe configuration of the AI Quick Actions feature.
Read more in
AIQuickActionsConfig.review : AIReviewModeConfig | undefinedmodule:ai/aiconfig~AIConfig#reviewThe configuration of the AI Review feature.
Read more in
AIReviewModeConfig.serviceUrl : string | undefinedmodule:ai/aiconfig~AIConfig#serviceUrlThe URL of the AI service endpoint.
This endpoint is used by AI features: AI Chat, AI Quick Actions, and AI Review Mode. It does not affect the AI Assistant feature, which uses its own adapter configuration.
NOTE: By default, the plugin uses the default AI service endpoint delivered by CKEditor Cloud Services.
Defaults to
'https://ai.cke-cs.com/v1'translate : AITranslateConfig | undefinedmodule:ai/aiconfig~AIConfig#translateThe configuration of the AI Translate feature.