Skip to main content
Open in larger window

What is the Rewriter?

The Rewriter lets your users select any text on your website and send it to an AI model for rewriting, then apply the result directly to the page. You can also anchor collaborative comments to any selected text range. Velt handles the AI API, text selection tracking, and DOM replacement — you control the prompts, model choice, and UX.

Key capabilities

  • Multi-model AI API — Route prompts to OpenAI (gpt-*, o1-*, o3-*, o4-*), Anthropic (claude-*), or Google (gemini-*) through Velt’s api with no additional backend setup.
  • Text selection tracking — Subscribe to textSelected events to know exactly which text a user highlighted, including its DOM position.
  • In-place text replacement — Replace the selected DOM text with AI-generated output in one API call.
  • Comment anchoring — Attach collaborative comment threads to specific text ranges for review workflows.

Use cases

Content editing tools

Let writers and editors select a paragraph and ask AI to adjust tone, simplify language, fix grammar, or expand on an idea — all without leaving the page.

Collaborative document review

Reviewers select text and leave AI-assisted feedback as anchored comments. Combine askAi for suggested rewrites with addComment to capture discussion around each change.

CMS and website builders

Give non-technical users an AI rewrite button inside your CMS. They highlight a heading or product description, pick a prompt like “Make it shorter” or “Add a call to action,” and see the update instantly.

Education and writing platforms

Students select their draft text and get AI-powered suggestions to improve clarity, fix citations, or rephrase for a different audience — with before-and-after visibility.

Localization and translation

Users highlight text and prompt the AI to translate it into another language or adapt it for a regional audience, then apply the result directly to the page.

Customer support knowledge bases

Support teams review help articles and use AI to simplify technical jargon, adjust tone for end users, or flag outdated content with anchored comments.

How it works

  1. Enable the Rewriter on any page or section of your app.
  2. Listen for text selections — when a user highlights text, you receive a TextSelectedEvent with the selected content and DOM context.
  3. Send an AI prompt — call askAi with the selected text, a prompt, and your preferred model. Velt routes the request through its api.
  4. Apply the result — call replaceText to swap the original text with the AI output in the DOM.
  5. Optionally add a comment — call addComment to anchor a collaborative comment thread to the text range.

Supported AI models

ProviderModel prefixes
OpenAIgpt-*, o1-*, o3-*, o4-*
Anthropicclaude-*
Googlegemini-*
You can use your own LLM API keys by configuring them in the Velt Console. This gives you full control over billing, rate limits, and model access. If no custom key is configured, Velt’s built-in API handles authentication by default.

Get started

Setup

Step-by-step guide to enable the Rewriter, subscribe to events, and wire up AI-powered text replacement.

Customize Behavior

API reference for all Rewriter methods — enable/disable, text events, AI prompts, replacement, and comments.