Skip to main content
The openaiimage MCP adapter connects to the OpenAI Images API. Generate images from text prompts, edit existing images with instructions, and create variations — returning base64-encoded assets for downstream storage, email, or social publishing.

Prerequisites

  • An OpenAI account with API access and billing enabled
  • An OpenAI API key with Images API permissions
  • For edit/variation: source images as base64 PNG (DALL-E 2) or supported formats for gpt-image-1
  • project_contributor access in AgentRuntime

Connect in AgentRuntime

1

Get an OpenAI API key

Create a key at platform.openai.com. Ensure your organization can use image models.
2

Create a connection

Go to Connections and click New custom connection to create an API key connection with APIKey. Optionally set DefaultModel (e.g. gpt-image-1 or dall-e-3) and APIBase.
3

Add openaiimage MCP instance

Go to MCP, click Add instance for openaiimage, wire your connection on Instance config, set the profile active, and save.
4

Generate a test image

Run mcp_callopenai_text_to_image with a short prompt to confirm billing and model access.
See Authentication for binding connections to MCP instances.

What you can build

  • Marketing assets — LLM writes creative brief → openai_text_to_image → upload to Google Drive or S3.
  • Product mockups — Reference screenshot base64 → openai_edit_image with style instructions.
  • A/B variantsopenai_image_variation on approved hero image → human_task picks winner.
  • Report illustrations — Workflow data → LLM prompt → image embedded in PDF via Browserless.

Tools

ToolDescription
openai_text_to_imageGenerate images from a text prompt (gpt-image-1, DALL-E 3, DALL-E 2)
openai_edit_imageEdit an image with a prompt; optional mask for inpainting
openai_image_variationCreate variations of a source PNG (DALL-E 2 only)

Example

Generate a social image from an LLM-crafted prompt:
{
  "id": "openai-image",
  "type": "mcp_call",
  "name": "Generate hero image",
  "tool_name": "openai_text_to_image",
  "tool_args": {
    "prompt": "{{steps.llm-prompt.result.image_prompt}}",
    "model": "gpt-image-1",
    "size": "1024x1024",
    "output_format": "png",
    "n": 1
  },
  "depends_on": ["llm-prompt"],
  "timeout_s": 120
}

Configuration

KeyRequiredDescription
APIKeyYesOpenAI API key
DefaultModelNoDefault model when tools omit model
APIBaseNoOpenAI API base URL

Troubleshooting

IssueFix
Content policy rejectionRevise prompt; avoid disallowed content per OpenAI usage policies
Model not availableConfirm account access to gpt-image-1 or dall-e-3; fall back to dall-e-2
Variation failsVariations require DALL-E 2 and a square PNG under size limits
Large payloadsImages return as base64; store externally rather than passing through many workflow steps