Prompt templates & batch

Save the prompts you reach for again and again, and generate on-brand variants at scale.

What prompt templates are

A prompt template is a saved prompt you can reuse. Templates can contain {{token}} placeholders — named slots you fill in each time. For example, a logo for {{brand}} has one token, brand, that you swap per use.

There are two kinds. Built-in templates are curated starters that ship with gramatic — covering logos, marketing, illustration, product shots and social. Your own saved templates are private to your account. Both show up wherever you pick a template.

Token names

Token names can include letters, numbers, spaces, hyphens and underscores — {{brand}}, {{art style}}, {{color_scheme}}. The same token can appear more than once and is replaced everywhere.

Managing your templates

Open the Templates page from the sidebar to create, edit and delete your own templates. Each one is just a name and a body — add {{token}} placeholders anywhere in the body to make parts swappable.

Built-in templates are read-only, but you can duplicate one to get an editable copy in your own list — a quick way to start from a proven prompt and tweak it.

Using a template in the studio

In the generation studio, open the template picker under the prompt box and choose a template. If it has tokens, a small form appears with one field per token; fill them in and the finished prompt drops into the prompt box, ready to generate. Templates without tokens prefill the prompt directly.

You can also save whatever is in the prompt box as a new template with Save as template.

One image at a time in the studio

In the studio a template produces a single image — fill the tokens, then generate as usual. To create many variants at once from one template, use the batch API below.

Templates via the API

Your templates (and the built-in ones) are available over the REST API, so you can manage them from your own code. List them, create new ones, update and delete your own — built-in templates are read-only. See the API reference for the /api/v1/templates endpoints and their shapes.

Batch generation via the API

Batch generation fans one template out across many sets of token values in a single request — for example, the same logo prompt for twenty different brand names. Post a template (by id or inline) plus a list of variable sets, and gramatic queues one generation per set.

curl https://gramati.cc/api/v1/batches \
  -H "Authorization: Bearer gmtc_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "flux-schnell",
    "template": "a logo for {{brand}}",
    "variables": [{ "brand": "Acme" }, { "brand": "Globex" }]
  }'

The response returns a batchId and the queued generations. Poll GET /api/v1/batches/{id} for aggregate status. Each variant also fires its own generation.completed / generation.failed webhook as it finishes, and the payload carries the batchId so you can correlate them — there is no single “batch done” event. Each variant lands in your gallery like any other generation.

  • Pass either templateId (a saved or built-in template) or an inline template body — and the same model and params apply to every variant.
  • A batch can hold up to 25 variants.
  • Batches are all-or-nothing: if you can’t afford every variant, the whole batch is rejected and nothing is charged.

Batch is API-only

Batch fan-out runs through the API. Each variant costs the chosen model’s normal per-image credits — templates and batching add no extra fee. See Credits & billing.