{% set uname = user.get('username') if user else 'YOUR_USERNAME' %}
<div class="docs-content" data-render>
# AI content correction

AI content correction automatically rewrites the prose you author so it reads the way you want, using
an instruction you choose. It is **opt-in** and **off by default**. When you turn it on, your post,
comment, project, gist, message, or bio is corrected according to your instruction whenever you create
or edit it.

## What it does

When enabled, the following prose fields are corrected:

| Where | Fields corrected |
|-------|------------------|
| Posts | title and body |
| Projects | title and description |
| Gists | title and description |
| Comments | body |
| Direct messages | body |
| Your profile | bio |

Code and source files are **never** touched: a gist's source code, project files, and any code block
are left exactly as written. Correction is for prose only.

In direct messages the correction is delivered live: the corrected message appears in the chat for both
participants without a reload.

## How it works

Each correction is a single call to the platform AI gateway, authenticated with **your own API key**,
so the usage is attributed to you. The correction is fail-soft: if the AI call fails or returns
something unexpected, your original text is kept unchanged. The rewrite preserves your meaning,
language, line breaks, and markdown.

The correction applies everywhere you create or edit prose: the web interface, the REST and devRant
APIs, and the Devii assistant. New content and edits are both corrected.

## Background or synchronous

You choose **when** the correction is applied with the **Apply mode** setting:

| Mode | Behaviour |
|------|-----------|
| In background (default) | Your content is saved instantly exactly as written, then corrected a moment later. Nothing you do is slowed down; the corrected text appears the next time the content is loaded. |
| Synchronously | The save waits for the correction to finish, so the result is already corrected when the page reloads. The correction is usually fast, so this is a reasonable choice if you prefer to see the corrected text immediately. |

Both modes use your own API key and are fail-soft. The only difference is whether saving waits for the
rewrite or lets it happen just afterwards.

## Usage totals

Each successful correction is metered, and your running totals are shown on your profile: how many
corrections were made and how many tokens they used. Beyond those counts and tokens, the profile also
shows performance figures: average latency, average speed (tokens per second), and total processing
time. The dollar figures - total cost and average cost per call - are visible to administrators only;
you see the corrections, token counts, and performance figures. Totals only increase when a correction
call actually succeeds.

## Turning it on

Open your profile at `/profile/{{ uname }}` and find the **AI content correction** card. Tick
**Enable correction**, choose an **Apply mode** (background or synchronous), adjust the correction
instruction if you like, and press **Save**. The default instruction is:

> Leave literary as is, only do punctuation and casing

Replace it with any instruction up to 20000 characters, for example "fix spelling and grammar but keep
my tone" or "translate to formal English". The setting is private: only you (and administrators) can
see or change it.

## Ask Devii

You can configure it in plain language through the Devii assistant:

> Enable AI correction and only fix my punctuation.

> Apply my corrections synchronously.

> Turn AI content correction off.

Devii reads your current setting, mode, and prompt, then changes them for you.
</div>
