DeepAI Guides

Guides

DeepAI API quickstart: generate an image from a text prompt

Markdown

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, genius or super_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 as ZC-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 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: JSON with id and output_url
  • Limits: one image, and one output_url, per request
  • Full purchase flow: the buyer skill

Generate an image from a text prompt

  1. 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 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 and the same bearer. The buyer skill has the details.

  3. Read the response. A paid call returns 200 with 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-billing header, and its chargedUsd field states what the call was charged.

  4. 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.

Purposeimage_generator_versionPrice per image
Drafts and trying prompt wordinghd$0.01
A final image in a chosen stylegenius$0.08
A final image at 2K resolutionsuper_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.

Stylegenius_preference
Defaultclassic
Animeanime
Photographicphotography
Graphicgraphic
Cinematiccinematic
{"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.

JobEndpointPrice per image
Edit a photo from a text instructionPOST https://deepai.pay.zeroclick.io/zcj/jfeiodn5rb1i/api/image-editorgenius $0.08; super_genius $0.25
Remove a backgroundPOST https://deepai.pay.zeroclick.io/zcj/jfeiodn5rb1i/api/background-remover$0.01
Colorize a black and white photoPOST https://deepai.pay.zeroclick.io/zcj/jfeiodn5rb1i/api/colorizer$0.01
Upscale and sharpenPOST https://deepai.pay.zeroclick.io/zcj/jfeiodn5rb1i/api/torch-srgan$0.01
Upscale with added detailPOST 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_version and genius_preference. The multipart/form-data form of the request also takes width, height, resolution 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 uses the same credential.

Errors

ResponseMeaningAction
402 with a payment block and no reasonThe price quotePay it and retry the same request, or stop
400 invalid_requestThe body is malformedFix the JSON and send it again
settlement_failedThe payment did not settle; settlementReason gives the cause, such as insufficient_fundsFix the wallet, then send a fresh request for a new 402
payment_unknown or payment_request_mismatchThe proof came from a stale challenge or a different requestSend a fresh request and pay the new 402
payment_consumedThat payment was already settledCheck whether the image was delivered before you pay again
payment_provider_unavailableA temporary failure reaching the payment providerRetry 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