mini-format 1.3.3 · from AI to your app, step by step get started →

1.3.3 .mini · For apps that request JSON from AI

Your AI can
cost less.

.mini is a compact format for AI-generated data: orders, products, tickets or the objects your app needs. JSON repeats field names in every object; .mini uses a contract to avoid that repetition and reduce billable text.

You define the fields once in a contract; AI replies in .mini and the code checks it and converts it to JSON for your app. Fewer tokens—the pieces of text AI bills—can reduce response cost. Total cost also depends on instructions and retries.

See an integration example →Download and get started

Where text gets shorter

JSON repeats field names.
.mini agrees on the rules once.

  1. 01

    JSON

    Every ticket writes "title", "category" and "priority" again, with quotes and punctuation. AI also generates and bills that text.

  2. 02

    TOON

    It also reduces repetition: a table declares fields once. It is another alternative for structured data responses.

  3. 03

    .mini

    Tailors a contract to your domain: support, orders or inventory. Each line uses the agreed field order and the code knows its types. Your app gets JSON back.

For the 20 measured tickets, .mini uses 278 tokens versus TOON's 304 and JSON's 443. The benefit depends on your data; include instructions and corrections before calculating total savings.

What mini setup does

Your format starts
with the data you need.

It is a terminal wizard. Give it JSON like the data your app needs; it prepares format rules and connects them to your AI call.

  1. 01

    Describe your JSON

    Choose Spanish or English and a data sample. The contract stores its fields, order and types: the rules of your .mini.

  2. 02

    Get your toolkit

    The prompt contains AI instructions. The workflow is code that checks the response, repairs it when possible and returns JSON.

  3. 03

    Choose your workflow file

    Select the code that calls AI to prepare integration. If you do not have it yet, the guide saves the command for later.

Follow installation and setup →

Includes a prompt to test 20 objects before connecting your application.

Inside your code

Check first.
Save afterwards.

The workflow connects your AI call to the validator and parser. The validator checks the rules; Repair fixes formatting problems. The parser converts a valid response to JSON objects for your app.

If a type is wrong or data is missing, the workflow can request an AI correction and check again. The animation shows a recorded run with 20 tickets.

Inspect the recorded run →Open the playground
20 tickets · .mini → JSON0:00 / 0:36

Start with a JSON sample.

Download and extract the package. Install the included Python file and open the wizard:

python -m pip install --no-index mini_format-1.3.3-py3-none-any.whl
mini setup

The wizard asks for your language, reads your JSON sample and prepares the toolkit. Then select your AI call file or “I do not have a workflow yet” to connect it later.

Download .mini 1.3.3 ↓Follow the guide

Python 3.9+ · MIT · 20-ticket example and history included.

More measurements and technical documentation

DummyJSON products

194 records · Public test data

Output tokens relative to .mini · lower is better. o200k_base

mini-formatmini-domain/11.00×
CSVflat1.05×
TOONflat1.07×
JSONcompact1.39×
TOONoriginal1.46×
YAML1.21.56×
XMLelements2.65×
6.11% fewer tokens than flat TOON. Includes document metadata and dictionaries; reusable prompt measured separately.method →

More fields,
greater savings.

JSON repeats every field name in every object. mini-format declares it once in the contract. Field-name cost grows as O(W·N) in JSON and O(W) here.

3 fields

narrow record

savings32.2 %
20 fields

typical business record

savings46.7 %
50 fields

wide record

savings49.3 %

Savings versus compact JSON · linear scale from 0%, maximum 50% · 1,000 records · o200k_base · median of 5 documents per cell · deterministic synthetic data (seed 20260915). The curve levels off near 32 fields. reproduce →

Same data.
Measured token savings.

1,902 records from four public datasets. 35.64% fewer tokens than compact JSON and 9.65% fewer than flat TOON across the measured total.

Output tokens, savings and reusable prompt cost
DatasetN.miniTOON flatSaved vs TOONSaved vs CSV.mini prompt
DummyJSON products19464,09068,2606.11 %4.42 %1,206
DummyJSON users20843,26860,92628.98 %27.92 %1,796
JSONPlaceholder comments50030,26831,0222.43 %-1.35 %477
USGS earthquake observations1,000164,137173,8035.56 %4.11 %1,336

USGS: 1,000 real observations. DummyJSON and JSONPlaceholder: 902 synthetic test records, never duplicated to inflate the batch. Exact JSON round-trips for all eight formats. Official TOON 4.1.1; the smaller of two reversible flattening variants is selected. Savings describe output tokens; the .mini prompt is shown separately. CSV remains smaller for comments. This measures serialization, not LLM generation accuracy. Method and reproduction → · JSON

The same document
has a different cost in each model.

Separators tokenize differently across vocabularies. Same 14 domains, batches of 10, versus compact JSON.

r50k_base

50k vocabulary

savings30.2 %

95% CI [26.8 % · 31.5 %] · k=14

cl100k_base

100k vocabulary

savings32.2 %

95% CI [29.1 % · 33.5 %] · k=14

o200k_base

200k vocabulary

savings34.1 %

95% CI [31.5 % · 35.5 %] · k=14

Linear scale from 0%, maximum 36%: a 3.9-point difference between the oldest and newest vocabulary. All three are tiktoken vocabularies. reproduce →

Interface

Everything comes
from the contract.

pythonminifmt 1.3.3
from minifmt import Contract, parse, dumps, spec_block, roundtrip_ok

c = Contract.load("contrato.json")     # el contrato de tu aplicación

instruccion = spec_block(c, lang="es")      # bloque para el prompt de sistema
doc = parse(respuesta, c, strict=False)     # tolerante: no lanza, acumula

doc.records                                 # registros válidos, ya tipados
for e in doc.errors:                        # MiniError: code, line, field, message
    print(e)

texto = dumps(doc.to_canonical(), c)          # canónico -> .mini
assert roundtrip_ok(doc.to_canonical(), c)

Comparison

What each format does
when a model writes the output.

Capabilitymini-formatJSONCSVTOON
Fewer tokens than compact JSON✓—✓✓
Contract-declared types✓partial✗partial
Errors with code, line and field✓partial✗✗
Stable specification error codes15✗✗✗
Truncation recovery✓✗✓partial
Selective per-line repair✓✗✗✗
Record-by-record streaming✓partial✓✗
Published conformance suite376✓✗✗
Two independent implementations✓✓✓partial
Lists with a selected item✓✗✗✗
Declared forward compatibility✓✗✗✗
Arbitrary nesting✗✓✗✓
Reading without a contractpartial✓✓✓
Native provider API support✗✓✗✗

Forward compatibility preserves known fields when the same prefix declares a higher version. The base profile uses flat records; the generated toolkit reconstructs your domain's JSON structure. The model needs the prompt; the reader needs the contract.

376 language-independent cases, with expectations derived from the specification rather than calculated by the code. Python and TypeScript pass 376/376.

Gramática EBNF, 15 códigos de error estables y protocolo de extensión.

Ver las pruebas de conformidad →

Specification · Validation · Error reference · Optional examples