generate_image
Generate AI images from prompts via MeiGen or OpenAI-compatible APIs, including SVG, GIF, transparent PNG/WebP, reference-guided and mask/markup edits.
Instructions
Generate an image using AI. Supports MeiGen platform or OpenAI-compatible APIs. Tip: get prompts from get_inspiration() or enhance_prompt(). For MeiGen Midjourney, use referenceType for content/style images and niji7Options for stylize, chaos, raw, image/style weights, sref, profile and MJ quality. Inline --sref/--profile codes remain compatible; other prompt flags are cleaned by the backend. Use referenceImages for local files. On the MeiGen provider: For a vector illustration, scalable logo or SVG (矢量图), use generate_image with the SVG model ID from list_models and outputFormat=svg. Return the SVG original from vectorOutput.url; imageUrl or urls contains its PNG preview. For an animated image or looping GIF (动图), use the GIF model ID and outputFormat=gif, not generate_video. Optional gifOptions sets frameSize, frameCount and frameDurationMs; loop length is frameCount × frameDurationMs. Set GIF dimensions through frameSize; omit aspectRatio and resolution. Omit gifOptions for defaults. Keep explicit video requests on generate_video. For a new GIF or SVG, pass up to the live guide limit (at most two) via referenceImages. For saved characters, switch to the remote OAuth MCP and use list_characters and generate_image there. Each selected character uses one guide slot on that connection; do not substitute a new generation for editing an existing file. For a transparent still, choose PNG or WebP and imageBackground=transparent. For an annotated still-image edit, read list_models imageOutput.editing first. Use imageMask for transparent editable pixels or imageMarkup for visible colored annotations on a transparent PNG. Supply exactly one, with width/height matching the original source in referenceImages[0]; source and annotation must be public HTTPS URLs, at original dimensions, and the PNG must be at most 10 MiB. Local annotated source paths are rejected to prevent resizing. Markup requires the official OpenAI route and visible annotation pixels. Never flatten markup into the source, drop a selection, or use GIF/SVG or saved characters for these requests. Preserve the same annotation URL and dimensions on recovery.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"prompt": "<prompt>"
},
"name": "generate_image"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| size | No | Image size for OpenAI-compatible providers: "1024x1024", "1536x1024", "auto". MeiGen: use aspectRatio instead. | |
| wait | No | MeiGen only: false returns the accepted generation ID immediately; poll check_generation separately. Default true waits for completion. Submit-only requires requestId. | |
| model | No | Model name. For OpenAI-compatible providers: any model ID your endpoint supports. For MeiGen: use model IDs from list_models (e.g. "gpt-image-2", "grok-image" = xAI Grok Imagine Quality, 1K/2K, supports image-to-image, "nanobanana-2", "seedream-4.5", "flux2-klein"). | |
| prompt | Yes | The image generation prompt | |
| modelId | No | Alias of model for portable workflow calls. If both are present they must match. | |
| quality | No | Image quality. MeiGen gpt-image-2: "low" / "medium" / "high". OpenAI-compatible providers also accept "high". | |
| download | No | Save the completed result locally (default true). Set false for URL-only workflows. Ignored when wait=false. Other providers may return inline image content when local saving is disabled. | |
| provider | No | Which provider to use. Auto-detected from configuration if not specified. | |
| imageMask | No | PNG mask: transparent pixels are editable. Requires a public HTTPS original source in referenceImages[0]; cannot combine with imageMarkup. Read imageOutput.editing. | |
| requestId | No | Persistent UUID for this workflow step. Required when wait=false. Reuse with identical inputs after interruption, including after MCP restart; use a new UUID for a new generation. Omit only for a new interactive generation. | |
| gifOptions | No | GIF only. Use the frame range for this size and the frame delay range in list_models. | |
| resolution | No | Resolution tier. MeiGen: "1K" / "2K" / "3K" / "4K" — each model supports a subset (list_models reports resolutions when applicable). OpenAI: not used (use size instead). | |
| aspectRatio | No | Aspect ratio for MeiGen provider. Use "auto" (recommended, default when omitted) to let MeiGen infer the best ratio from the prompt content. Explicit values: "1:1", "3:4", "4:3", "16:9", "9:16", "21:9", "2:3", "3:2", "4:5", "5:4", etc. (model-dependent). | |
| imageMarkup | No | Transparent PNG containing visible colored annotations. Requires a public HTTPS original source in referenceImages[0]; cannot combine with imageMask. Read imageOutput.editing. | |
| modelVariant | No | Optional model variant from live list_models, such as a supported GPT Image variant. Forwarded unchanged to MeiGen. | |
| niji7Options | No | MeiGen Midjourney advanced options, matching Web/App. Prefer these over prompt flags; V8.2 ignores weird and fixes sv=6. Preserve identical options on recovery. | |
| outputFormat | No | Select the model ID for this format from list_models. GIF and SVG each have their own priced model. | |
| referenceType | No | MeiGen Midjourney uploaded-image role; default content. Style images override niji7Options.sref; saved characters remain content references. | |
| negativePrompt | No | Negative prompt for OpenAI-compatible providers. | |
| imageBackground | No | Transparent is available on PNG and WebP; GIF/SVG accept only auto. | |
| imageComplexity | No | Choose a supported complexity from the model catalog. | |
| referenceImages | No | Image references for style/content guidance. Accepts direct public HTTPS URLs without credentials/fragments or accessible absolute local paths. Relative paths are rejected. Local PNG/JPEG/WebP/GIF references up to 32 MiB and 64 million pixels are fully decoded, stripped of metadata and prepared up to 4096px, preserving transparency. Sources: gallery URLs from search_gallery/get_inspiration, URLs from previous generate_image results, or local file paths. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| urls | Yes | ||
| error | No | ||
| status | Yes | ||
| deduped | No | ||
| modelId | No | ||
| success | Yes | ||
| imageUrl | No | ||
| provider | No | ||
| videoUrl | No | ||
| mediaType | No | ||
| requestId | No | ||
| savedPath | No | ||
| nextAction | No | ||
| creditsUsed | No | ||
| generationId | No | ||
| vectorOutput | No | ||
| creditsStatus | No | ||
| failureDetail | No | ||
| seedanceDraft | No | ||
| receiptWarning | No | ||
| downloadWarning | No | ||
| observationEnded | No | ||
| pollAfterSeconds | No | ||
| requestedMediaType | No |