# Function: createAiHandler() (/jsdoc/pixi-vn-ai/ink/functions/createAiHandler)



\> **createAiHandler**(`options?`): `void`

Defined in: [src/ink/aiHandler.ts:112](https://github.com/DRincs-Productions/pixi-vn-ai/blob/f5205e28d51c043e8eeb27fcb2b61433f3751ac2/src/ink/aiHandler.ts#L112)

Registers four Ink Hashtag-Commands that let Ink scripts drive `@drincs/pixi-vn-ai` directly:
`# ai background`, `# ai element` (both generate an image and show it as an
[AIImageSprite](/jsdoc/pixi-vn-ai/index/classes/AIImageSprite), with an optional entrance transition), and two forms of `# ai dialog`
(generates a line of dialogue and sets it as the current narration dialogue, with or without a
speaking character). Mirrors `@drincs/pixi-vn-spine`'s own `createSpineHandler`.

Call this once, near the start of your app (alongside e.g. `addBaseHashtagCommands`), before
any Ink content is parsed.

## Parameters [#parameters]

### options? [#options]

`CreateAiHandlerOptions` = `{}`

Optional configuration for known character ids — see
CreateAiHandlerOptions.

## Returns [#returns]

`void`

## Example [#example]

```ink
# ai background bg "The throne room, lit by torches, a storm outside the windows." style "Oil painting" with dissolve duration 1
# ai element advisor "The advisor, an elderly man with a long grey beard." align { x: 0.75, y: 1 } with dissolve duration 1
# ai dialog as advisor "Greet the king with the bad news."
```
