Cookbooks #1: Build an AI Image Generator with pay-per-use billing. You’ll ship a service that charges per image, includes a 10-image free tier, and bills automatically as usage flows in.
Step 1 - Meter Create “Image Generation Meter”. Event name: image.generated (case-sensitive). Unit: images. Filter quality to standard or HD so only real generations count.
Step 2 - Product Make a Usage-Based product: “PixelGen AI – Image Generation”. Link the meter. Price: $0.05 per image. Free tier: 10 images/month.
Step 3 - Wire it up Do a test checkout to create a customer. Build the sample TypeScript app (uses OpenAI Images). On each generation, POST a usage event with customer_id, event_name: "image.generated", and quality.
Step 4 - Verify In the meter, watch events roll in, see Consumed vs Billable units, then exceed 10 to see billing kick in. Full walkthrough (copy-pasteable code) here. https://docs.dodopayments.com/...
@dodopayments This is the essence of building a real AI business.



