Skip to main content

Image Generation

Wunderland agents can generate images from text prompts using OpenAI, OpenRouter, Stability AI, or Replicate. The agent gets a single generate_image tool that routes to whichever provider you configure.

Providers

ProviderExample ModelsStrengths
OpenAIdall-e-3, gpt-image-1Strong prompt adherence, text rendering, polished defaults
OpenRouterRouted image-capable modelsProvider routing and unified account management
Stability AIstable-image-core, stable-image-ultra, sd3-largeGranular diffusion controls and seedable generations
Replicateblack-forest-labs/flux-schnell, flux-dev, community modelsBroad model catalog and provider-native low-level inputs

API Keys

Set the key for your preferred provider:

# OpenAI
export OPENAI_API_KEY=sk-...

# OpenRouter
export OPENROUTER_API_KEY=sk-or-...

# Stability AI
export STABILITY_API_KEY=sk-...

# Replicate
export REPLICATE_API_TOKEN=r8_...

Any combination can be set simultaneously. The extension uses its configured default provider and falls back to the first available credentialed provider.

Auto-Detection

The image generation extension loads automatically when one of these is present:

  • OPENAI_API_KEY
  • OPENROUTER_API_KEY
  • STABILITY_API_KEY
  • REPLICATE_API_TOKEN

No need to run wunderland extensions enable in the common case. If you want to force the extension on with only non-default provider credentials present, you can still enable it explicitly:

wunderland extensions enable image-generation

The generate_image Tool

The agent exposes a single tool with these options:

ParameterRequiredDefaultDescription
promptYesText description of the image to generate
sizeNo1024x1024Output dimensions
aspectRatioNoProvider defaultExplicit aspect ratio hint such as 1:1, 16:9, or 9:16
qualityNostandardImage quality level
styleNovividVisual style
providerNoConfigured defaultOverride the provider for this request
modelNoProvider defaultUse a provider-native model id for this request
seedNoRandomReproducible generation for providers that support seeds
negativePromptNoExclude traits or artifacts for providers that support it

Sizes

SizeAspect RatioUse Case
1024x10241:1 (square)Social media posts, profile images
1792x102416:9 (landscape)Blog headers, presentations, desktop wallpapers
1024x17929:16 (portrait)Mobile wallpapers, stories, vertical content

Quality

QualityDescriptionCost Impact
standardGood for most use cases — fast and affordable1x
hdHigher detail and consistency, especially for complex scenes~2x

Style

StyleDescription
vividHyper-real, dramatic lighting, saturated colors
naturalPhotographic, muted, realistic tones

Deep provider-native controls still live in the SDK/runtime layer. If you need raw Stability presets or Replicate model inputs from code, use AgentOS generateImage() with namespaced providerOptions.

Configuration

Default Provider

Set your preferred provider globally:

wunderland extensions configure

The CLI provider-default picker supports:

  • openai
  • openrouter
  • stability
  • replicate

Or in ~/.wunderland/config.json:

{
"providerDefaults": {
"imageGeneration": "openai"
}
}

Per-Agent Override

Override the global default in agent.config.json:

{
"extensionOverrides": {
"image-generation": {
"options": { "defaultProvider": "stability" }
}
}
}

Example Usage

In a chat session:

You: Generate an image of a rabbit wearing VR goggles,
floating in a neon-lit cyberpunk city

Agent: [calls generate_image with prompt, size: 1024x1024,
quality: standard, style: vivid]

Here's your image: [generated_image.png]
A rabbit in VR goggles hovering above a cyberpunk cityscape
with neon signs and rain-slicked streets.

Requesting specific options:

You: Create a landscape HD image of a minimalist Japanese garden,
natural style

Agent: [calls generate_image with prompt, size: 1792x1024,
quality: hd, style: natural]

Here's your image: [generated_image.png]

Pricing

Pricing varies materially by provider, model, and quality setting. Check the provider’s current pricing page before relying on cost assumptions in production.

Need Lower-Level Provider Controls?

Wunderland exposes a single generate_image tool for agents. If you need direct provider-native knobs from code, use AgentOS generateImage() with namespaced providerOptions and keep Wunderland for orchestration:

import { generateImage } from '@framers/agentos';

const result = await generateImage({
model: 'stability:stable-image-core',
prompt: 'A brutalist cabin in alpine fog',
providerOptions: {
stability: {
stylePreset: 'photographic',
seed: 42,
cfgScale: 8,
},
},
});

Troubleshooting

"Image generation not available" — Check that one of OPENAI_API_KEY, OPENROUTER_API_KEY, STABILITY_API_KEY, or REPLICATE_API_TOKEN is set. Run wunderland extensions info image-generation to see key status.

"Content policy violation" — Both providers enforce content safety policies. Rephrase the prompt to avoid restricted content categories.

Slow generation — Larger sizes, HD quality, and routed/community models can take noticeably longer. Start with smaller sizes and standard quality until you know your provider’s latency profile.