Generate an image from a text prompt with Driftflight's API
Driftflight's text-to-image API turns one text prompt into one image, and every paid render carries a commercial licence and C2PA content credentials. A sketch image costs $0.01, a studio image $0.06 and a gallery image $0.14. Send POST https://agents.driftflight.com/zcj/jmgdqhykencp/v1/images/generate with prompt and model, pay the 402 price quote over x402 or MPP, and retry the same request to get the image URL.
At a glance
- Endpoint:
POST https://agents.driftflight.com/zcj/jmgdqhykencp/v1/images/generate, one image per request - Body:
prompt(required),model(sketch,studioorgallery),preset(optional style).modeldefaults tostudio, so set it on every request. - Price per image: sketch $0.01, studio $0.06, gallery $0.14
- Payment: a 402, the price quote, which you pay and retry. x402 (Base USDC) and MPP (Tempo USDC) are the wallet rails. No account, registration or API key.
- Response: JSON with
imageUrl,model,preset,licenceandcredits - Limits: text to image only, one image per call, listed size
1408x768on every tier - Full purchase flow: the buyer skill
Generate an image from a text prompt
Send the request with no payment attached:
curl -sS -X POST https://agents.driftflight.com/zcj/jmgdqhykencp/v1/images/generate \ -H 'Content-Type: application/json' \ -d '{"prompt": "an isometric illustration of a small lighthouse on a rocky island at dawn", "model": "sketch", "preset": "isometric"}'The storefront answers
402with a JSON body that carriespayment.id,payment.amountUsd, theplanand aprotocolsblock with anx402and anmppchallenge. The same challenges arrive in thepayment-requiredandwww-authenticateresponse headers. For sketch the quote is $0.01. Nothing is charged until you pay it.Pay the quote and retry the same request, with the body unchanged. On x402, sign the
payment-requiredchallenge and send the payload inx-payment:curl -sS -X POST https://agents.driftflight.com/zcj/jmgdqhykencp/v1/images/generate \ -H 'Content-Type: application/json' \ -H 'x-payment: <signed x402 payload>' \ -d '{"prompt": "an isometric illustration of a small lighthouse on a rocky island at dawn", "model": "sketch", "preset": "isometric"}'On MPP, sign a credential for the
www-authenticatechallenge and send it asAuthorization: Payment <credential>instead.@x402/fetch,@x402/axios, thex402package on PyPI and the Zero CLI (zero fetch) sign and retry for you.Read the response:
{"imageUrl": "https://api.driftflight.com/r/<id>", "model": "sketch", "preset": "isometric", "licence": "commercial", "credits": "C2PA content credentials embedded"}This sketch request returned
200, paid $0.01 and took 13.3 seconds.creditsis a text statement about the embedded content credentials, not a balance. An x402 response also carries apayment-responseheader and an MPP response apayment-receiptheader, for your spend records.Save the image by fetching
imageUrl:curl -sL "<imageUrl from the response>" -o lighthouseThe saved file is your copy. A payment alone does not complete the job, so confirm the file was written.
Choose a tier and preset
Every tier takes the same request. Only model and the price change.
model | Price per image | Listed size | Listed typical latency |
|---|---|---|---|
sketch | $0.01 | 1408x768 | ~2s |
studio (the default) | $0.06 | 1408x768 | ~5s |
gallery | $0.14 | 1408x768 | ~9s |
GET https://agents.driftflight.com/zcj/jmgdqhykencp/v1/models lists each tier with its maxResolution and typicalLatency for free. preset takes one of six styles: editorial, product-studio, film-noir, botanical, watercolor or isometric.
Pay by card or use the free sketch images
A single image costs less than $0.50, so a card pays for images through Prepaid credits. Buying credits needs a bearer credential, the agent identity the storefront issues, which you register through the identity guide. Then buy Prepaid credits with that bearer, an amountUsd in whole cents and "checkout": true, which returns a hosted checkout. The plan's purchase address is in the catalog.
By card, amountUsd must be at least $1. Pay the returned checkout and poll its statusUrl until it reports complete, following the card guide. Generate requests sent with Authorization: Bearer <access token> then draw down the balance. The zc-billing response header reports chargedUsd and remainingCreditUsd.
A bearer credential that a human has claimed with a verified email gets 3 free sketch images, shared across every credential the same person claims. Send a sketch request with that bearer and the zc-mode: free header.
Limits and charges
- The body takes
prompt,modelandpreset. There is no size, seed, reference image or editing of an existing image. - One request returns one image.
- An unpaid 402 charges nothing, so it is safe to stop there.
- Each pay-as-you-go call is charged once, through its own 402. A payment cannot be reused for a different request.
- After a timeout on a paid retry, reconcile the payment before paying again. Do not pay twice.
Errors
| Response | Meaning | Action |
|---|---|---|
402 with a payment block | The price quote for this call | Pay it and retry the same request, or stop |
400 invalid_request | The body is malformed | Fix the JSON and send again |
settlement_failed | The payment did not settle. settlementReason says why, such as insufficient_funds. | Fix the wallet, then start over for a fresh 402 |
409 payment_request_mismatch | A payment was reused for a different request | Request a fresh 402 and pay that one |
payment_consumed | That payment was already settled | Check whether the image was delivered before paying again |
401 bearer_required | A credit purchase or top-up needs a bearer credential | Register at the identity guide, then retry |
403 verified_email_required | The free allowance needs a claimed credential | Complete the claim step in the identity guide, then retry |
usage_exhausted | The prepaid credit is used up | Top up the balance, following How to pay, or pay per image |
Frequently asked questions
Does Driftflight's image generation API need an API key?
No. Each image is paid for on its own through the 402 quote, over x402 or MPP. Per-image calls need no account, registration or key.
How much does one image cost?
$0.01 on sketch, $0.06 on studio and $0.14 on gallery. The 402 states the exact amount before you pay.
What does a request without model cost?
It is billed as studio, because model defaults to studio. Set model in every request body to pay the price of the tier you want.
Can I pay for a single image by card?
No. The card rail's floor for one call is $0.50 and every image costs less, so a card pays for images through Prepaid credits, with a card minimum of $1.
Can the images be used commercially?
Yes. Every image bought through the storefront comes with a commercial licence, perpetual and worldwide, and embedded C2PA content credentials.
Keep reading
- Buyer skill: the full purchase flow
- How to pay: the 402 flow, rails and credit plans
- x402 payment: signing and retrying on Base USDC
- MPP payment: signing and retrying on Tempo USDC
- Error reference: every error code and how to react
