Add AI to a rich text editor in ASP.NET Core and keep keys on the server

Rewriting, shortening and translating belong right where people write. But an AI key in the browser is a key anyone can copy. RichTextBox keeps the toolbar in the browser and the provider call on your ASP.NET Core server, behind an interface you control.
Turn it on
<richtextbox id="AiToolkitEditor"
name="Body"
toolbar="default"
enable-ai-toolkit="true"
ai-toolkit-persistence-key="article-42"
height="440px"></richtextbox>
This gives you Ask AI on the toolbar, a docked chat panel, inline suggestions and a review drawer. The built-in demo resolver runs without a key, so you can try the whole flow first.
Connect a real provider
Implement the resolver and register it:
builder.Services.AddRichTextBox(); builder.Services.AddSingleton<IRichTextBoxAiResolver, MyAiResolver>();
Your resolver gets the request on the server, calls whichever provider you choose and returns the result. The browser only talks to your application, so the key stays in your configuration. The provider resolver demo has examples.
Keep control of it
- Who may use it.
RequireAuthorization()onMapRichTextBoxUploads()covers the AI endpoints too, so a stranger cannot spend your quota. - How much.
options.AiRateLimitis 30 requests per window by default, andoptions.AiRateLimitWindowis one minute. - What is sent. Your resolver sees each request before the provider does, so it can log it or refuse it. Document text goes to whichever provider you connect, so choose one that fits your data rules.
People stay in charge
AI suggestions appear as a preview, and nothing changes until someone applies them. Suggestions are also recorded in the review ledger, next to tracked changes, so a reviewer can see what the AI proposed and what was accepted.
Saved HTML is still checked
Treat model output like anything else someone could type. Keep [RichTextHtml] on the property that receives the content.
Try it
The AI toolkit demo runs with no key, and the streaming demo shows words arriving as they are generated.