Skip to main content
Image generation creates new images from text descriptions. This guide covers model selection, prompting techniques, and best practices for getting the results you want.

Overview

Text-to-image generation works by describing what you want in natural language. The AI model interprets your prompt and creates a matching image.
from openai import OpenAI

client = OpenAI(
    api_key="your-lumenfall-api-key",
    base_url="https://api.lumenfall.ai/openai/v1"
)

response = client.images.generate(
    model="gemini-3-pro-image",
    prompt="A cozy coffee shop interior with warm lighting and exposed brick walls",
    size="1024x1024"
)

print(response.data[0].url)

Choosing a model

Different models excel at different tasks. Here’s how to choose:
ModelBest forConsiderations
gemini-3-pro-imageGeneral purpose, photorealismGood balance of quality and speed
gpt-image-1.5Text rendering, complex scenesExcellent instruction following
flux.2-maxArtistic styles, creative workStrong aesthetic quality
Browse the full model catalog to compare capabilities and pricing.

Letting Lumenfall choose

If you don’t specify a provider prefix, Lumenfall automatically routes to the best available provider for that model:
model="gemini-3-pro-image"  # Lumenfall picks the provider
To use a specific provider, add the prefix:
model="vertex/gemini-3-pro-image"  # Always use Google Vertex

Writing effective prompts

The prompt is the most important factor in image quality. Here are techniques that work across models.

Be specific and descriptive

Vague prompts produce generic results. Add details about subject, setting, lighting, and style.
A dog in a park

Structure your prompt

A well-structured prompt typically includes:
  1. Subject - What’s the main focus?
  2. Setting - Where is it? What’s the environment?
  3. Style - Photography, illustration, painting?
  4. Mood - What feeling should it evoke?
  5. Technical details - Lighting, camera angle, composition
A minimalist home office workspace (subject) with a wooden desk against a white wall (setting),
product photography style (style), calm and organized feel (mood),
soft natural light from a window on the left, shallow depth of field (technical)

Negative space and composition

Describe what you don’t want to guide the model away from common issues:
A professional headshot portrait, clean background, no text or watermarks,
centered composition, neutral expression

Image sizes

Size affects composition and cost. Choose based on your use case:
SizeAspect ratioUse case
1024x1024SquareSocial media, avatars, general purpose
1792x1024LandscapeHero images, banners, desktop wallpapers
1024x1792PortraitMobile screens, stories, posters
response = client.images.generate(
    model="gemini-3-pro-image",
    prompt="Mountain landscape at golden hour",
    size="1792x1024"  # Landscape for a hero image
)
Not all models support all sizes. If a size isn’t supported, the request may fail or use the closest available size.

Quality settings

Some models support quality levels that trade generation time and cost for detail:
response = client.images.generate(
    model="gpt-image-1.5",
    prompt="Detailed architectural blueprint",
    quality="hd"  # Higher detail, higher cost
)
QualityBest for
standardMost use cases, faster and cheaper
hdFine details, text, complex patterns

Generating multiple images

Generate variations to choose the best result:
response = client.images.generate(
    model="gemini-3-pro-image",
    prompt="Logo design for a sustainable energy company",
    n=4  # Generate 4 variations
)

for i, image in enumerate(response.data):
    print(f"Image {i + 1}: {image.url}")
Some models only support n=1. Check the model’s capabilities in the catalog.

Cost estimation

Use dry run mode to estimate costs before generating. Add ?dryRun=true to any request to get a cost estimate without executing it. See the Cost estimation API reference for details and response format.

Best practices

Start with a basic prompt and refine. Generate a few images, identify what’s missing, and add those details to your prompt.
Use photorealistic models for product shots, artistic models for creative work. The model catalog shows example outputs.
Design your prompt with the final aspect ratio in mind. A landscape prompt works better with landscape dimensions.
Estimate costs before bulk generation, especially when testing new prompts or models.

Next steps