docs / Quickstart

From your JSON to a .mini workflow#

A company receives complaints and questions. Its app asks AI to interpret each message and create a ticket: an object with a title, category and priority. It needs JSON to store and assign those objects.

.mini changes how AI writes the data. A contract declares fields, order and types. A prompt is instruction text teaching AI that format. The workflow is code that validates the response, uses Repair and delivers the same JSON to your app.

See the 20-ticket use case first. Replay it without an API key and inspect validation and repair.

1. Install and open the wizard#

Download the package and extract it. From that directory:

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

The wizard asks for Spanish or English first. Choose JSON your AI already generated, define fields or use the support example. Include representative fields and types; add samples for optional fields and different structures.

Choose a short name and a new directory such as .mini. The contract defines fields and types; the prompt explains the AI output format. Both are generated.

2. Test before integration#

Open .mini/try-prompt.md and paste its contents into your AI. It includes the format in your selected language and requests 20 fictional records for the same use case. A file path alone does not give AI those instructions.

Save the response as response.mini and check it:

python .mini/validator.py response.mini

The first response may already be valid. Repair removes Markdown wrappers, BOM and Windows line endings. Incorrect types or missing data require an AI correction.

python .mini/repair.py response.mini --out corrected.mini

Pending errors mean no usable repaired response was produced. The complete example shows the workflow requesting only the incorrect line, then checking the whole result again.

3. Connect your application workflow#

mini setup offers I do not have a workflow yet, Select my file or Search my project. Choose the file where your code calls AI. Setup prepares integration instructions and, for supported Python, offers to review or apply the change with an original backup.

No code yet? Keep the toolkit. The resume command is saved in README.md and GUIA.md. Once you have the file, replace its path in:

mini integrate path/to/app.py --bundle .mini --lang en

Locate the call requesting JSON. The command prepares integration/INTEGRATE.md with actual contract and prompt paths and a diff for compatible code. Add --apply for one of the supported Python patterns; it retains a backup. Supported: the OpenAI SDK (chat.completions.create followed by json.loads) and a requests.post or httpx.post call to a chat endpoint that requests a JSON response_format, such as the DeepSeek API. In that case only the call changes: the app keeps its URL, headers, error handling and JSON reader. A response cut by the output limit keeps its complete records and only the missing ones are requested.

For other SDKs, asynchronous code or languages, give the guide to your coding AI. Read the generated prompt, change the call's output format and connect its callback to Workflow.run. Disable API JSON-only mode to receive .mini.

The complete flow: task → AI → .mini → validate → Repair → optional AI correction → revalidate → JSON. The app gets data only when the entire response validates. Require an expected record count to block incomplete batches.

See integration code.

4. Replay a complete run#

From the package directory:

python examples/flujo-soporte/run.py

There are 20 messages, a saved .mini response and a one-line correction. The actual workflow delivers output/soporte/result.json and saves history.json. Responses were authored by Muse; errors were inserted for illustration, not to measure AI reliability.

For the local form with recorded and live AI modes:

python examples/flujo-soporte/run.py --serve

Open the printed address. The form asks for an API key and model only in live mode. The key stays in memory and is not stored in history. Real calls and corrections have provider costs. Integrate your own callback to keep your provider.

What about savings?#

Tokens are pieces of text counted for API billing. At the same model and rate, fewer response tokens mean lower output cost. Total cost also includes instructions and corrections.

The same 20-ticket output takes 443 JSON tokens, 304 TOON tokens and 278 .mini tokens with o200k_base. The .mini prompt has 571 tokens; retries are extra. Fewer output tokens alone do not prove lower total cost, especially for small batches. Explore costs.

Already familiar with .mini: commands and references `mini build sample.json --prefix ticket --out .mini --lang en` creates the same toolkit without the wizard. Multiple sample files are accepted. For JSON Schema, see `mini from-schema --help` and the [base profile](/docs/spec/). The [14 sample families](/docs/forks/) are optional. The [playground](/playground/) is for base-format practice. Generated toolkits use Python; [Node/TypeScript](/docs/typescript/) implements base SPEC 1.1.