Tiptap Shorthand

Tiptap Shorthand is a token-efficient format for representing Tiptap documents. It reduces AI token costs by up to 80% compared to standard JSON, without sacrificing accuracy.

Set up Tiptap Shorthand

Define the format in which the AI reads and edits the document by setting the format parameter of the JSON body. This parameter is available on all Server AI Toolkit endpoints.

The default value of format is "json". To enable Tiptap Shorthand, pass the format: "shorthand" parameter to all your API requests.

For example, to get the tool definitions:

curl -X POST https://api.tiptap.dev/v3/ai/toolkit/tools \
  -H "Content-Type: application/json" \
  -H "X-App-Id: YOUR_APP_ID" \
  -H "Authorization: Bearer YOUR_JWT_TOKEN" \
  -d '{
    "format": "shorthand",
    "schemaAwarenessData": {}
  }'

No additional changes are required.

Format consistency

Use the same format value across all API calls in a conversation. Do not mix the json and shorthand formats within a single AI interaction.

How Tiptap Shorthand works

The /v3/ai/toolkit/schema-awareness-prompt endpoint returns a prompt that tells the AI about the document's structure and the format in which it should be generated. This includes an explanation of the format in which the AI should generate the document content. The prompt teaches the AI model about the language rules and syntax.

Tiptap Shorthand content is encoded as a text string. It takes up significantly less space than Tiptap JSON, in both characters and tokens. This results in a speed increase and cost reduction, without changing the AI model.

Next steps

  • Read the API reference to see all available endpoints and their parameters.