# DeepAI API quickstart: generate an image from a text prompt

DeepAI's text-to-image API generates one image from a text prompt per request and returns a link to it in `output_url`, with no account or API key. You choose the tier on each request, and the cheapest tier, hd, costs $0.01. Send `POST https://deepai.pay.zeroclick.io/zcj/0j1bz0u30i2u/api/text2img` with `text` and `image_generator_version`, pay the 402 price quote it answers with, and retry the same request.

## At a glance

- **Endpoint:** `POST https://deepai.pay.zeroclick.io/zcj/0j1bz0u30i2u/api/text2img`, one image per request
- **Body:** `text` (required), `image_generator_version` (required: `hd`, `genius` or `super_genius`), `genius_preference` (genius only)
- **Price per image:** hd $0.01; genius $0.08; super_genius $0.25
- **Payment:** each request answers with a 402 price quote, paid from a wallet over x402 or MPP. No account or API key is needed.
- **Response:** JSON with `id` and `output_url`
- **Limits:** one image, and one `output_url`, per request
- **Full purchase flow:** [the buyer skill](https://deepai.pay.zeroclick.io/zcj/0j1bz0u30i2u/SKILL.md)

## Generate an image from a text prompt

1. Send the request without payment:

   ```bash
   curl -i -X POST https://deepai.pay.zeroclick.io/zcj/0j1bz0u30i2u/api/text2img \
     -H 'Content-Type: application/json' \
     -d '{"text": "A lighthouse on a rocky coast at dusk, watercolor", "image_generator_version": "hd"}'
   ```

   The storefront answers `402 Payment Required`, with the exact price in `payment.amountUsd`. Check it against your budget before you pay.

2. Pay the quote with your x402 or MPP client, which resends the identical request with the proof attached. [The buyer skill](https://deepai.pay.zeroclick.io/zcj/0j1bz0u30i2u/SKILL.md) has the details.

3. Read the response. A paid call returns `200` with this shape:

   ```json
   {"id": "<string>", "output_url": "<string>"}
   ```

   The example request above paid $0.01 for one hd image. Every paid response also carries a `zc-billing` header, and its `chargedUsd` field states what the call was charged.

4. Download the image from `output_url`:

   ```bash
   curl -sLO "<output_url>"
   ```

## Choose a tier per request

Every tier takes the same request. Only `image_generator_version` and the price change.

| Purpose | `image_generator_version` | Price per image |
| --- | --- | --- |
| Drafts and trying prompt wording | `hd` | $0.01 |
| A final image in a chosen style | `genius` | $0.08 |
| A final image at 2K resolution | `super_genius` | $0.25 |

Prompt wording is cheapest to refine on hd. Once the wording is settled, send it again on the tier the final image needs. For example, ten hd drafts and one super_genius final cost $0.35 in total.

## Set a genius style

`genius_preference` sets the style on the genius tier and defaults to `classic`. Omit the field on hd and super_genius.

| Style | `genius_preference` |
| --- | --- |
| Default | `classic` |
| Anime | `anime` |
| Photographic | `photography` |
| Graphic | `graphic` |
| Cinematic | `cinematic` |

```json
{"text": "A lighthouse on a rocky coast at dusk", "image_generator_version": "genius", "genius_preference": "cinematic"}
```

## Other DeepAI image services

Each service is its own endpoint. Each is paid per image through the same 402 price quote.

| Job | Endpoint | Price per image |
| --- | --- | --- |
| Edit a photo from a text instruction | `POST https://deepai.pay.zeroclick.io/zcj/0j1bz0u30i2u/api/image-editor` | genius $0.08; super_genius $0.25 |
| Remove a background | `POST https://deepai.pay.zeroclick.io/zcj/0j1bz0u30i2u/api/background-remover` | $0.01 |
| Colorize a black and white photo | `POST https://deepai.pay.zeroclick.io/zcj/0j1bz0u30i2u/api/colorizer` | $0.01 |
| Upscale and sharpen | `POST https://deepai.pay.zeroclick.io/zcj/0j1bz0u30i2u/api/torch-srgan` | $0.01 |
| Upscale with added detail | `POST https://deepai.pay.zeroclick.io/zcj/0j1bz0u30i2u/api/creative-upscale` | $0.08 |

The storefront also sells text-to-video and image-to-video services, which this page does not cover. [The services list](https://deepai.pay.zeroclick.io/zcj/0j1bz0u30i2u/services) has every service and its prices.

## Limits and charges

- One request makes one image and returns one `output_url`. The tier you send sets that image's price, and each pay-as-you-go request gets its own 402.
- The JSON body takes `text`, `image_generator_version` and `genius_preference`. The `multipart/form-data` form of the request also takes `width` and `height` (128 to 1536, in multiples of 32) and `negative_prompt`.
- A pay-as-you-go call can be paid by card only when it costs $0.50 or more. For cheaper images, buy Credits by card from $0.50 and let each call draw down the balance. Buying Credits needs an agent credential from [auth.md](https://deepai.pay.zeroclick.io/zcj/0j1bz0u30i2u/auth.md).

## Errors

| Response | Meaning | Action |
| --- | --- | --- |
| `402` with a `payment` block and no `reason` | The price quote | Pay it and retry the same request, or stop |
| `400 invalid_request` | The body is malformed | Fix the JSON and send it again |
| `settlement_failed` | The payment did not settle; `settlementReason` gives the cause, such as `insufficient_funds` | Fix the wallet, then send a fresh request for a new 402 |
| `payment_unknown` or `payment_request_mismatch` | The proof came from a stale challenge or a different request | Send a fresh request and pay the new 402 |
| `payment_consumed` | That payment was already settled | Check whether the image was delivered before you pay again |
| `payment_provider_unavailable` | A temporary failure reaching the payment provider | Retry unchanged, with backoff |

After a paid call is forwarded to DeepAI, any error from DeepAI's API comes back with the status and body DeepAI sent. [The error reference](https://deepai.pay.zeroclick.io/zcj/0j1bz0u30i2u/errors.md) lists every code.

## Frequently asked questions

### Does DeepAI's text-to-image API need an API key?

No. Each pay-as-you-go call is paid on its own through the 402 price quote, and the signed payment identifies the caller. An agent identity is needed only to buy Credits.

### How much does one image cost?

It depends on the tier: $0.01 on hd, $0.08 on genius and $0.25 on super_genius. The 402 states the exact amount in `payment.amountUsd` before you pay.

### What does one text2img request return?

One `id` and one `output_url`, the link to the generated image. The price is the tier's per-image rate, quoted in the request's own 402.

### Can I pay for an hd image by card?

A pay-as-you-go call can be paid by card only when it costs $0.50 or more. For smaller calls, buy Credits by card from $0.50 and let each call draw down the balance, or pay per call over x402 or MPP.

### Which tier should I use?

Use hd to try prompt wording. Use genius when the image needs one of the five `genius_preference` styles, and super_genius when the image needs 2K resolution.

## Keep reading

- [The buyer skill](https://deepai.pay.zeroclick.io/zcj/0j1bz0u30i2u/SKILL.md): the full purchase flow
- [How to pay](https://deepai.pay.zeroclick.io/zcj/0j1bz0u30i2u/payment.md): the 402, each rail, and Credits
- [The API reference](https://deepai.pay.zeroclick.io/zcj/0j1bz0u30i2u/openapi.json): every operation and its fields
- [The error reference](https://deepai.pay.zeroclick.io/zcj/0j1bz0u30i2u/errors.md): every error code and the action to take

---

Updated 2026-10-16. All DeepAI guides: https://deepai.pay.zeroclick.io/guides.md. Storefront: https://deepai.pay.zeroclick.io/zcj/0j1bz0u30i2u/llms.txt.
