Model Rover

Image Generation and Editing

Generate and edit images through OpenAI-compatible JSON and multipart endpoints.

Endpoints

POST /v1/images/generations
POST /v1/images/edits
Authorization: Bearer $API_KEY

These endpoints serve OpenAI gpt-image, xAI Grok Imagine, compatible Seedream image models, and QwenCloud image models. Gemini-native image models instead use Generate Content.

For QwenCloud, both text-to-image and image-to-image use POST /v1/images/generations. Put the source image in the top-level image field (as a string or array); do not use multipart /v1/images/edits. Qwen result URLs are temporary and should be downloaded if they need to be retained.

Generate an image

POST /v1/images/generations accepts JSON.

FieldTypeRequiredDescription
modelstringYesComplete public image model ID.
promptstringYes, except layer decompositionGeneration instruction.
nintegerNoRequested output count; defaults to 1 for admission estimates.
sizestringNoOpenAI gpt-image-2 and GPT Image 2.5 Sunburst/Flare models (including 2026-09-08 snapshots) support any WIDTHxHEIGHT within upstream limits; other models use model-specific sizes.
qualitystringNoGPT Image models support auto (default), low, medium, and high; both GPT Image 2.5 Sunburst/Flare series (including 2026-09-08 snapshots) additionally support xhigh and max.
backgroundtransparent, opaque, or autoNoGPT Image background behavior. Transparent output requires PNG or WebP.
moderationlow or autoNoGPT Image moderation level.
output_formatpng, jpeg, or webpNoGPT Image output encoding.
output_compressionintegerNoJPEG/WebP compression from 0–100.
partial_imagesintegerNoNumber of streaming previews, from 0–3.
response_formaturl or b64_jsonNoxAI result representation. Do not send it to GPT Image models.
streambooleanNoRequest image SSE events when supported.
userstringNoStable end-user identifier.
image or imagesmodel-specificNoSeedream reference URL/data URI input.
resolution1k or 2kNoxAI-compatible resolution tier when supported.
aspect_ratiostringNoxAI-compatible requested aspect ratio.
sequential_image_generationstringNoSeedream-compatible sequential generation mode.
sequential_image_generation_options.max_imagesintegerNoMaximum sequential outputs.
layer_decompositionbooleanNoSeedream layer decomposition; requires exactly one input image.
curl "http://127.0.0.1:11113/v1/images/generations" -H "Authorization: Bearer $API_KEY" -H "Content-Type: application/json" -d '{
  "model": "openai/gpt-image-1.5",
  "prompt": "A minimal cloud icon on a transparent background",
  "size": "1024x1024",
  "quality": "high",
  "background": "transparent",
  "output_format": "png"
}'

Edit an image

POST /v1/images/edits accepts either JSON references or multipart file uploads. In addition to model, prompt, and source images, compatible edit requests can use background, input_fidelity, mask, moderation, n, output_compression, output_format, partial_images, quality, size, stream, and user. xAI JSON edits can also use aspect_ratio, resolution, and response_format.

JSON editing requires model, prompt, and either an image object or a non-empty images array. Image items can carry compatible URL, data URI, or file-reference fields.

curl "http://127.0.0.1:11113/v1/images/edits" -H "Authorization: Bearer $API_KEY" -H "Content-Type: application/json" -d '{
  "model": "xai/grok-imagine-image-2.0",
  "prompt": "Change the sky to sunset",
  "image": {"type": "image_url", "url": "https://example.com/source.png"},
  "quality": "medium",
  "resolution": "1k",
  "response_format": "url"
}'

Synchronous response

A compatible response contains one item per generated image. GPT Image models always return base64; xAI models can return a URL or base64 according to response_format.

{
  "created": 1767225600,
  "data": [{ "b64_json": "..." }],
  "output_format": "png",
  "quality": "high",
  "size": "1024x1024",
  "usage": {
    "input_tokens": 18,
    "output_tokens": 1056,
    "total_tokens": 1074
  }
}

If an upstream includes model, the gateway rewrites it to the public model ID. Copy URL results you need to keep; they can be temporary.

Streaming response

When both endpoint and model support streaming, send stream: true and consume text/event-stream. OpenAI-compatible providers emit image_generation.* or image_edit.* progress and completion events. A completion event carries final image data and usage. Event extensions are preserved on same-protocol routes.

Model-specific fields and limits

The gateway forwards compatible unknown fields rather than maintaining a provider schema allowlist. Closed pricing or capability dimensions, such as xAI quality and resolution tiers, must still be supported by the selected model. OpenAI size remains an upstream-validated value rather than a gateway allowlist.

The following fields are rejected:

  • style, because DALL-E models are not exposed by this deployment.
  • Non-null storage_options, because the gateway does not manage upstream file ownership or lifecycle.
  • Client routing controls or paid service-tier selections.

JSON responses can contain large base64 payloads. The image request and synchronous response safety limit is 100 MiB. Media bytes are returned unchanged but replaced by placeholders in stored request and response bodies.

Help us improve this page

Found something unclear, outdated, or incorrect?

Last updated on