Legal documents with AI: drafting claims, letters and contracts

How to get a clean draft of a claim or letter from a model: source data, a template, a ban on invented citations and mandatory human review.

5 min · · бизнес · автоматизация

An AI for writing legal documents does not replace a lawyer, but it handles the first version well: the structure of a claim, a polite business letter, a contract section based on your sample. The key is that you provide the facts and the template, and a human checks the citations. Below is a working method through an API: what to feed the model, how to set the rules, how to get a draft in code and what it costs. This is a technical guide, not legal advice: you are responsible for the content of any document you send.

What the model does well and what it does not

AI for drafting legal documents fits where form and tidy text matter:

  • assemble your facts into a coherent claim using a given structure;
  • rewrite a draft in a business tone and remove repetition;
  • bring forms of address, dates and party names to a single style;
  • prepare several wordings for discussion.

Places where a model alone, unchecked, is not enough:

  • References to statutes and case law. A model can name a non-existent article number or paraphrase a rule inaccurately. This is called hallucination, and in a legal text it is especially expensive.
  • Currency of the rules. There is no guarantee that the model knows the latest edition of a law.
  • Conclusions about what to do in your case. That is the decision of a lawyer who sees all the documents.

So the rule is simple: you supply the facts and the rules, the model only formats the text.

Prepare the source data

A good draft starts with clean input. Put together a structure:

  1. Parties: roles and names (without unnecessary personal data, see below).
  2. Chronology: dates and what happened, point by point.
  3. Amounts and deadlines in numbers.
  4. What you demand and by when.
  5. The rules you want to cite: text or exact excerpts that you took from an official source.
  6. A sample: a previous successful claim or an organization template.

Don't send passport data, account numbers and phone numbers in the request unless necessary. Insert placeholders such as [NAME_1] and restore the real values in the finished file. How to log model requests without leaking data is described in logging LLM requests without leaking personal data.

Rules in the prompt

The system message sets the boundaries. A working version:

bash
You help prepare a draft of a formal business legal document.
Use only the facts and rules from the DATA block.
Do not add references to laws, articles or court decisions that are not in DATA.
If a section lacks information, put a marker [CLARIFY: what exactly] in the text.
Keep the structure of the sample. Do not advise what to do; output only the document text.

The key line is the one about rules: it makes the model use only the articles you gave it. The [CLARIFY] markers let you see gaps instead of invented details.

Getting a draft in code

An OpenAI-format request to https://api.zukko.pro/v1; endpoint details are in the chat completions documentation:

bash
from openai import OpenAI

client = OpenAI(base_url="https://api.zukko.pro/v1", api_key="fetch_your_key")

SYSTEM = """You help prepare a draft of a formal business legal document.
Use only the facts and rules from the DATA block.
Do not add references to laws, articles or court decisions that are not in DATA.
If information is missing, put a marker [CLARIFY: what exactly].
Keep the structure of the sample. Output only the document text."""

def draft(data: str, sample: str) -> str:
    user = f"SAMPLE:\n{sample}\n\nDATA:\n{data}\n\nPrepare a draft of the claim."
    resp = client.chat.completions.create(
        model="claude-sonnet-5-5",

The temperature parameter is deliberately not set in the example: newer Claude models reject values other than 1.0. Variation in wording is kept in check here by the template and the strict rules in the system message. If you use a model that accepts the parameter, you can add a low value; more in the post temperature and top_p: what to adjust.

Human review: a short checklist

Before sending the document, go through the list:

  1. Check names, dates, amounts and details against the primary documents, not against the draft.
  2. Find every reference to a rule in the text and open it in an official source: number, edition, meaning.
  3. Make sure no [CLARIFY] or [NAME_1] markers remain.
  4. Check deadlines and the way the document must be sent: they depend on your situation.
  5. For important disputes and deals, show the document to a lawyer.

For analyzing existing contracts there is a separate guide: contract analysis with AI.

Which model to take and what it costs

For legal text, accuracy matters more than speed. Start with a mid-range model and compare it with a stronger one on your own samples. Prices as of October 18, 2026, $ per 1M tokens (input / output):

ModelInput / outputStrength index
claude-sonnet-5-50.4 / 248
gpt-6.1-sol0.27 / 1.3252
claude-opus-5-50.8 / 458

Cost of one claim: 2,000 input tokens (sample and data) and 1,500 output tokens, no cache.

  • claude-sonnet-5-5: 2,000 × 0.4 + 1,500 × 2 = 800 + 3,000 = 3,800, i.e. $0.0038
  • claude-opus-5-5: 2,000 × 0.8 + 1,500 × 4 = 1,600 + 6,000 = 7,600, i.e. $0.0076
  • gpt-6.1-sol: 2,000 × 0.27 + 1,500 × 1.32 = 540 + 1,980 = 2,520, i.e. $0.0025

(values are divided by 1,000,000). For Claude in the OpenAI format all input is charged at the input price; the cache discount comes only with the Anthropic format. A stronger model does not guarantee error-free citations, so human review is needed with any model. Current prices: GET https://api.zukko.pro/v1/models.

To try it, create a key in the dashboard and run the code above on an anonymized example from your practice.

FAQ

Can I send a document written by AI without checking it?

No. Checking facts, details and rules is mandatory: a model may get an article number wrong or paraphrase a rule inaccurately. Important documents need a lawyer.

How do I reduce the risk of invented references to laws?

Give the model the texts of the rules yourself and forbid it from using others. Ask for a [CLARIFY] marker instead of guesses and verify every reference against an official source.

Is it safe to send personal data to a model?

Avoid it where possible. Replace names and details with placeholders and restore the real values in the finished file. Discuss personal-data handling and agreements with counterparties with a lawyer.

Will a cheap model do?

For simple letters possibly; for complex contract sections it is better to compare several models on your own samples. One draft costs very little and the difference between models is a matter of fractions of a cent, so the test is worth running.

zukko

Pay 25×
less

for Claude Code & ChatGPT

One fetch_* key and base URL api.zukko.pro — for Cursor, Claude Code, Codex, and any SDK.

Get API keyDocumentation

api.zukko.pro · fetch_*

AI for writing legal documents: drafts via API · Zukko