Grok Imagine Image 2.0 Image Edit
Endpoint
POST /images/generations
Full URL: https://modelfold.ai/v1/images/generations
Authentication: every request must include the
Authorization: Bearer <API_KEY>header.
Send model parameters directly in the JSON body. Do not wrap them in input. This request waits for generation to finish and returns data[].url; supported media models also offer async jobs, polling and callbacks. Replace example media URLs with your own publicly accessible files. See API gateway for billing and errors.
Input parameters for the generation task
Request Parameters
Body (application/json)
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Yes | The model name to use for generation. Required field. - Must be grok-imagine-image-2-0/image-edit for this endpoint Default:"grok-imagine-image-2-0/image-edit"。 Allowed values:grok-imagine-image-2-0/image-edit。 Example:grok-imagine-image-2-0/image-edit。 |
prompt | string | Yes | Prompt required by the ModelFold gateway; at most 2000 characters. A text description specifying the desired content or style of the generated image. Up to 8,000 characters. maxLength: 2000. Example:Recreate the Titanic movie poster with two adorable anthropomorphic cats in the same romantic pose at the bow of the ship. The male cat is an orange tabby wearing a vest, standing behind a white long-haired female cat in a lace dress, holding her paws as they stretch forward in the wind. Both cats are photorealistic with detailed fur, wind-swept hair, and dramatic sunset lighting (warm golden highlights, cool blue shadows). Background: the Titanic ship at dusk with four smokestacks, glowing deck lights, calm ocean, and orange-pink sunset sky. Center title: “CATANIC” in the same gold metallic serif style as Titanic, same size and position.。 |
aspect_ratio | string | Yes | Specifies the width-to-height ratio of the generated image. Controls the aspect ratio of the output. This field is required. Allowed values:1:1 / 2:3 / 3:2 / 16:9 / 9:16 / auto。 Example:1:1。 |
image_urls | array<string> | Yes | An array containing up to 5 and at least 1 URL strings pointing to a reference image. maxItems: 5. |
Request Example
bash
curl -X POST "https://modelfold.ai/v1/images/generations" \
-H "Authorization: Bearer $MODELFOLD_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "grok-imagine-image-2-0/image-edit",
"aspect_ratio": "1:1",
"image_urls": [
"https://example.com/reference.png"
],
"prompt": "Recreate the Titanic movie poster with two adorable anthropomorphic cats in the same romantic pose at the bow of the ship. The male cat is an orange tabby wearing a vest, standing behind a white long-haired female cat in a lace dress, holding her paws as they stretch forward in the wind. Both cats are photorealistic with detailed fur, wind-swept hair, and dramatic sunset lighting (warm golden highlights, cool blue shadows). Background: the Titanic ship at dusk with four smokestacks, glowing deck lights, calm ocean, and orange-pink sunset sky. Center title: “CATANIC” in the same gold metallic serif style as Titanic, same size and position."
}'json
{
"model": "grok-imagine-image-2-0/image-edit",
"aspect_ratio": "1:1",
"image_urls": [
"https://example.com/reference.png"
],
"prompt": "Recreate the Titanic movie poster with two adorable anthropomorphic cats in the same romantic pose at the bow of the ship. The male cat is an orange tabby wearing a vest, standing behind a white long-haired female cat in a lace dress, holding her paws as they stretch forward in the wind. Both cats are photorealistic with detailed fur, wind-swept hair, and dramatic sunset lighting (warm golden highlights, cool blue shadows). Background: the Titanic ship at dusk with four smokestacks, glowing deck lights, calm ocean, and orange-pink sunset sky. Center title: “CATANIC” in the same gold metallic serif style as Titanic, same size and position."
}Response
200 — Generation completed. usage contains actual billing details; result URLs are illustrative.
json
{
"ok": true,
"created": 1792134000,
"data": [
{
"url": "https://modelfold.ai/uploads/outputs/result.png"
}
],
"usage": {}
}