Content AI editor commands

The Content AI for Tiptap Editor includes a set of preconfigured commands that you can integrate into your rich text editor. These commands allow you to adjust text tone, complete text, generate images, and more, enhancing your editor's functionality.

To see how these commands are used, check out the examples on the overview page.

CommandDescription
aiAdjustTone(tone: Tone, options: TextOptions)Adjusts the tone of voice of the selected text to the specified TONE.
aiBloggify(options: TextOptions)Rewrite the text into a blog format
aiComplete(options: TextOptions)Completes the selected text
aiDeEmojify(options: TextOptions)Removes emojis from the selected text
aiEmojify(options: TextOptions)Adds emojis ✨ to your text
aiExtend(options: TextOptions)Extends your text
aiFixSpellingAndGrammar(options: TextOptions)Fixes spelling & grammar
aiKeypoints(options: TextOptions)Summarizes your text to a list of key points
aiRephrase(options: TextOptions)Rephrases the selected text
aiRestructure(options: TextOptions)Restructures the selected text to use rich text formatting
aiShorten(options: TextOptions)Shortens the selected text
aiSimplify(options: TextOptions)Rephrases your text in simplified words
aiSummarize(options: TextOptions)Summarizes your text
aiTextPrompt(options: TextOptions)Runs your custom prompt
aiTldr(options: TextOptions)Creates a "Too Long; Didn't Read" version text
aiTranslate(language: Language, options: TextOptions)Translates the selected text into the specified language
Utility
aiAccept(options: AcceptOptions)Accept the generated response, and insert it into the editor
aiReject(options: RejectOptions)Reject the generated Response, resetting ai.storage state
aiRegenerate(options: RegenerateOptions)Regenerate a response using the same parameters

Most text commands

Most of the text commands accept the same options and their usage is similar. The following example demonstrates how to use the aiBloggify command:

editor.chain().focus().aiBloggify(options: TextOptions)

aiAdjustTone

// Tone: 'default' | 'academic' | 'business' | 'casual' | 'childfriendly' | 'confident' | 'conversational' | 'creative' | 'emotional' | 'excited' | 'formal' | 'friendly' | 'funny' | 'humorous' | 'informative' | 'inspirational' | 'memeify' | 'narrative' | 'objective' | 'persuasive' | 'poetic' | string
editor.chain().focus().aiAdjustTone(tone: Tone, options: TextOptions).run()

aiTranslate

Translates the selected text content into the given output language.

It accepts two letter ISO 639-1 language codes.

// Language: 'en' | 'de' | 'nl' | ...
editor.chain().focus().aiTranslate(language: Language, options: TextOptions).run()

Text command options

On every command which supports TextOptions, you’re able to specify the following options:

SettingTypeDefaultDefinition
modelNamesee Supported text modelsgpt-3.5-turboThe model used at OpenAI
format'rich-text' | 'plain-text'plain-textDetermines the format of how the model should respond
streambooleanfalseShould the command stream characters to the editor? It’s like the typewriter behavior in ChatGPT. This requires the newest extension version!
insertAtundefined | number | {from: number; to: number}undefinedWhere to insert the response into the editor, if undefined the response will be inserted at the current selection. If a number, the response will be inserted at that position. If an object it will replace that range.
languagestring (e.g. en, de)nullAlthough we do our best to prompt OpenAI for a response in the language of the input, sometimes it’s better to define it yourself.
tonestringnullA voice of tone the response should be transformed to
textLengthnumberundefinedThe number of textLengthUnits the AI should respond with (e.g. the 3 in "3 paragraphs")
textLengthUnit'paragraphs' | 'words' | 'characters'undefinedThe unit of textLengths the AI should respond with (e.g. the paragraphs in "3 paragraphs")
collapseToEndbooleantrueWhether the cursor should be set to the end after the operation or the insertion should get selected.
contextArray<{ type: 'text', text: string} | { type: 'url', url: string }>[]Context to provide the model for generating a Response.
textstringundefinedAn optional message to have the model respond to
insertbooleantrueAllows disabling inserting content directly into the editor
appendbooleantrueIf true, the response will be appended to the end of the current selection. If false, the response will replace the current selection.

Unfortunately the combination of tone and language sometimes leads to responses which are not in the desired language.

Supported text models

We currently support the following OpenAI chat models:

  • gpt-4o
  • gpt-4o-2024-05-13
  • gpt-4
  • gpt-4-turbo-preview
  • gpt-4-0125-preview
  • gpt-4-1106-preview
  • gpt-4-0613
  • gpt-4-32k
  • gpt-4-32k-0613
  • gpt-3.5-turbo-0125
  • gpt-3.5-turbo
  • gpt-3.5-turbo-1106
  • gpt-3.5-turbo-16k

Choose the right Model

When configuring the Tiptap AI extension, consider the specific needs of your application:

  • For Cost-Effective Operations: Opt for GPT-3 or DALL-E 2 if the primary concern is budget and the tasks do not demand the most advanced capabilities.
  • For Advanced Requirements: Choose GPT-4o or DALL-E 3 when your application requires the highest level of language understanding or image generation quality, and budget is less of a constraint.

The Tiptap AI extension's flexible configuration allows you to tailor the AI integration to match your specific requirements and budgetary considerations.

Note: The pricing details are not provided here due to variability and the need for up-to-date information. It's recommended to refer to the official OpenAI pricing page for the latest figures.