Skip to content

Image-to-Image

Create an asynchronous image-to-image generation with gemini-3.1-flash-image (higher quality) from URLs. Returns 202 Accepted with a job_id — poll GET /jobs/{job_id} until the job is done or failed.

POST /api/v1/generations
Authorization string required

Bearer <YOUR_API_KEY>. See Authentication.

Idempotency-Key string

Optional. Replaying the same key returns the original job_id without creating a duplicate job or charging again.

Model name, e.g. `gemini-3.1-flash-image`. The model decides the output modality from the prompt: image models can return an image, text, or both (transparent API). Generation prompt. Minimum length 1. Null bytes are stripped. Output aspect ratio. See [Aspect ratios](/concepts/aspect-ratios). `auto` infers the ratio from the first input image. Up to 100 image URLs. Each must start with `http://` or `https://`. `1K`, `2K`, or `4K`. See [Resolutions](/concepts/resolutions). Webhook URL called once the job reaches a terminal state. Overrides the account webhook for this request. See [Webhooks](/concepts/webhooks).

Returns 202 Accepted.

job_id string

UUID of the created job.

status string

Always queued on creation.

status_url string

Relative path to poll for status and result.

Terminal window
curl -s -X POST https://api.moonez.ai/api/v1/generations \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gemini-3.1-flash-image",
"prompt": "make it look like a watercolor painting",
"aspect_ratio": "auto",
"resolution": "1K",
"input_images_urls": [
"https://example.com/photo-1.jpg",
"https://example.com/photo-2.jpg"
]
}'
import requests
resp = requests.post(
"https://api.moonez.ai/api/v1/generations",
headers={"Authorization": f"Bearer {API_KEY}"},
json={
"model": "gemini-3.1-flash-image",
"prompt": "make it look like a watercolor painting",
"aspect_ratio": "auto",
"resolution": "1K",
"input_images_urls": [
"https://example.com/photo-1.jpg",
"https://example.com/photo-2.jpg",
],
},
)
print(resp.json())
const resp = await fetch("https://api.moonez.ai/api/v1/generations", {
method: "POST",
headers: {
Authorization: `Bearer ${API_KEY}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
model: "gemini-3.1-flash-image",
prompt: "make it look like a watercolor painting",
aspect_ratio: "auto",
resolution: "1K",
input_images_urls: [
"https://example.com/photo-1.jpg",
"https://example.com/photo-2.jpg",
],
}),
});
console.log(await resp.json());
{
"job_id": "0193a7f2-1c4a-7e0b-9b3a-2f1d8c6e4a55",
"status": "queued",
"status_url": "/api/v1/jobs/0193a7f2-1c4a-7e0b-9b3a-2f1d8c6e4a55"
}