LanguageTool & AI backends

RedPen runs up to three checkers, in the order you list them, and merges their findings into one panel. The first is always on and costs nothing. The other two are optional, Pro, and off until configured.

An unconfigured backend reports itself unavailable and is skipped. A missing endpoint or a revoked key never breaks a check that the rule engine could have answered on its own.

1. Style rules

The built-in library. Pure PHP, no network, no cost, no service to go down. This is the default value of backends and the only backend in Lite. Everything in the rule reference comes from here.

2. LanguageTool

Real grammar and spelling checking, from a LanguageTool server you host.

Running one

docker run -d -p 8010:8010 erikvl87/languagetool

Then set languageToolEndpoint to its base URL. From inside DDEV that is http://host.docker.internal:8010; in production it is wherever you put the container. The setting parses environment variables, so the URL can live in .env rather than project config.

Why not the public API

RedPen will never call api.languagetool.org, and there is no setting to make it. LanguageTool’s terms explicitly prohibit automated requests from applications like this one, the public endpoint is capped at 20 requests a minute per IP, suggestions are truncated, and free cloud usage began moving behind a paywall at the end of 2025.

Shipping it as a default would work beautifully in development and then break every install at once, on someone else’s schedule. Self-hosting is genuinely free under the LGPL; it wants roughly 2 vCPU and 4 GB, which is why it can only ever be optional.

Options

SettingDefaultNotes
languageToolEndpointemptyBase URL of your server. Empty means the backend is unavailable.
languageToolTimeout10Seconds to wait before giving up.
languageToolPickyfalseAsk for the picky ruleset as well as the default one. It roughly doubles the findings on ordinary marketing copy, and the extra ones are opinions.

A profile’s dictionary is passed through, so words you have declared correct are not flagged.

3. AI review

Grammar rewriting and brand-voice review from Anthropic or OpenAI, on a key you supply.

SettingDefaultNotes
llmProvideranthropicanthropic or openai.
llmApiKeyemptyYour key. Parses environment variables, so it stays out of project config.
llmModelemptyEmpty falls back to the provider’s default.
maxFragmentLength20000Characters of a single field sent in one request.

What it will and will not do

  • Suggestions arrive as a diff with per-item accept and reject. Nothing is applied for you, ever.
  • RedPen does not trust the model’s character offsets. Models are confidently wrong about positions, so RedPen re-locates the quoted text in the source itself and discards anything it cannot find.
  • Tokens are billed to you, by your provider, at your rates. Nothing is proxied through a service of ours, and there is no per-check fee.

Enabling them

Set backends to the checkers you want, in the order they should run:

// config/redpen.php
return [
    'backends' => ['rules', 'languagetool'],
    'languageToolEndpoint' => '$LANGUAGETOOL_URL',
];

Findings from all enabled backends are merged and de-duplicated before they reach the panel, so a problem both the rule engine and LanguageTool notice is shown once.