# AIConfig

interface

The configuration for all AI-related functionalities.

Provides configuration properties for both AI features and AI adapters (which connect to the external AI services),

```typescript
ClassicEditor
	.create( {
		ai: {
			// ...
		}
	} )
	.then( ... )
	.catch( ... );
```

See [all editor configuration options](module_core_editor_editorconfig-EditorConfig.md).

<a id="properties">

## Properties

<a id="member-assistant">

### `assistant?: AIAssistantConfig`

The configuration of the [AI Assistant feature](module_ai_aiassistant_aiassistant-AIAssistant.md).

Read more in [`AIAssistantConfig`](module_ai_aiassistant_aiassistant-AIAssistantConfig.md).

<a id="member-availableReplyActions">

### `availableReplyActions?: Array<'applySuggestion' | 'insertSuggestion'>`

Defines 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](module_track-changes_trackchanges-TrackChanges.md) feature is turned on.
* Buttons related to `'insertSuggestion'` action are hidden if [track changes](module_track-changes_trackchanges-TrackChanges.md) 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' ]`

<a id="member-chat">

### `chat?: AIChatConfig`

The configuration of the [AI Chat feature](module_ai_aichat_aichat-AIChat.md).

Read more in [`AIChatConfig`](module_ai_aichat_aichat-AIChatConfig.md).

<a id="member-container">

### `container?: AIContainerConfig`

The configuration of the AI user interface provided by the [`AITabs`](module_ai_aitabs_aitabs-AITabs.md) plugin.

<a id="member-defaultContext">

### `defaultContext?: AIDefaultContext`

A 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`](module_ai_aireviewmode_aireviewgateway-AIReviewGateway.md), [`AITranslateGateway`](module_ai_aitranslate_aitranslategateway-AITranslateGateway.md), and [`AIDocumentProcessingGateway`](module_ai_aidocumentprocessing_aidocumentprocessinggateway-AIDocumentProcessingGateway.md)) are config-independent by design and do **not** apply this option. Pass their context references explicitly through the `contexts` run option instead.

Each entry is a context reference optionally narrowed down to specific features via `features`. When `features` is omitted, the entry is attached to **every** AI feature:

```typescript
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( ... );
```

Read more in [`AIDefaultContext`](module_ai_aicore_model_aidefaultcontext-AIDefaultContext.md).

<a id="member-extraHttpHeaders">

### `extraHttpHeaders?: AIExtraHttpHeaders | () => AIExtraHttpHeaders`

Extra 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 `domain` with the `headers` to attach. A header set is attached when the image URL starts with the entry's `domain`.

Because the match is a plain string prefix, always scope each `domain` to a full origin ending with a slash, for example `https://assets.example.com/`, so it cannot match a look-alike host such as `https://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.

```typescript
ClassicEditor.create( {
	ai: {
		extraHttpHeaders: [
			{ domain: 'https://assets.example.com/', headers: { authorization: 'Bearer <token>' } }
		]
	}
} );
```

Because 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:

```typescript
ClassicEditor.create( {
	ai: {
		extraHttpHeaders: () => ( [
			{ domain: 'https://assets.example.com/', headers: { authorization: `Bearer ${ getFreshToken() }` } }
		] )
	}
} );
```

<a id="member-models">

### `models?: AIModelsConfig`

The configuration for AI models used across all AI features (Chat and Review).

```typescript
ClassicEditor.create( {
	ai: {
		models: {
			defaultModelId: 'gpt-5.4',
			displayedModels: [ 'gpt', 'claude' ],
			showModelSelector: true
		}
	}
} )
.then( ... )
.catch( ... );
```

<a id="member-overlayContainer">

### `overlayContainer?: ShadowRoot | HTMLElement`

DOM element or shadow root into which the floating user interface of the AI features – their balloons, dialogs and dropdowns – is mounted. In the [`'overlay'`](module_ai_aiconfig-AIContainerOverlay.md) container type it is also where the AI user interface itself is mounted.

When the AI user interface runs inside a shadow root, provide this container as a separate shadow root attached to a host element placed at the end of `document.body`, rather than to an element nested in the AI user interface's own tree. As a direct child of `document.body`, that host has no positioned, scrollable or `overflow: hidden` ancestor to clip the floating UI or to shift the coordinates it is positioned in.

When it is not set, the shared [`ui.overlayContainer`](module_core_editor_editorconfig-UiConfig.md#member-overlayContainer) configuration is used instead, if present. Otherwise the floating UI is mounted into the shadow root that the AI user interface lives in, so it inherits the same styles; the `document.body` default is meant just for an AI user interface in the light DOM.

<a id="member-quickActions">

### `quickActions?: AIQuickActionsConfig`

The configuration of the AI Quick Actions feature.

Read more in [`AIQuickActionsConfig`](module_ai_aiquickactions_aiquickactions-AIQuickActionsConfig.md).

<a id="member-review">

### `review?: AIReviewModeConfig`

The configuration of the AI Review feature.

Read more in [`AIReviewModeConfig`](module_ai_aireviewmode_aireviewmode-AIReviewModeConfig.md).

<a id="member-serviceUrl">

### `serviceUrl?: string`

The 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'`

<a id="member-translate">

### `translate?: AITranslateConfig`

The configuration of the [AI Translate feature](module_ai_aitranslate_aitranslate-AITranslate.md).

---

Full index of the CKEditor 5 API reference: [llms.txt](llms.txt)
