---
title: "Autocompletion in Content AI"
description: "Enable AI-powered autocompletion with Tab key triggers to stream intelligent text suggestions directly into your Tiptap editor."
canonical_url: "https://tiptap.dev/docs/content-ai/capabilities/generation/text-generation/autocompletion"
---

# Autocompletion in Content AI

Enable AI-powered autocompletion with Tab key triggers to stream intelligent text suggestions directly into your Tiptap editor.

- **1. Activate trial or subscribe**

  Start a [free trial](https://cloud.tiptap.dev/v2?trial=true) or [subscribe to the Start
  plan](https://cloud.tiptap.dev/v2/billing) in your account.
- **2. Integrate an AI provider**

  Configure OpenAI in your [AI settings](https://cloud.tiptap.dev/v2/cloud/ai) or review the
  [Custom LLM guides](https://tiptap.dev/docs/content-ai/capabilities/generation/custom-llms.md).
- **3. Install from private registry**

  To install the frontend extensions, authenticate to Tiptap’s private npm registry by following
  the [setup guide](https://tiptap.dev/docs/guides/pro-extensions.md).

When you enable autocompletion, the system uses a segment of the text you've already written to generate suggestions.

To trigger autocompletion, simply press the `Tab` key while writing. Press `Tab` again to accept the suggested completion.

If you want to see it in action, hit the `Tab` key after any line of text in this demo.

> **Interactive demo:** [AiAutocompletion](https://embed-pro.tiptap.dev/preview/Extensions/AiAutocompletion)

## Configure autocompletion

When you're integrating the Content AI extension you can specify that you want to enable autocompletion,
how the autocompletion feature should behave and what context it should consider.

| Setting                 | Type      | Default                                                                                       | Definition                                                                                                                                                                                                                                                   |
| ----------------------- | --------- | --------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `autocompletion`        | `boolean` | `false`                                                                                       | Enables the autocompletion feature. When writing text, just hit **Tab** to trigger the autocompletion and another **Tab** to accept the completion. We’re using a portion of your already written text to build a prompt for OpenAI.                         |
| `autocompletionOptions` | `object`  | `{ trigger: 'Tab', accept: 'Tab', debounce: 0, inputLength: 4000, modelName: 'gpt-4o-mini' }` | Defines the trigger and length of text used to generate autocompletion suggestion. Accept defaults to trigger, if not set explicitly. Debounce in ms the request after trigger pressed. You can also choose the OpenAI model to run the autocompletion task. |

To see all other Content AI extension configuration option, head over to the [install](https://tiptap.dev/docs/content-ai/capabilities/generation/install.md#configure-the-extension) page.

## Enable autocompletion

```js
import { Editor } from '@tiptap/core'
import StarterKit from '@tiptap/starter-kit'
import Ai from '@tiptap-pro/extension-ai'

const editor = new Editor({
  extensions: [
    StarterKit,
    Ai.configure({
      appId: 'APP_ID_HERE',
      token: 'TOKEN_HERE',
      autocompletion: true,
      // … other options (see above)
    }),
    // … more extensions
  ],
})
```

## Using with Collaboration

When using autocompletion with [Tiptap Collaboration](https://tiptap.dev/docs/collaboration/getting-started/overview.md), suggestions are private to each user and only become visible to others once accepted.
