AI + Bubble.io

AI Image Generation in Bubble.io Using Stable Diffusion or DALL·E

Add AI image generation to your Bubble.io application — covering DALL·E 3 via OpenAI and Stable Diffusion via third-party APIs, with setup instructions, prompt patterns, and storage management.

2 APIsCovered
DALL·E 3and Stable Diffusion
ProductionStorage included
Choosing Your API

DALL·E 3 vs Stable Diffusion for Bubble.io

Both work through Bubble’s API Connector. The choice depends on output style, control, and cost.

FactorDALL·E 3 (OpenAI)Stable Diffusion (via Stability AI / Replicate)
Setup complexitySimple — same API key as GPTModerate — separate API account
Output qualityExcellent — realistic, polishedExcellent — highly customisable style
Style controlLimited — prompt-driven onlyFine-grained — model, steps, CFG scale
Image variationsLimited without editing APIimg2img, inpainting available
Cost per image~$0.04–0.08 per imageVariable — often lower at scale
Content policyStrict — enforced by OpenAIModerate — depends on provider
Best forQuick integration, consistent qualityCustom art styles, brand-specific aesthetics
DALL·E 3 Setup

Connecting DALL·E to Bubble.io

If you already have OpenAI connected for text generation, add a new call to the same API.

Add a new call within your existing OpenAI API in the API Connector:

Call name: Generate Image
Method: POST
URL: https://api.openai.com/v1/images/generations

Request body:

{
"model": "dall-e-3",
"prompt": "",
"n": 1,
"size": "",
"quality": "standard",
"response_format": "url"
}

📌 Available sizes for DALL·E 3: 1024×1024, 1792×1024 (landscape), 1024×1792 (portrait). The response returns a temporary URL valid for 1 hour — always save the image to your storage immediately.

After initialising the call, Bubble maps data[0].url — this is the generated image URL. Also map data[0].revised_prompt which shows the prompt DALL·E actually used (it sometimes revises your input).

Stable Diffusion Setup

Using Stability AI or Replicate in Bubble

For more control over output style, Stability AI and Replicate both work well with Bubble’s API Connector.

1

Create a Stability AI account

Register at platform.stability.ai. Generate an API key. Their SDXL model produces excellent quality and is well-priced for production use.

2

Configure the API call

New API in API Connector: name it Stability AI. Authentication: Private key in header, key name: Authorization, value: Bearer YOUR_STABILITY_KEY. Add header: Content-Type: application/json.

3

Set up the image generation call

Method: POST. URL: https://api.stability.ai/v1/generation/stable-diffusion-xl-1024-v1-0/text-to-image. Body includes text_prompts array, cfg_scale (7), height/width (1024), steps (30), and samples (1).

4

Handle the base64 response

Stability AI returns base64-encoded image data, not a URL. In your workflow, decode the base64 string and upload it to Bubble’s file storage or an S3 bucket. Bubble’s built-in base64 decode operator handles this.

Storage Management

Saving Generated Images Properly

Generated image URLs are temporary. You must store images permanently as part of your workflow.

💾

Save to Bubble File Storage

After receiving the DALL·E URL or decoded base64, use Bubble’s ‘Upload a file’ action to store the image in Bubble’s native file storage. Store the resulting permanent URL in your database record.

☁️

Use S3 for Scale

For apps that generate many images, Bubble’s native file storage becomes expensive. Connect Amazon S3 via the API Connector and upload generated images there. Store the S3 URL in Bubble.

🗑️

Clean Up Unused Generations

Users often regenerate until they find an image they like. Add a cleanup workflow that deletes rejected generations from storage after 24 hours — this controls storage costs significantly.

Prompt Patterns

Writing Prompts That Produce Consistent Brand Output

Effective Prompt Structure

  • Subject first: “A modern office building in Islamabad”
  • Style second: “in the style of architectural photography”
  • Lighting/mood: “golden hour lighting, warm tones”
  • Quality markers: “highly detailed, 4K, professional”
  • Negative elements (Stable Diffusion): “no people, no cars, no text”

For Brand Consistency

  • Store your brand style as a prefix template in the database
  • Always prepend brand style to user-provided descriptions
  • Test with 20+ prompts before launching to users
  • Save the full prompt used with each image for reproducibility
  • Use DALL·E revised_prompt field to understand what was actually generated

Building an App With AI Image Generation?

SA Solutions integrates DALL·E and Stable Diffusion into Bubble.io products — handling image storage, generation UX, prompt engineering, and cost management.

Talk to UsOur AI Services

Simple Automation Solutions

Business Process Automation, Technology Consulting for Businesses, IT Solutions for Digital Transformation and Enterprise System Modernization, Web Applications Development, Mobile Applications Development, MVP Development