Image Generation
Image Generation
The agent can generate images on demand and deliver them as media attachments on iMessage, WhatsApp, and Telegram. No new auth setup — image generation routes through the existing OpenAI provider.
Configuration
Image generation is enabled by setting a provider-level default that every agent inherits unless explicitly overridden:
{ "agents": { "defaults": { "imageGenerationModel": { "primary": "openai/gpt-image-2", "timeoutMs": 180000 } } }}The image_generate tool becomes available on every agent that inherits the default. Per-agent denial is supported by adding image_generate to that agent’s tools.deny.
Auth
openai/gpt-image-2 is the only image model that uses the openai/ prefix in this stack — chat models route through openai-codex/. The gateway auto-routes image requests through the OpenAI Codex OAuth profile when one is present, so no separate API key is required.
Delivery
When the agent calls image_generate mid-reply:
- iMessage, WhatsApp, Telegram — generated images deliver as media attachments inline with the agent’s text reply.
- Other surfaces — the image is attached to the response and rendered by the surface’s native image support.
The agent decides when to generate vs. when to find an existing image; the tool description teaches it that generation is appropriate for one-off illustrations, birthday cards, mockups, or whimsical responses.
Separation From Chat
Image generation is independent of the chat model. Chat continues on whatever model is wired in (typically openai-codex/gpt-5.5); only image_generate calls reach gpt-image-2. Latency and cost for image generation don’t affect normal turns.
Common Use Cases
- Birthday cards — the dedicated birthday-card cron generates a personalized card and sends it via iMessage.
- Whimsical replies — short visual answers when an image lands better than text.
- Mockups — illustrative images for planning conversations (event posters, room layouts, etc.).
Limits
- Per-call latency is significantly higher than chat — the timeout is set to 180s by default.
- The OpenAI image rate limit applies; sustained generation across many crons can hit it.
- The OAuth profile must be healthy. If chat is failing with auth errors, image generation will fail too — fix auth at the chat layer first.