← All tools

Grammar Checker API for Developers

Adding grammar checking to a SaaS product, a docs pipeline, or an internal tool? There are three honest routes: build on an LLM API with a code-aware prompt, bring your own key to a ready-made checker, or use a dedicated proofreading API. This page compares them with working code.

Short version: if your text lives next to code, mask code spans before checking — whichever API you choose. That one step removes most false positives.

Try the code-aware checker → Free, no signup for your first checks.

What a grammar checker API is for

Typical integration points: comment and review boxes in a SaaS product, support-reply drafting, documentation pipelines that lint prose in CI, PR-description bots, and internal writing tools for non-native teams. The common requirements are structured output (offsets + replacements, not just a rewritten paragraph), predictable cost, and — for developer-facing products — not flagging code as English.

One fact shapes the whole comparison: Grammarly has no general HTTP API. Its Text Editor SDK was discontinued on January 10, 2024, and it only ever ran in browsers. Every serious integration today uses one of the three routes below.

Option A: Build on an OpenAI-compatible LLM API

The flexible route: call a chat-completions endpoint with a strict system prompt that returns JSON edits, and wrap it with code masking. AiCredits (our main API product) exposes an OpenAI-compatible endpoint with DeepSeek models, pay-per-token credits, and no monthly minimum:

curl https://aicreditsapi.com/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "deepseek-v4-flash",
    "messages": [
      {"role": "system", "content": "You are a grammar checker for developer writing. The text contains placeholders like [[CODE0]] for code spans; never flag or alter them. Return JSON only: {\"edits\": [{\"original\": \"...\", \"replacement\": \"...\", \"reason\": \"...\"}]}. If there are no errors, return {\"edits\": []}."},
      {"role": "user", "content": "Check this text: The function [[CODE0]] return null when the row is missing."}
    ]
  }'

The same call in Python, with the masking step that makes it code-aware:

import re, requests

CODE_SPAN = re.compile(r"`[^`]+`|\b[a-z]+[A-Z][A-Za-z0-9]*\b|--[a-z][a-z-]*|/[\w./-]+")

def mask_code(text):
    spans = []
    def repl(m):
        spans.append(m.group(0))
        return f"[[CODE{len(spans)-1}]]"
    return CODE_SPAN.sub(repl, text), spans

def check(text, api_key):
    masked, spans = mask_code(text)
    resp = requests.post(
        "https://aicreditsapi.com/v1/chat/completions",
        headers={"Authorization": f"Bearer {api_key}"},
        json={
            "model": "deepseek-v4-flash",
            "messages": [
                {"role": "system", "content": SYSTEM_PROMPT},
                {"role": "user", "content": f"Check this text: {masked}"},
            ],
        },
        timeout=30,
    )
    edits = resp.json()["choices"][0]["message"]["content"]
    # Parse the JSON edits, drop any that touch a [[CODE..]] placeholder,
    # then apply replacements to the original text.
    return edits

Why this route wins for many teams: you control the prompt (tone, scenario, ESL explanations), cost scales with tokens actually used, and the masking pattern above is exactly how Lint keeps identifiers, SQL, and flags out of the checker's reach. The trade-off: output is model-generated, so validate the JSON and treat edits as suggestions, not truth. Get credits and a key at aicreditsapi.com — signup is email-only, and the same key works with any OpenAI-compatible client.

Option B: Bring your own key to Lint

If you want the UI and the code-aware pipeline without building them, Lint's web tools accept your own DeepSeek or OpenAI-compatible API key (BYOK). With your key connected, checks in the Lint tools run on your quota with no Lint-side limits — the masking, scenario handling, and L1 diagnosis are already built. This suits teams who want a ready-made checker for humans (docs, PRs, support replies) rather than an embeddable API. Start from the grammar checker and connect your key in settings.

Option C: Dedicated proofreading APIs

API Output Free tier Paid Code handling
LanguageTool Matches with offsets, rule IDs, replacements; 30+ languages Public endpoint, no key: 20 req/min per IP, 20KB per request; automated traffic discouraged Proofreading API plans by daily call volume; self-hosting the open-source server is free Prose-first; use your own masking for code spans
Sapling JSON edits with sentence offsets and error types; Python/JS SDKs Rate-limited developer key for testing Usage-based, from $0.025 per 1,000 input characters Strong on technical/legal text; still prose-oriented — mask code yourself
AiCredits (LLM route) Whatever your prompt specifies — JSON edits, explanations, rewrites Free trial credits on signup Pay per token, no monthly minimum Masking pattern above; full control over scenario and tone

Details as documented by each vendor in December 2026; confirm current limits and pricing before committing.

Which route should you choose?

  • Embedding checks in your own product UI: a dedicated API (LanguageTool or Sapling) gives you stable edit offsets and predictable behavior; add masking if your users paste code.
  • Internal tooling, bots, CI prose checks, low-to-moderate volume: the LLM route — cheapest to start, easiest to customize, and the masking pattern keeps code safe.
  • Humans checking text in a browser, with your own key: Lint BYOK — no integration work at all.
  • Data-residency or offline requirements: self-host LanguageTool, or run a local model behind the same prompt pattern.

FAQ

Is there a free grammar checker API?

Yes. LanguageTool's public endpoint is free without a key (20 requests/minute per IP, 20KB per request), with the caveat that automated traffic should use a paid plan or a self-hosted instance. AiCredits includes free trial credits, and Lint's web checker is free for your first checks each day.

Does Grammarly offer an API?

No general HTTP API. Grammarly's Text Editor SDK was discontinued on January 10, 2024, and it only ever ran in web browsers. Backend and custom-frontend integrations use LanguageTool, Sapling, or an LLM API.

How do I stop a grammar API from flagging code?

Mask code spans before the check and restore them after: replace inline code, fenced blocks, identifiers, paths, URLs, and CLI flags with placeholders like [[CODE0]], run the check on the prose, then drop any suggestion that touches a placeholder. The Python sample above shows the pattern.

What is the cheapest way to add grammar checking to a SaaS product?

At low volume, an OpenAI-compatible LLM API with a strict JSON-output prompt — you pay per token with no monthly minimum. At high volume, a dedicated proofreading API gives structured edits and rate guarantees; self-hosting LanguageTool removes marginal cost entirely if you can operate the server.

Want the checker without the integration work? Lint Pro is $12/month, or $39 for the first year at the founding price — 500 checks a day across all 16 tools.

See Lint Pro → Or get API credits and build your own.

Going deeper: our tutorial How to Build a Grammar Checker with DeepSeek API walks through a full Flask implementation, and Best Grammar Checker APIs for Developers compares more options side by side. Choosing where your team writes instead? Our editor integration matrix compares Lint, Grammarly, LanguageTool, and Harper across VS Code, JetBrains, Neovim, and Sublime.

Need more than free tools?

Unlock 500 checks a day, larger text capacity, and priority support.

View pricing → Upgrade Lint — Pro $12/mo or $39/yr founding
💬