Send reference images without avoidable input errors

Choose the image edit endpoint, preserve reference order, validate real image files and check model-specific limits before scaling to many inputs.

Technical review:

Use the edit endpoint for references

MaxAPI accepts JSON URL references on POST /v1/images/edits. Use image_url for one reference or image_urls for an ordered array, together with model, prompt and the selected model’s output parameters. This is a MaxAPI interface example, not a guarantee that every upstream SDK uses the same JSON shape. For a first test, use one non-sensitive image you own, and request one output at a supported small resolution.

{
  "model": "google/gemini-3.1-flash-image-preview",
  "prompt": "Keep the product from image 1; use the background colors from image 2.",
  "image_urls": ["https://YOUR_ASSET_HOST/product.png", "https://YOUR_ASSET_HOST/background.png"],
  "resolution": "1K", "aspect_ratio": "1:1", "n": 1, "async": true
}

Check bytes, not just the filename

Replace the placeholder URLs with reachable HTTPS asset URLs. A URL that opens a login page, HTML error, expired signed link or zero-byte file is not a usable image, even if it ends in .png. Decode the file locally and inspect its dimensions and format. If an upstream rejects an unusual color mode or a malformed file, re-export an owned source as a conventional RGB PNG or JPEG and verify that file. Conversion is a diagnostic step, not a promised cure for every 400 response.

Make order and limits explicit

Describe the role of each reference in the prompt: image 1 supplies the object, image 2 supplies the palette, and so on. Keep the array stable when retrying a corrected request. Do not assume every Nano Banana or GPT Image variant accepts 14 references. The Lite entry and other families have different limits, and the chosen route also needs editing capability. Consult the model pages below rather than applying a single global limit to every model.

Isolate the failing reference

If a response names “image 1”, inspect the first submitted file and its actual download response. Establish a one-reference baseline, then add the remaining authorized images in small steps while tracking their order. Separate file validation from prompt or content-policy handling: a 451 is not the same as an invalid image file, and a 502 does not by itself prove your reference count is unsupported. Redact private asset URLs and prompts before sharing diagnostics.

Model-specific parameters

Public configuration snapshot; not live availability. Follow each model page for its parameters, supported routes and reference limits.

References

Continue your integration

Manage API keysAPI referenceCheck current prices