Provisional fares. Beta pricing. Your fare is fixed when you submit a batch. View pricing details

Y-PAD
← All field notes

Field notes / Workflows

One product photo. Two models. Ready for a larger canvas.

Remove the background, then upscale the real cutout. A complete two-stage recipe with downloadable photos, code, and costs.

View setup and code

Beta access required. Request access to run this workflow.

Ceramic mug, original01 / Original
Ceramic mug, cutout02 / Cutout
Ceramic mug, 2× upscale03 / 2× upscale

A small product photo can become a larger transparent asset in two stages: BiRefNet separates the subject, and Real-ESRGAN enlarges the cutout. The useful part is the handoff: the second model needs a newly uploaded file ID, not the first model’s download URL.

Inspect the same product at each stage.

The gallery above contains original AI-generated product-photo inputs and actual outputs from the local model workers. The cutouts and upscales were produced by the models, with no manual retouching. Download each stage to check edges and detail at full resolution.

These examples demonstrate a ceramic mug and an amber bottle. They do not establish quality for an entire catalog. Inspect handles, glass, labels, reflected light, and fine edges on your own images before applying the workflow to a full collection.

Two models mean two submissions.

  1. Upload the original photo through POST /v1/files and its signed PUT link.
  2. Dry-run a BiRefNet batch with output: "cutout", review the hold, and submit it with an idempotency key.
  3. Wait until settled_at is set. Download the successful item’s output using its signed URL.
  4. Upload that cutout as a new file. Supply its actual byte length and image/png content type.
  5. Dry-run and submit a Real-ESRGAN batch referencing the new file ID. Choose scale: 2 or 4, and PNG or WebP to keep transparency.
  6. Wait for the second batch to settle and download its output.
A batch contains one model. There is no automatic cross-model chaining endpoint. The runner below performs the download and re-upload explicitly, and each stage has its own submission minimum.
JSON · first stage: uploaded original
{
  "model": "birefnet",
  "items": [
    {
      "file": "ORIGINAL_FILE_ID",
      "params": {
        "output": "cutout"
      },
      "max_units": 1
    }
  ]
}
JSON · second stage: newly uploaded cutout
{
  "model": "real-esrgan",
  "items": [
    {
      "file": "UPLOADED_CUTOUT_FILE_ID",
      "params": {
        "scale": 2,
        "output_format": "webp"
      },
      "max_units": 1
    }
  ]
}

Download the complete runner.

The example setup page includes a downloadable Python runner. Its default plan runs locally without an API key or network request. Adding --run submits both paid stages after dry-run checks. Use a beta key from your own account; do not paste it into the webpage.

Shell · inspect locally, then run with beta access
# Download cutout-upscale.py from the setup page.
# Inspect the local plan. No network call or API key is needed.
python3 cutout-upscale.py product.png --scale 2

# Set YPAD_KEY in your terminal, then explicitly run both stages.
python3 cutout-upscale.py product.png --scale 2 --run --max-charge-usd 0.0150

The runner saves progress so the same operation can resume with the same submission bodies and idempotency keys. Keep that state with your output files. Use a fresh output directory for different work, and review the setup page before running it.

Count both stages in the budget.

Provisional fares. These are the published limited beta fares. Check the fare table before submitting work.

For inputs at 1 MP or under, one successful photo sent through two separate batches costs $0.015 at list fare: $0.0075 minimum per submission, twice. A lone job here costs more than on Replicate.

Successful photos, each at 1 MP or underBiRefNet batchReal-ESRGAN batchCombined list total
1 photo$0.0075$0.0075 minimum per submission.$0.0075$0.0075 minimum per submission.$0.015$0.0075 minimum per submission.
20 photos$0.01$0.0075 minimum per submission.$0.02$0.0075 minimum per submission.$0.03$0.0075 minimum per submission.
1,000 photos$0.50$0.0075 minimum per submission.$1.00$0.0075 minimum per submission.$1.50$0.0075 minimum per submission.

The combined total includes two submission minimums, one for each model. The batch rows assume all successful cutouts are grouped into one second-stage batch. The downloadable runner processes one photo per invocation; running it 1,000 times does not give the two-batch price. For a catalog, collect successful cutouts and batch that second stage together.

Keep the handoff inside the model limits.

BiRefNet accepts up to 4 MP, while Real-ESRGAN accepts up to 2 MP. Start at or below the smaller limit when you want both stages. Cutouts retain the image dimensions; removing the background does not shrink the pixel count.

Measure each stage’s input, then set max_units with a one-unit minimum and a bound large enough for that file. A larger image bills pro rata. A 2× upscale doubles each side and produces four times the pixels; 4× produces sixteen times the pixels. The upscale is the final stage, so its larger dimensions do not pass through another input check in this recipe.

Expect a cold start of 10 to 30 s, occasionally minutes. This is a queue: check the batch state instead of assuming a fixed completion time.

Each model may need its own cold start. Keep original files and review the final output for changed text or invented texture. Download your own copies: Deletion starts at 7 days and normally finishes within a further day.

Have a batch in mind?

Estimate its cost ↗

Join the private beta

We're opening API keys in small groups. Leave your email and we'll send yours when your place comes up.

We use your email only to contact you about the beta. See the privacy policy.