Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/anil-matcha/open-generative-ai/llms.txt

Use this file to discover all available pages before exploring further.

The generateImage and generateI2I functions are the core of Open Generative AI’s image pipeline. Both functions follow the Muapi.ai submit-and-poll pattern internally — you call them with your API key and a params object, and receive a resolved URL when generation completes. generateImage is used for text-to-image and basic image-conditioned generation; generateI2I handles models that accept reference images as primary input, including multi-image models.

generateImage(apiKey, params)

Generates an image from a text prompt using any of the 50+ text-to-image models. When image_url is provided, the model applies image conditioning (strength-based). When images_list is provided, all reference images are forwarded in a single request.
apiKey
string
required
Your Muapi.ai API key. Passed as the x-api-key header.
params.model
string
required
Model ID. Examples: flux-schnell, nano-banana-pro, midjourney-v7, seedream-5, gpt-4o-image. The model ID maps to the API endpoint via the internal model registry.
params.prompt
string
required
Text prompt describing the image to generate.
params.aspect_ratio
string
Output aspect ratio. Common values: 1:1, 16:9, 9:16, 4:3, 3:4. Supported values depend on the model.
params.resolution
string
Output resolution. Values like 1K, 2K, 4K — only applicable to models that support explicit resolution control (e.g., Nano Banana 2, Seedream 5.0).
params.quality
string
Quality preset. Values: basic, high. Supported by models like Seedream 5.0.
params.image_url
string
URL of a reference image for image-conditioned generation. When set, strength is also forwarded.
params.images_list
string[]
Array of reference image URLs for multi-image models. Used instead of image_url when multiple references are needed.
params.strength
number
Denoising strength for image-conditioned generation. Range: 0.01.0. Defaults to 0.6 when image_url is set.
params.seed
number
Seed for reproducible generation. Pass -1 or omit for a random seed.
params.onRequestId
(requestId: string) => void
Optional callback invoked immediately after submission with the request_id. Useful for tracking or cancellation.
Returns: Promise<{ url: string, outputs: string[], status: string, request_id: string }> The url field is the primary output image URL, normalized from outputs[0] if needed.
import { generateImage } from 'studio';

const result = await generateImage('your-api-key', {
  model: 'flux-schnell',
  prompt: 'a serene mountain lake at sunrise, golden hour lighting, 8K',
  aspect_ratio: '16:9',
  seed: 42,
  onRequestId: (id) => console.log('Tracking request:', id)
});

console.log(result.url); // https://cdn.muapi.ai/outputs/...
With a reference image:
const result = await generateImage('your-api-key', {
  model: 'flux-dev',
  prompt: 'transform into watercolor painting style',
  image_url: 'https://example.com/photo.jpg',
  strength: 0.7
});

generateI2I(apiKey, params)

Generates an image using an image-to-image model. These models take reference images as primary input and optionally accept a prompt. Supports multi-image models where up to 14 reference images can be submitted in one request.
generateI2I uses the i2i model registry internally. Use this function (not generateImage) when working with dedicated image-editing models like Nano Banana 2 Edit, Flux Kontext, GPT-4o Edit, or Seededit.
apiKey
string
required
Your Muapi.ai API key.
params.model
string
required
Image-to-image model ID. Examples: nano-banana-2-edit, flux-kontext-dev, gpt-4o-edit, seededit-v3.
params.prompt
string
Optional guidance prompt. Many i2i models work without a prompt.
params.image_url
string
URL of a single reference image. Used when the model accepts one image.
params.images_list
string[]
Array of reference image URLs. Used for multi-image models. The array is sent in the order provided — models process images in submission order.
params.swap_url
string
Secondary image URL for face-swap or composite models that have a dedicated swap field.
params.aspect_ratio
string
Output aspect ratio (model-dependent).
params.resolution
string
Output resolution (model-dependent).
params.quality
string
Quality preset (model-dependent).
params.name
string
Name value for models that define a name input field in their model info. Falls back to the model’s default name if not provided.
params.onRequestId
(requestId: string) => void
Optional callback with the request_id after submission.
Returns: Promise<{ url: string, outputs: string[], status: string }>
import { generateI2I } from 'studio';

// Single-image editing
const result = await generateI2I('your-api-key', {
  model: 'flux-kontext-dev',
  image_url: 'https://example.com/photo.jpg',
  prompt: 'add dramatic storm clouds to the background'
});

console.log(result.url);
Multi-image model (Nano Banana 2 Edit supports up to 14 images):
import { generateI2I } from 'studio';

const result = await generateI2I('your-api-key', {
  model: 'nano-banana-2-edit',
  images_list: [
    'https://example.com/image1.jpg',
    'https://example.com/image2.jpg',
    'https://example.com/image3.jpg'
  ],
  prompt: 'create a cohesive composite scene',
  resolution: '2K'
});

console.log(result.url);

Multi-Image Models Reference

ModelMax Images
Nano Banana 2 Edit14
Nano Banana Edit10
Flux Kontext Dev I2I10
Kling O1 Edit Image10
GPT-4o Edit / GPT Image 1.5 Edit10
Bytedance Seedream Edit v4 / v4.510
Flux 2 Flex/Pro Edit8
Nano Banana Pro Edit8
Vidu Q2 Reference to Image7
GPT-4o Image to Image5
Flux 2 Klein 4b/9b Edit4
Qwen Image Edit Plus / 25113
Wan 2.5/2.6 Image Edit2–3
Flux Kontext Pro/Max I2I2

Build docs developers (and LLMs) love