# createClassicAi

Asynchronously returns a first-party AI plugin and a page-level destroy function. The host supplies browser Document and preference-storage ports.

Asynchronously returns a first-party AI plugin and a page-level destroy function. The host supplies browser Document and preference-storage ports.

`@quirekit/classic-ai` · **Commercial**

## Editor compatibility
Layer：**Classic product integration**
| Editor | Status | Assembly and boundaries |
| --- | --- | --- |
| Classic | Supported | Install this Classic product plugin in createClassicEditor plugins. Supply its required models, host ports and services as documented below. |
| Block | Unsupported | Block does not consume Classic product contributions, plugins or paginated assembly. Use shared capabilities and Block adapters instead of copying this entry's Classic configuration. |

“Supported” means the product assembly above exists; interaction, host services and file formats retain their own conditions. See [status and integration rules](/en/plugins/compatibility). Licensing is shown separately.

## Installation

The current `@quirekit/classic-ai` manifest is private. This site uses workspace source; external projects need the relevant distribution package rather than assuming public npm availability.

This entry is a commercial component. Obtain distribution access and authorization first; installation commands require that distribution source.

Install the product plugin in createClassicEditor plugins rather than Core extensions. Required host ports are listed below.

```ts
import { createClassicAi } from '@quirekit/classic-ai'

const ai = await createClassicAi({ ownerDocument: document, storage: localStorage })
// 将 ai.plugin 加入产品 plugins；页面结束时调用 ai.destroy()。
```

Use compatible versions available from your distribution source. This site uses the Alpha workspace. License labels come from package metadata; see [support and licensing](/en/support).

## Integration by editor

These snippets use an existing host element named element. The host owns container sizing and persistence; call instance.destroy() on teardown. Avoid duplicating preset capabilities and supply required host ports before installation.

### Classic

Install this Classic product plugin in createClassicEditor plugins. Supply its required models, host ports and services as documented below.

### Block

Block does not consume Classic product contributions, plugins or paginated assembly. Use shared capabilities and Block adapters instead of copying this entry's Classic configuration.

## Configuration

Pass these fields to the factory options. Required ports come from the host. undefined means no explicit option; documented factory fallbacks apply.

### ownerDocument

Document that owns the settings dialog.

Type：`Document`

Default：Required host port

### storage

Browser-local persistence for provider settings, selected model and authorization preset.

Type：`Storage`

Default：Required host port

### defaultHostUrl

AI Host used until the user saves explicit provider settings.

Type：`string | undefined`

Default：`undefined`

### reconnect

Applies saved provider settings; defaults to reloading the page.

Type：`(() => void) | undefined`

Default：`undefined`

### defaultOpen

Open the sidebar after mounting.

Type：`false | true | undefined`

Default：`undefined`

### diagnostics

Shows raw review differences for developers.

Type：`false | true | undefined`

Default：`undefined`

### fetch

Fetch implementation for tests or an application gateway.

Type：`{ (input: RequestInfo | URL, init?: RequestInit): Promise<Response>; (input: string | URL | Request, init?: RequestInit): Promise<Response>; } | undefined`

Default：`undefined`

### getHeaders

Lazy resolver for application authentication headers sent to the Host.

Type：`QuireAiPiHostHeaderResolver | undefined`

Default：`undefined`

### skillSources

Skill sources in increasing priority, each an adapter of the skill data format; default the
built-in skills and a local IndexedDB store. Ignored when `skills` gives a whole library.

Type：`readonly QuireAiSkillLibrarySource[] | undefined`

Default：`undefined`

### builtinSkills

Built-in skills shipped with the application, used with the default sources.

Type：`readonly QuireAiSkillRecord[] | undefined`

Default：`undefined`

### skills

Skills the assistant may read and follow; refreshed when the workspace is created.

Type：`QuireAiSkillLibrary | undefined`

Default：`undefined`

### workflowHints

Tells the assistant which tool and operation suit common requests; default true.
Off leaves the choice to the model, from the tool descriptions alone.

Type：`false | true | undefined`

Default：`undefined`

## Commands and runtime

This entry declares no directly enumerable commands. Children supply bundle commands; product plugins use contributions or document services.

Await the factory before installing the returned plugin. Editors release their conversations; the page also calls the returned destroy to release page-owned resources.

## Next steps

Return to [all plugins](/en/plugins), or read [configuration](/en/plugins/configuration) to distinguish options, attributes and commands.

Continue with [Classic quick start](/en/classic/quick-start) and [configuration/lifetime](/en/classic/configuration). See [product plugin development](/en/build/product-plugin) for your own UI and services.
