Formatting documents to GOST with a neural network: what AI can and cannot do
The model helps with structure, bibliography and captions, but margins, fonts and spacing are better set by a template. A division of labour and a .docx assembly example.
5 min · · автоматизация · development
A neural network for formatting documents to GOST is useful, but not where people most often ask for it. If you tell a model "format this to GOST" and attach the text, you get a plausible result in which nobody checks the margins, font and spacing. The reliable scheme is different: the model does structure, bibliography and captions, while a Word template sets the page, fonts and numbering. Below is a breakdown of what goes where, and a Python example that assembles a document from the model's answer.
What "to GOST" actually means
Formatting requirements come from several sources, and it matters which one applies:
- A university or organisation guide. For coursework, theses and reports it usually outranks everything else: a university may deviate from or refine the standard.
- GOST 7.32-2017 describes the structure and formatting rules of a research report.
- GOST R 7.0.100-2018 defines the bibliographic description, i.e. how a book, article or website is written in the reference list.
- GOST R 7.0.5-2008 covers the bibliographic reference in the text.
Do not ask the model for exact numbers (margins, font size, spacing) from memory: take them from the guide or from the standard's text. A model can get a number wrong and present it as the norm with confidence. Check the versions of the standards and their status at the time you work.
Where the model actually helps
These are tasks where meaning and text structure matter rather than page geometry.
Document structure. Split a continuous text into introduction, chapters and conclusion; propose section numbering like 1, 1.1, 1.2; check that no parts from the list you gave it are missing.
Reference list. Format entries per GOST R 7.0.100-2018 if you give it the source data: author, title, city, publisher, year, page count. Critical: do not ask the model to "find sources". It may invent a non-existent book with plausible publication details. Find sources yourself and hand the model only the formatting.
Captions and references. Bring captions to one form ("Figure 1 - Title", "Table 1 - Title") and check that every figure is referenced in the text.
One consistent style. The same dashes and quotation marks, consistent abbreviations, spelling out acronyms at first mention.
Checking against a checklist. You give the guide's requirements as a list, the model compares the text to them and returns the discrepancies found. That is easier than rereading the document three times.
What a template does more reliably
Here the model either cannot see the result or errs invisibly:
- page margins, font, size, line spacing, paragraph indent;
- page numbering and its position;
- automatic table of contents, numbering of figures and tables via Word fields;
- frames and title blocks for drawings.
These parameters must live in the Word document's styles. Set the template up once and every later work inherits correct formatting, and the neural network cannot accidentally break it.
Division of labour: a Python example
A three-step scheme. You prepare a template.docx with styles, the model turns raw text into a structure (a list of blocks), and a script puts the blocks into the template. Styles and page parameters stay in the template.
import json
from openai import OpenAI
from docx import Document # pip install python-docx
client = OpenAI(base_url="https://api.zukko.pro/v1", api_key="fetch_your_key")
raw = open("text.txt", encoding="utf-8").read()
prompt = (
"Split the text into a document structure. Return only a JSON array of blocks like "
'{"type": "h1"|"h2"|"p", "text": "..."}. Number headings as 1, 1.1. '
"Do not shorten or rewrite the text, change only the markup.\n\n" + raw
)
resp = client.chat.completions.create(The style names (Heading 1, Normal) must match those in your template; if you renamed styles, substitute yours. The script does not touch margins and fonts at all, they already sit in the styles. The library is described in the python-docx documentation; working with the SDK and key is covered in the Python reference. For a stable JSON answer, the technique from the article on strictly structured JSON helps.
Two caveats. First, check that the model returned as much text as it received: compare the character count before and after before trusting the result. Second, do not send documents with personal data to an API unless your organisation's rules allow it.
What it costs
Prices as of October 18, 2026. Suppose a document is about 15,000 tokens and the model returns the same amount as a structure:
gpt-6.1-sol(input 0.27, output 1.32 per 1M): 0.015 x 0.27 + 0.015 x 1.32 = 0.00405 + 0.0198 = about $0.024claude-sonnet-5-5(0.4 / 2): 0.015 x 0.4 + 0.015 x 2 = 0.006 + 0.03 = $0.036deepseek-v4.1-flash(0.013 / 0.038): 0.015 x 0.013 + 0.015 x 0.038 = 0.000195 + 0.00057 = about $0.0008
This is a calculation on an assumed size, not a measurement: Russian text usually takes more tokens than English, so estimate the real volume beforehand (count_tokens or the "Usage" section). Choose the model by testing on your document. How Russian text is counted is covered in the article on Russian-language tokens.
Order of work
- Get the guide from your university or organisation and put its requirements into the Word template.
- Write the text yourself or with a model, but in "raw" form, without manual formatting.
- Run the text through the script: structure and captions.
- Send the bibliography for formatting, giving the model the source data.
- Open the result in Word, update the fields (table of contents, numbering) and check the pages by eye against the guide's checklist.
You can connect in the dashboard: create a key and top up the balance in a convenient way (SBP, cryptocurrency, MasterCard).
FAQ
Can a neural network set margins and fonts in Word by itself?
Through python-docx it can, but a template with styles is more reliable: the parameters are set once and do not depend on the model's answer. Asking the model to state values from memory is a poor idea.
Can I trust a neural network with the reference list?
Only the formatting of entries, and only from the data you gave it. Do not ask it to find sources: the model may invent non-existent ones. Check the result against the originals.
Is this suitable for coursework or a thesis?
For formatting your own text, yes, but the rules on using AI in academic work are set by your university. Read them before you start.
Which model suits markup?
For "text into structure" an inexpensive model is enough; start with gpt-6.1-sol or deepseek-v4.1-flash and check the result on your document.
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.
Related articles
- Translating subtitles with a neural network: SRT without broken timecodesThe main risk when translating SRT with a neural network is a broken file structure. A scheme where timecodes never reach the model, and a Python script with validation.
- Editing texts with a neural network: proofreading, style and cuttingDifferent kinds of editing need different prompts. Wording for proofreading, style and cutting, how to get edits with explanations and how not to lose the author's voice.
- A neural network for writing scripts: Bash, PowerShell and PythonA model writes scripts for routine fast, but running them blindly is risky. How to state the task, demand a safe dry-run mode and check the result before launch.
- Dify in Docker: installation, first-run setup and connecting modelsInstall Dify with Docker Compose, create the admin account and connect Claude, GPT and DeepSeek models on one key. Plus what to do when containers will not start.