DEV Community

Cover image for I built an AI ad-creative API that keeps your exact product and uses real text — $0.01/ad
Om Prakash
Om Prakash

Posted on • Originally published at pixelapi.dev

I built an AI ad-creative API that keeps your exact product and uses real text — $0.01/ad

Every store has the same gap. You have a clean product photo. What you need to run is an ad — that product in a scene that feels premium, with a headline, a CTA button, a brand name, maybe a "20% OFF" badge, sized for Instagram or a Google banner. Getting from one to the other normally means a designer, a Canva afternoon, or a $1–4-per-creative SaaS subscription.

I shipped an API that does it in one call for one cent.

The trade-off everyone else makes

There are two camps, and both are bad in different ways:

  • Pure text-to-image ("describe your ad"). Fast, but it redraws your product into something that's like your product — wrong logo, wrong shape — and the ad text comes out as melted nonsense, because diffusion models can't spell.
  • Traditional ad-creative SaaS. Gets the text right, but charges $1–4 per creative and still makes you art-direct every variation by hand.

The approach: compositing with a generative scene in the middle

Instead of asking one model to draw the whole ad, I treat it as a compositing problem:

  1. Matte the product off its background (BiRefNet, commercial-safe).
  2. Generate a scene around the product with SDXL inpainting — so the model adds contextual lighting and a real contact shadow. This is the anti-"floating product" lever.
  3. Paste the exact product back on top, pixel-for-pixel. Your watch face, your logo, your stitching — untouched.
  4. Render real typography — headline, sub-headline, CTA pill and badge as actual HTML/CSS text. Crisp, legible, editable. Never AI-garbled.

Two things are true at once: the product is pixel-exact, and the text is real. That combination is what makes the output something you can actually run.

Using it

curl -X POST https://api.pixelapi.dev/v1/image/ad-creative \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -F "product_image=@backpack.jpg" \
  -F "headline=CARRY MORE, EASIER" \
  -F "subheadline=Everyday backpack, built to last" \
  -F "cta=Get yours" -F "brand=NOMAD" -F "badge=20% OFF" \
  -F "ad_format=meta_1080x1080" -F "style=luxury"
Enter fullscreen mode Exit fullscreen mode

You get a generation_id; poll GET /v1/image/{id} and the output_url appears ~20 seconds later. Formats: square, story (1080×1920), Google (1200×628), Flipkart and Meesho. No product image? Omit it and you get a typographic sale ad on a generated background.

Pricing

Tool Price / ad Real editable text
PixelAPI AI Ad Creative $0.01 Yes
Google "Nano Banana" image $0.039 No
Pebblely / Mokker $0.02–0.30 No ad text
AdCreative.ai $1–4 Yes

At one cent a call, generating a hundred ad variations for an A/B test costs a dollar — which is the only price at which this gets used in production instead of reserved for one hero asset.

Docs and a live demo: pixelapi.dev/ai-ad-creative-api.html

Top comments (0)