DeepAI Guides

Guides

Remove an image's background with DeepAI's API

Markdown

DeepAI's background remover API cuts the subject out of one image per request, for product photos, profile images and composites. Each image costs $0.01. Send POST https://deepai.pay.zeroclick.io/zcj/wnwzyd8oac2y/api/background-remover with the image's URL in image and a free agent credential from auth.md, pay the 402 price quote over x402 or MPP and retry, then read output_url for the cutout.

At a glance

  • Endpoint: POST https://deepai.pay.zeroclick.io/zcj/wnwzyd8oac2y/api/background-remover, one image per request
  • Body: {"image": "<image URL>"} as JSON, or the file as image in multipart/form-data. image is the only field, and it is required.
  • Price: $0.01
  • 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, the job identifier, and output_url, the link to the image with the background removed
  • Limits: one image per call, with no batch field. Card pays a single call only at $0.50 or more.
  • Full purchase flow: buyer skill

Remove the background from one image

  1. Send the image's URL. The example image is a public-domain NASA photo:

    curl -sS -X POST https://deepai.pay.zeroclick.io/zcj/wnwzyd8oac2y/api/background-remover \
      -H "Authorization: Bearer $ACCESS_TOKEN" \
      -H 'Content-Type: application/json' \
      -d '{"image": "https://images-assets.nasa.gov/image/PIA23882/PIA23882~medium.jpg"}'
    

    The storefront answers with a 402 price quote for $0.01.

  2. Pay the quote with an x402 or MPP client and retry the identical request with the proof attached and the same bearer. The buyer skill and How to pay have the steps for each rail.

  3. Read the response:

    {"id": "<job id>", "output_url": "<link to the image with the background removed>"}
    

    The example request above paid $0.01, and its response held a string id and a string output_url. Each paid response also carries a zc-billing header with chargedUsd for that request.

In a pipeline, this step comes after an image is generated or edited, with one request per image.

Choose the input and the way to pay

ConditionSend
The image is at a URLContent-Type: application/json with {"image": "<url>"}
The image is a local filemultipart/form-data with the file as image, for example -F 'image=@photo.jpg'
ConditionPay with
Paying from a wallet, per imagePay-as-you-go: one 402 per image over x402 or MPP
Paying by card, or drawing from a prepaid balanceCredits, a prepaid balance from $0.50 (from $0.50 by card) that calls draw down

Buying Credits uses the same credential; the buyer skill has the steps. On a balance, zc-billing reports chargedUsd and remainingCreditUsd.

A batch costs the number of images times the per-image price. For example, 100 product photos cost $1.

Limits

  • One image per request. A set of 40 photos is 40 requests, and each pays its own 402.
  • The request takes image and nothing else. There are no options for the output.
  • Card pays a pay-as-you-go call only when that call costs $0.50 or more. Below that amount, pay on a wallet rail or draw from Credits.
  • Free reads, such as GET https://deepai.pay.zeroclick.io/zcj/wnwzyd8oac2y/manifest.json and GET https://deepai.pay.zeroclick.io/zcj/wnwzyd8oac2y/services/background-remover, show the live price before you call.

Errors

Status or codeMeaningAction
402 with a payment block and no reasonThe per-image price quotePay it and retry the same request, or stop
400 invalid_requestThe body is malformedFix the JSON. image is required.
settlement_failedThe payment did not settle. settlementReason says why, such as insufficient_funds.Fix the wallet, then send a fresh request for a new 402
409 payment_request_mismatchA payment was reused for a different requestRequest and pay a fresh 402 for each image
payment_consumedThat payment was already spentCheck whether the earlier request delivered before you pay again
usage_exhaustedThe Credits balance is used upTop up with POST https://deepai.pay.zeroclick.io/zcj/wnwzyd8oac2y/extend and {"amountUsd": "..."}
401 bearer_requiredThe call carried no agent credentialRegister at auth.md and retry with the bearer

After a paid call is forwarded, an error from DeepAI's own API arrives with DeepAI's status code and body. The error reference lists every storefront code.

Frequently asked questions

Does DeepAI's background removal 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 at the request with an x402 or MPP 402.

How much does it cost to remove the background from an image?

$0.01. A batch costs the image count times that price, so 50 images cost $0.50, and the 402 states the exact amount before each payment.

Can I remove backgrounds from several images in one request?

No. The endpoint takes one image per request, so a batch is a series of requests, each with its own 402 or its own draw on a Credits balance.

Can I pay for a background removal by card?

Card pays a pay-as-you-go call only at $0.50 or more. For smaller calls, pay on a wallet rail, or buy Credits by card from $0.50 and let each cutout draw down the balance.

Can I upload an image file instead of a URL?

Yes. Send multipart/form-data with the file in the image field. The price and the response are the same as for a URL.

Keep reading