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. You choose the tier on each request, and the cheapest tier, hd, costs $0.01. Send POST https://deepai.pay.zeroclick.io/zcj/jfeiodn5rb1i/api/text2img with text, image_generator_version and a free agent credential from auth.md, pay the 402 price quote it answers with, and retry the same request.
At a glance
- Endpoint:
POST https://deepai.pay.zeroclick.io/zcj/jfeiodn5rb1i/api/text2img, one image per request - Body:
text(required),image_generator_version(required:hd,geniusorsuper_genius),genius_preference(genius only) - Price per image: hd $0.01; genius $0.08; super_genius $0.25
- Credential: an agent credential on every call, paid retries included, sent as
Authorization: Bearer <token>, or asZC-Agent-Authorization: Bearer <token>beside an MPP payment. Registering one at auth.md is free and can be anonymous, and its steps leave the access token inACCESS_TOKEN, as the examples below use. - Payment: each request answers with a 402 price quote, paid from a wallet over x402 or MPP.
- Response: JSON with
idandoutput_url - Limits: one image, and one
output_url, per request - Full purchase flow: the buyer skill
Generate an image from a text prompt
Send the request without payment:
curl -i -X POST https://deepai.pay.zeroclick.io/zcj/jfeiodn5rb1i/api/text2img \ -H "Authorization: Bearer $ACCESS_TOKEN" \ -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 inpayment.amountUsd. Check it against your budget before you pay.Pay the quote with your x402 or MPP client, which resends the identical request with the proof attached and the same bearer. The buyer skill has the details.
Read the response. A paid call returns
200with this shape:{"id": "<string>", "output_url": "<string>"}The example request above paid $0.01 for one hd image. Every paid response also carries a
zc-billingheader, and itschargedUsdfield states what the call was charged.Download the image from
output_url: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 |
{"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/jfeiodn5rb1i/api/image-editor | genius $0.08; super_genius $0.25 |
| Remove a background | POST https://deepai.pay.zeroclick.io/zcj/jfeiodn5rb1i/api/background-remover | $0.01 |
| Colorize a black and white photo | POST https://deepai.pay.zeroclick.io/zcj/jfeiodn5rb1i/api/colorizer | $0.01 |
| Upscale and sharpen | POST https://deepai.pay.zeroclick.io/zcj/jfeiodn5rb1i/api/torch-srgan | $0.01 |
| Upscale with added detail | POST https://deepai.pay.zeroclick.io/zcj/jfeiodn5rb1i/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 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_versionandgenius_preference. Themultipart/form-dataform of the request also takeswidth,height,resolutionandnegative_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 uses the same credential.
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 lists every code.
Frequently asked questions
Does DeepAI's text-to-image API need an API key?
No DeepAI account or API key, but every call carries a free agent credential from auth.md, registered once and anonymously if you like. Each pay-as-you-go call is then paid on its own through the 402 price quote.
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: the full purchase flow
- How to pay: the 402, each rail, and Credits
- The API reference: every operation and its fields
- The error reference: every error code and the action to take