Mintlify runs every .js file in your docs folder on every page. You add the widget with one small file.

Before you start

  • A website widget with your docs site on its Allowed origins list. You need the widget id and public key from its snippet.
  • Custom JavaScript on your Mintlify plan. It is a paid Mintlify feature.

Add the widget

1

Create a JavaScript file

Add a file such as ask-ai.js to the folder that holds docs.json.
2

Paste the loader

Mintlify has no place for a script tag, so the file adds the tag itself:
ask-ai.js
(function () {
  if (document.getElementById("kelu-widget")) return;
  var s = document.createElement("script");
  s.id = "kelu-widget";
  s.async = true;
  s.src = "https://widget.kelu.dev/kelu-widget.js";
  s.setAttribute("data-widget-id", "YOUR_WIDGET_ID");
  s.setAttribute("data-client-key", "kl_pk_...");
  document.head.appendChild(s);
})();
Replace YOUR_WIDGET_ID and kl_pk_... with the values from your widget’s snippet.
3

Preview and push

Run mint dev to check it locally, then commit and push. Mintlify redeploys with the file.

Check it works

Open any page. A round Ask AI button appears in the bottom-right corner. Ask a question and check that the answer lists its Sources. Nothing there? See Troubleshooting.
Mintlify’s search also opens with Cmd+K. Turn off Open with Cmd/Ctrl+K on the widget’s Behaviour tab so only one opens. To follow Mintlify’s dark mode, set Dark-mode selector to html.dark on the Appearance tab.