# Generate consistent product images with Driftflight's API

Driftflight's text-to-image API keeps a set of product images looking like one set when every request uses the same three values: a `preset`, a prompt template that changes only the product, and a `model` tier. Each product is one request to `POST https://agents.driftflight.com/zcj/lvfj2qnm63bc/v1/images/generate`, at $0.06 on studio, with template drafts on sketch at $0.01. You pay each request's 402 price quote over x402 or MPP, retry the same request, and download the image from `imageUrl`.

## At a glance

- **Endpoint:** `POST https://agents.driftflight.com/zcj/lvfj2qnm63bc/v1/images/generate`, one image per request
- **Body:** `prompt` (required), `model` (`sketch`, `studio` or `gallery`; billed as studio if omitted), `preset` (one of six styles)
- **Consistency controls:** the same `preset`, prompt template and `model` on every request in the set
- **Price per image:** sketch $0.01, studio $0.06, gallery $0.14
- **Payment:** a 402 is the price quote for one request, which you pay and retry. x402 and MPP are the wallet rails, settling in USDC. No account or API key.
- **Response:** JSON with `imageUrl`, `model`, `preset`, `licence` and `credits`
- **Limits:** no seeds, reference images, colour matching, custom sizes, editing or batch parameter. Every tier lists `1408x768`.
- **Full purchase flow:** [the buyer skill](https://agents.driftflight.com/zcj/lvfj2qnm63bc/SKILL.md)

## Fix the preset, template and tier for the set

The API has no seed or reference image to hold a look. Consistency comes from sending the same three values every time.

| Value | Field | Set it to |
| --- | --- | --- |
| Style | `preset` | One of `editorial`, `product-studio`, `film-noir`, `botanical`, `watercolor` or `isometric`. `GET https://agents.driftflight.com/zcj/lvfj2qnm63bc/v1/presets` lists them for free. |
| Wording | `prompt` | A template with one product slot, such as `{product}, centered on a plain warm grey background, soft diffused studio light, three-quarter view` |
| Tier | `model` | `sketch` to test the template, `studio` for every image in the set |

Only the product slot changes between requests. Background, light and angle stay word for word.

## Render the catalog set, one request per product

1. Test the template on sketch. Send the request unpaid:

   ```bash
   curl -i -X POST https://agents.driftflight.com/zcj/lvfj2qnm63bc/v1/images/generate \
     -H 'Content-Type: application/json' \
     -d '{"prompt": "a matte black ceramic coffee mug, centered on a plain warm grey background, soft diffused studio light, three-quarter view", "model": "sketch", "preset": "product-studio"}'
   ```

   The storefront answers `402 payment_required`. The body carries `payment.amountUsd` and a `protocols` block with a challenge for each rail. Nothing is charged yet, so it is safe to stop here.

2. Pay the 402 with your x402 or MPP client and retry the same request with the proof attached: in the `x-payment` header for x402, or as `Authorization: Payment <credential>` for MPP. A paid request returns `200`:

   ```json
   {"imageUrl": "https://api.driftflight.com/[path]", "model": "sketch", "preset": "product-studio", "licence": "commercial", "credits": "C2PA content credentials embedded"}
   ```

   This example draft paid $0.01 and took 15.6 seconds. If the wording is wrong, edit the template and draft again on sketch, where each attempt costs least. The studio render of the same prompt is a separate render, not a finished version of the draft.

3. Render each product on studio. Set `model` to `studio`, keep `preset`, and fill only the product slot:

   ```json
   {"prompt": "a tan leather card wallet, closed, centered on a plain warm grey background, soft diffused studio light, three-quarter view", "model": "studio", "preset": "product-studio"}
   ```

   Four products fill the slot in the example set, each its own request and its own 402: `a matte black ceramic coffee mug`, `a tan leather card wallet, closed`, `a frosted glass candle jar with a wooden lid` and `a natural canvas tote bag`.

   - The mug render paid $0.06 and took 12.3 seconds.
   - The wallet render paid $0.06 and took 11.3 seconds.
   - The candle jar render paid $0.06 and took 20.6 seconds.
   - The tote bag render paid $0.06 and took 12.3 seconds.

4. Download each image under its product's name, with the extension that matches the content type of the download. The saved file is the copy you keep:

   ```bash
   curl -sL "<imageUrl>" -o images/matte-black-mug.<ext>
   ```

5. Record the three values next to the images, so products added later use the same ones:

   ```json
   {"preset": "product-studio", "model": "studio", "template": "{product}, centered on a plain warm grey background, soft diffused studio light, three-quarter view"}
   ```

## Budget for the set

A set costs its drafts times $0.01 plus its products times $0.06. One draft and four products cost $0.25. Three drafts and fifty products cost $3.03. Pay-as-you-go is one 402 per call, so compare each quote's `payment.amountUsd` with the budget left and stop before paying one that exceeds it.

Each tier's price is below the card rail's per-call floor of $0.50, so a card pays through Prepaid credits instead. POST to the credits plan's `purchase.url` from [the catalog](https://agents.driftflight.com/zcj/lvfj2qnm63bc/manifest.json), a `/plans/{planId}/purchase` path, with a bearer credential and an `amountUsd` of at least $1. A bearer credential is the agent identity the storefront issues; register one through [auth.md](https://agents.driftflight.com/zcj/lvfj2qnm63bc/auth.md). Image calls then draw down the balance.

A credential that a human has claimed with a verified email has 3 free sketch images, sent with the `zc-mode: free` header, which can cover drafts.

## Limits

- One image per request. There is no batch parameter, so a set of fifty products is fifty requests.
- The same three values hold a shared look. They do not reproduce an earlier image.
- A request without `model` is billed as studio. Set it on every request.
- After a timeout on a paid request, check the result before retrying, so you do not pay twice.

## Errors

| Status or code | Meaning | Action |
| --- | --- | --- |
| `402 payment_required` | The request is unpaid; the body is the quote | Pay it and retry the same request |
| `400 invalid_request` | The body is malformed | Fix the JSON and send again |
| `settlement_failed` | The payment did not settle; `settlementReason` says why | Fix the wallet, then send the request again for a fresh 402 |
| `payment_consumed` | That payment was already settled | Check the original request's delivery before paying again |

## Frequently asked questions

### How do I keep AI product images consistent without seeds or reference images?

Send the same `preset`, the same prompt template and the same `model` on every request, and change only the product named in the template. Driftflight's API takes no seed, reference image or colour target, so those three values are the controls that hold a set together.

### Which Driftflight preset suits product photos?

The example set uses `product-studio`, one of the six presets `GET https://agents.driftflight.com/zcj/lvfj2qnm63bc/v1/presets` lists. Any preset holds a set together as long as every request in the set uses the same one.

### What is the price of catalog images on Driftflight?

Each studio image costs $0.06 and each sketch draft $0.01. Multiply by the number of products and drafts, such as $3.03 for three drafts and fifty products.

### Can I add products to the set later?

Yes. Use the recorded preset, template and tier, and put the new product in the slot. The new image is made under the same three values, and the earlier images are untouched.

### Do I need an API key or account?

No. Pay-as-you-go calls need no key, account or registration; the payment on each 402 is enough. Only a credits purchase or the free allowance needs a bearer credential.

## Keep reading

- [Buyer skill](https://agents.driftflight.com/zcj/lvfj2qnm63bc/SKILL.md): the full purchase flow
- [How to pay](https://agents.driftflight.com/zcj/lvfj2qnm63bc/payment.md): the 402 flow, each rail and plan purchases
- [Error reference](https://agents.driftflight.com/zcj/lvfj2qnm63bc/errors.md): every error code
- [Catalog](https://agents.driftflight.com/zcj/lvfj2qnm63bc/manifest.json): live prices and plans

---

Updated 2026-10-08. All Driftflight guides: https://agents.driftflight.com/guides.md. Storefront: https://agents.driftflight.com/zcj/lvfj2qnm63bc/llms.txt.
