# Edit an image with a text prompt using DeepAI's image editing API

DeepAI's photo editor API changes an image you already have from a plain text instruction, such as a new setting, an added object or a different style. Each edit is one `POST https://deepai.pay.zeroclick.io/zcj/4tghk9sb8ztt/api/image-editor` request, billed at $0.08 on the genius tier or $0.25 on super_genius, which renders at 2K. Send it with a free agent credential from [auth.md](https://deepai.pay.zeroclick.io/zcj/4tghk9sb8ztt/auth.md), pay its 402 price quote from a wallet, and the response carries `output_url`, a link to the edited image.

## At a glance

- **Endpoint:** `POST https://deepai.pay.zeroclick.io/zcj/4tghk9sb8ztt/api/image-editor`, one edit per request
- **Body:** `image` (the image's URL), `text` (the edit instruction) and `image_generator_version` (`genius` or `super_genius`) are all required. `genius_preference` is an optional style on the genius tier.
- **Price per edit:** genius $0.08, super_genius $0.25
- **Credential:** an agent credential on every call, paid retries included, sent as `Authorization: Bearer <token>`, or as `ZC-Agent-Authorization: Bearer <token>` beside an MPP payment. Registering one at [auth.md](https://deepai.pay.zeroclick.io/zcj/4tghk9sb8ztt/auth.md) is free and can be anonymous, and its steps leave the access token in `ACCESS_TOKEN`, as the examples below use.
- **Payment:** each request answers with a 402 price quote, paid from a wallet over x402 or MPP.
- **Response:** a JSON object with `id` and `output_url`
- **Card:** a pay-as-you-go call can be paid by card only at $0.50 or more. Prepaid Credits can be bought by card from $0.50.
- **Full purchase flow:** [the buyer skill](https://deepai.pay.zeroclick.io/zcj/4tghk9sb8ztt/SKILL.md)

## Edit an image with a text instruction

1. Optionally, read the operation's contract. This GET is free:

   ```bash
   curl -s https://deepai.pay.zeroclick.io/zcj/4tghk9sb8ztt/services/photo-editor/openapi.json
   ```

   It lists the required fields, the accepted values for `image_generator_version` and `genius_preference`, and the live rates in `x-payment-info`.

2. Send the edit request. The example image is a public-domain NASA photo:

   ```bash
   curl -s -i -X POST https://deepai.pay.zeroclick.io/zcj/4tghk9sb8ztt/api/image-editor \
     -H "Authorization: Bearer $ACCESS_TOKEN" \
     -H 'Content-Type: application/json' \
     -d '{"image": "https://images-assets.nasa.gov/image/PIA23882/PIA23882~medium.jpg", "text": "Place the helicopter on a dusty red desert surface under a pale sky", "image_generator_version": "genius", "genius_preference": "photography"}'
   ```

   The storefront answers with a 402 price quote, with the exact amount in `payment.amountUsd`.

3. Pay the quote with an x402 or MPP client within your spending limit; the client resends the identical request with the proof attached and the same bearer. [The buyer skill](https://deepai.pay.zeroclick.io/zcj/4tghk9sb8ztt/SKILL.md) covers this flow in full.

4. Read the response. It is a JSON object with two strings, `id` and `output_url`:

   ```json
   {"id": "<job id>", "output_url": "<link to the edited image>"}
   ```

   The genius edit in step 2 paid $0.08. Fetch `output_url` to save the edited image.

## Choose a tier and style

Each tier bills its own per-image rate. Both tiers take the same `image` and `text`.

| Purpose | `image_generator_version` | Price per edit |
| --- | --- | --- |
| Edits with a style preference | `genius` | $0.08 |
| Edits rendered at 2K | `super_genius` | $0.25 |

`genius_preference` sets the art style on the genius tier. It takes `classic`, `anime`, `photography`, `graphic` or `cinematic`, and defaults to `classic`. Leave it out when you send `super_genius`. A super_genius body looks like this:

```json
{"image": "https://images-assets.nasa.gov/image/PIA23882/PIA23882~medium.jpg", "text": "Place the helicopter on a dusty red desert surface under a pale sky", "image_generator_version": "super_genius"}
```

## Limits

- The photo editor accepts only the tiers `genius` and `super_genius`.
- One request makes one edit and returns one `output_url`. There is no batch call, so ten edits take ten requests and are paid separately.
- The JSON body takes the image as a URL. The endpoint also accepts `multipart/form-data` with the image as a file.
- Card pays a pay-as-you-go call only at $0.50 or more. For smaller edits, either pay over x402 or MPP, or buy Credits (minimum $0.50) and let each edit draw down the balance. Buying Credits uses the same credential.
- A timeout after you pay leaves the outcome uncertain. Check the result before you pay again.

## Errors

| Response | Meaning | Action |
| --- | --- | --- |
| `402` with a `payment` block | The per-call price quote | Pay within your limit and retry the same request, or stop |
| `400 invalid_request` | The request body is malformed | Fix the JSON and send the request again |
| `settlement_failed` | The payment did not settle. `settlementReason` says why, for example `insufficient_funds`. | Fix the wallet, then send the request again for a fresh 402 |
| `409 payment_request_mismatch` | A payment was reused for a different request | Request a fresh 402 for this request and pay that one |
| `usage_exhausted` | The Credits balance is used up | Top up with `POST https://deepai.pay.zeroclick.io/zcj/4tghk9sb8ztt/extend` and `{"amountUsd": "..."}` |

The storefront forwards a paid call to DeepAI's API. Any error after that point comes back with DeepAI's own status code and body.

## Frequently asked questions

### Can I edit an image with DeepAI's API without an API key?

Yes. There is no DeepAI account or API key: every call carries a free agent credential from [auth.md](https://deepai.pay.zeroclick.io/zcj/4tghk9sb8ztt/auth.md), registered once and anonymously if you like, and each edit is paid on its own through the storefront's 402 price quote over x402 or MPP.

### How much does one AI image edit cost?

An edit costs $0.08 on `genius` and $0.25 on `super_genius`. The 402 states the exact amount before you pay, and the `zc-billing` header on the paid response confirms what was charged.

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

Card pays a pay-as-you-go call only when it costs $0.50 or more. For edits below that, buy prepaid Credits by card from $0.50 with the same credential, or pay each edit over x402 or MPP.

### How is editing an image different from generating one?

The photo editor takes your image together with an instruction and changes that image. To make a new image from text alone, use DeepAI's text-to-image endpoint, `POST https://deepai.pay.zeroclick.io/zcj/4tghk9sb8ztt/api/text2img`.

## Keep reading

- [Buyer skill](https://deepai.pay.zeroclick.io/zcj/4tghk9sb8ztt/SKILL.md): the full purchase flow
- [Photo editor service](https://deepai.pay.zeroclick.io/zcj/4tghk9sb8ztt/services/photo-editor): prices by plan
- [How to pay](https://deepai.pay.zeroclick.io/zcj/4tghk9sb8ztt/payment.md): rails, Credits and top-ups
- [Error reference](https://deepai.pay.zeroclick.io/zcj/4tghk9sb8ztt/errors.md): every error code and the action for each

---

Updated 2026-11-12. All DeepAI guides: https://deepai.pay.zeroclick.io/guides.md. Storefront: https://deepai.pay.zeroclick.io/zcj/4tghk9sb8ztt/llms.txt.
