Install
First, contact our team to get access to the Server AI Toolkit.
After getting access, configure your package manager by following the private registry guide.
Then, install the package:
npm install @tiptap-pro/server-ai-toolkitGet schema awareness data
To use the Server AI Toolkit API, you need to get schema awareness data from your Tiptap editor. This data describes the document structure and helps the AI understand what content is valid.
import { Editor } from '@tiptap/core'
import StarterKit from '@tiptap/starter-kit'
import { getSchemaAwarenessData } from '@tiptap-pro/server-ai-toolkit'
const editor = new Editor({
extensions: [StarterKit],
})
// Get schema awareness data from the editor
const schemaAwarenessData = getSchemaAwarenessData(editor)The getSchemaAwarenessData function returns schema awareness data that describes the document structure for the Server AI Toolkit API.
Store the schema awareness data
The schema awareness data returned by getSchemaAwarenessData is a JSON-serializable object that
you can store in your database. You don't need to generate it every time—only update it when your
Editor extensions or schema change.
For more details, see the Schema awareness API reference.
Set up authorization
The Server AI Toolkit is a cloud or on-premises service. Authenticate to access its REST API.
- Get your App ID and secret key on the Tiptap Cloud AI settings page.
- Generate a JWT using a library like
jsonwebtoken. In production, always create JWTs server-side to keep your secret safe. - Use the JWT in your API requests. Pass it in the
Authorizationheader as a Bearer token and the App ID inX-App-Id.
import jwt from 'jsonwebtoken'
const TIPTAP_CLOUD_AI_API_URL = 'https://api.tiptap.dev'
const TIPTAP_CLOUD_AI_SECRET = 'your-secret-key'
const TIPTAP_CLOUD_AI_APP_ID = 'your-app-id'
// Generate JWT token from secret
const JWT_TOKEN = jwt.sign({}, TIPTAP_CLOUD_AI_SECRET, { expiresIn: '1h' })
// Request headers for the Server AI Toolkit API
const headers = {
'Content-Type': 'application/json',
Authorization: `Bearer ${JWT_TOKEN}`,
'X-App-Id': TIPTAP_CLOUD_AI_APP_ID,
}Call API endpoints
Once authenticated, call the Server AI Toolkit API endpoints:
const response = await fetch(`${TIPTAP_CLOUD_AI_API_URL}/v3/ai/toolkit/tools`, {
method: 'POST',
headers,
body: JSON.stringify({
schemaAwarenessData,
}),
})
const tools = await response.json()For complete API documentation, see the REST API reference.
Next steps
Now that you've set up the Server AI Toolkit, start building your AI integration: