Grok Imagine Image · Edit
Integrate
xai/grok-imagine-image/edit
# Run the model; wait up to 20 s for the finished result in the same call
curl -X POST "https://api.doitong.com/v1/run/xai/grok-imagine-image/edit?wait=20" \
-H "Authorization: Bearer $DOITONG_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field"
}'
# Still "queued" or "running"? Poll with the id from the response:
curl "https://api.doitong.com/v1/requests/REQUEST_ID?wait=20" \
-H "Authorization: Bearer $DOITONG_API_KEY"
const API = "https://api.doitong.com/v1";
const headers = {
"Authorization": "Bearer " + process.env.DOITONG_API_KEY,
"Content-Type": "application/json",
};
// Run the model; wait up to 20 s for the finished result in the same call
let res = await fetch(API + "/run/xai/grok-imagine-image/edit?wait=20", {
method: "POST",
headers,
body: JSON.stringify({
"prompt": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field"
}),
});
let request = await res.json();
if (!res.ok) throw new Error(request.error.code + ": " + request.error.message);
// Not finished yet: long-poll until it is
while (request.status === "queued" || request.status === "running") {
res = await fetch(API + "/requests/" + request.id + "?wait=20", { headers });
request = await res.json();
}
if (request.status !== "succeeded") throw new Error(JSON.stringify(request.error));
console.log(request.outputs.map((o) => o.url), request.cost.credits + " API credits ($" + request.cost.usd + ")");
import os
import requests
API = "https://api.doitong.com/v1"
headers = {"Authorization": "Bearer " + os.environ["DOITONG_API_KEY"]}
payload = {
"prompt": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field",
}
# Run the model; wait up to 20 s for the finished result in the same call
r = requests.post(API + "/run/xai/grok-imagine-image/edit", params={"wait": 20}, json=payload, headers=headers)
request = r.json()
if not r.ok:
raise RuntimeError(request["error"]["code"] + ": " + request["error"]["message"])
# Not finished yet: long-poll until it is
while request["status"] in ("queued", "running"):
request = requests.get(API + "/requests/" + request["id"], params={"wait": 20}, headers=headers).json()
if request["status"] != "succeeded":
raise RuntimeError(request["error"])
print([o["url"] for o in request["outputs"]], request["cost"]["credits"], "API credits", "$" + request["cost"]["usd"])
# 1. Connect once (Claude Code; Cursor, VS Code, Claude Desktop: https://doitong.com/developers/docs/mcp)
claude mcp add --transport http doitong-models https://api.doitong.com/v1/mcp \
--header "Authorization: Bearer $DOITONG_API_KEY"
# 2. Your agent calls the "run" tool with:
{
"model_id": "xai/grok-imagine-image/edit",
"input": {
"prompt": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field"
}
}
Call the Grok Imagine Image · Edit model (xai/grok-imagine-image/edit) through the Doitong API. Docs for agents: https://doitong.com/developers/models/xai/grok-imagine-image/edit.md
POST https://api.doitong.com/v1/run/xai/grok-imagine-image/edit?wait=20
Authorization: Bearer $DOITONG_API_KEY
Content-Type: application/json
{
"prompt": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field"
}
If the response status is "queued" or "running", poll GET https://api.doitong.com/v1/requests/REQUEST_ID?wait=20 until it is "succeeded"; the files are in outputs[].url. POST https://api.doitong.com/v1/quote/xai/grok-imagine-image/edit with the same body returns the exact price before the run.
This request: $0.022 22 API credits Run it on this page
Your new API key. It is shown only now and is already in the code and in the API key field below. Keep it secret: never put it in code that runs in a browser.
Made on Doitong
Public works made with Grok Imagine Image by the Doitong community. Reuse a prompt in one click.
Art style: Professional portrait photography, cinematic lighting, realistic high detail. Арена, свет софитов, на табло алые цифры 00:45. Трибуны полны и неподвижны. Медиум: Арина с чёрной повязкой на волосах держит сковороду правой рукой. Натан стоит за столом напротив, в его руке пинцет....
Art style: 3D Cartoon. Christopher Kolumbus. Ein wettergegerbter Navigator im mittleren Alter mit fokussierten bernsteinfarbenen Augen und vom Wind zerzaustem, dunklem Haar. Er trägt ein dunkles Wams aus Wolle mit Lederbesatz über einem Leinenhemd. Seine Haut ist von der Sonne gebräunt und zeigt...
Art style: 3D Cartoon. Columbus leaning in the middle ground. Columbus is leaning on deck in the middle ground in the midground. Head in right profile. Eyes on water. Reaching down. Hopeful. Close-up at eye level, 9:16. Opening close-up, ending extreme close-up low angle. Key light side, cool...
Art style: 3D Cartoon. Sigmund sitting in the near foreground; Enkel crouching further back in the frame. Distance across the rug. Sigmund is sitting on armchair in the near foreground in the midground. Torso in three-quarter turn to screen-right. Head in three-quarter turn to screen-right. Eyes...
Art style: Cute 3D animation, colorful Pixar-inspired style, bright lighting, soft textures, adorable characters, family friendly. Майло. A tiny fluffy bright ginger-orange kitten with big expressive emerald-green eyes, a soft white chest, and four little white paws. He has a miniature pink nose...
Art style: Cute 3D animation, colorful Pixar-inspired style, bright lighting, soft textures, adorable characters, family friendly. Барнаби. A plump chestnut-brown squirrel with an enormous fluffy tail, wearing a tiny carved acorn shell cap tilted slightly over one ear. He has sharp bright dark...
Art style: Cute 3D animation, colorful Pixar-inspired style, bright lighting, soft textures, adorable characters, family friendly. Пип. A chubby, fluffy cream-and-caramel floppy-eared bunny wearing a small pastel blue fabric bow-tie around his neck. He has shiny round dark eyes, pink cheeks, and...
Art style: Cute 3D animation, colorful Pixar-inspired style, bright lighting, soft textures, adorable characters, family friendly. Мама-птица и Птенчик. A tiny, round baby bluebird covered in soft pastel-blue downy feathers with gigantic blinking dark eyes and an open yellow beak, perched...
Art style: Cute 3D. НЛО. A classic, bulbous metallic flying saucer hovering mid-air in the upper half of the vertical frame. The ship is adorned with a ring of colorful, rapidly flashing lights. Beneath it, a bright, translucent neon-green conical beam shines downward toward the bottom of the...
Art style: Троша: soft cozy 3D cartoon for kids, bright friendly colors, clean simple backgrounds, sunny soft daylight. 🎬 STAGING CONTRACT WORLD MAP: У калитки участка, пять якорей. (1) НИЗКАЯ КАЛИТКА В ЗАБОРЧИКЕ — светлая деревянная калитка в невысоком заборе, центр кадра, разделяет участок и...
Art style: Троша: soft cozy 3D cartoon for kids, bright friendly colors, clean simple backgrounds, sunny soft daylight. 🎬 STAGING CONTRACT WORLD MAP: У голубого чемодана возле калитки участка, пять якорей. (1) ГОЛУБОЙ ЧЕМОДАН НА КОЛЁСИКАХ — небесно-голубой детский чемодан, крышка закрыта, стоит...
Art style: 2D digital animation, thick dark outline #1A1410, big detailed comic-book heads on chubby bean bodies, flat dense vector colours, hard-edged cell shading, single upper-left light source. ELLIPSIS. A new location plate with no frame from the forum, generated in dawn light. Static wide...
Art style: Classic Fairytale. Бао. Round chubby plush panda toy, soft black-and-white fur with visible fabric pile texture, big fat white belly, black ear and limb patches, shiny black button eyes, tiny stitched smile, stubby legs, waddling gait, no clothing and no props. Silhouette tag: widest...
Cinematic head-and-shoulders portrait, face close-up, sharp eyes in crisp focus, shallow depth of field, soft key light with gentle rim light, filmic colour grading. The character looks slightly past the camera with a natural, expressive gaze. Neutral, softly blurred background. No text, no...
Cinematic head-and-shoulders portrait, face close-up, sharp eyes in crisp focus, shallow depth of field, soft key light with gentle rim light, filmic colour grading. The character looks slightly past the camera with a natural, expressive gaze. Neutral, softly blurred background. No text, no...
Art style: Cinematic Realistic. Вертикальный формат 9:16. Крупный план лица Алексея с усталым и недоверчивым выражением, экран смартфона слегка подсвечивает его лицо снизу холодным светом. На фоне размыта чистая открытая асфальтированная стоянка. Справа в расфокусе виднеется гладкое темно-серое...
Build a request
Controls are generated from the model schema. The code and the price update as you change them.
/run/xai/grok-imagine-image/edit?wait=20
quote → $0.022
# Run the model; wait up to 20 s for the finished result in the same call
curl -X POST "https://api.doitong.com/v1/run/xai/grok-imagine-image/edit?wait=20" \
-H "Authorization: Bearer $DOITONG_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field"
}'
# Still "queued" or "running"? Poll with the id from the response:
curl "https://api.doitong.com/v1/requests/REQUEST_ID?wait=20" \
-H "Authorization: Bearer $DOITONG_API_KEY"
const API = "https://api.doitong.com/v1";
const headers = {
"Authorization": "Bearer " + process.env.DOITONG_API_KEY,
"Content-Type": "application/json",
};
// Run the model; wait up to 20 s for the finished result in the same call
let res = await fetch(API + "/run/xai/grok-imagine-image/edit?wait=20", {
method: "POST",
headers,
body: JSON.stringify({
"prompt": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field"
}),
});
let request = await res.json();
if (!res.ok) throw new Error(request.error.code + ": " + request.error.message);
// Not finished yet: long-poll until it is
while (request.status === "queued" || request.status === "running") {
res = await fetch(API + "/requests/" + request.id + "?wait=20", { headers });
request = await res.json();
}
if (request.status !== "succeeded") throw new Error(JSON.stringify(request.error));
console.log(request.outputs.map((o) => o.url), request.cost.credits + " API credits ($" + request.cost.usd + ")");
import os
import requests
API = "https://api.doitong.com/v1"
headers = {"Authorization": "Bearer " + os.environ["DOITONG_API_KEY"]}
payload = {
"prompt": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field",
}
# Run the model; wait up to 20 s for the finished result in the same call
r = requests.post(API + "/run/xai/grok-imagine-image/edit", params={"wait": 20}, json=payload, headers=headers)
request = r.json()
if not r.ok:
raise RuntimeError(request["error"]["code"] + ": " + request["error"]["message"])
# Not finished yet: long-poll until it is
while request["status"] in ("queued", "running"):
request = requests.get(API + "/requests/" + request["id"], params={"wait": 20}, headers=headers).json()
if request["status"] != "succeeded":
raise RuntimeError(request["error"])
print([o["url"] for o in request["outputs"]], request["cost"]["credits"], "API credits", "$" + request["cost"]["usd"])
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "run",
"arguments": {
"model_id": "xai/grok-imagine-image/edit",
"input": {
"prompt": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field"
},
"wait_seconds": 20
}
}
}
Run this request
Your key stays in this browser: it is sent only to the Doitong API and saved (localStorage) only if you tick Remember. Get an API key
About Grok Imagine Image · Edit
Edits images described by a prompt of up to 8000 characters, using up to 3 URLs in `image_urls`. `aspect_ratio` defaults to auto, which keeps the ratio of the first input image, or can be set explicitly. Resolution is 1k or 2k, with up to 4 outputs in jpeg, png or webp. A revised prompt is returned.
Parameters
Send either the canonical name or the native name, not both. Canonical names
promptrequired
num_imagesoptional
num_outputs
aspect_ratiooptional
resolutionoptional
output_formatoptional
enable_safety_checkeroptional
image_urlsoptional
images
File parameters take a public https:// URL, a data: URI up to 10 MB, or the file_url of an upload. Files
Output
{
"id": "req_8k2m4q7x1z9c3v5b6n0p2r4t",
"object": "request",
"model": "xai/grok-imagine-image/edit",
"status": "succeeded",
"created_at": "2026-10-20T12:00:00Z",
"started_at": "2026-10-20T12:00:02Z",
"completed_at": "2026-10-20T12:00:09Z",
"queue_position": null,
"cost": {
"credits": 22,
"usd": "0.022",
"charged": 22,
"refunded": 0
},
"input": {
"prompt": "A red fox trots through fresh snow at sunrise, soft golden light, shallow depth of field"
},
"output": {
"images": [
{
"url": "https://content.doitong.com/dev-api/2026/10/20/req_8k2m4q7x1z9c3v5b6n0p2r4t/0-output.jpeg",
"content_type": "image/jpeg",
"file_name": "0-output.jpeg",
"file_size": 1843200,
"width": 1024,
"height": 768
}
],
"revised_prompt": "string"
},
"outputs": [
{
"type": "image",
"url": "https://content.doitong.com/dev-api/2026/10/20/req_8k2m4q7x1z9c3v5b6n0p2r4t/0-output.jpeg",
"content_type": "image/jpeg",
"file_size": 1843200,
"width": 1024,
"height": 768,
"stored": true
}
],
"error": null,
"metrics": {
"inference_seconds": 6.8
},
"urls": {
"self": "https://api.doitong.com/v1/requests/req_8k2m4q7x1z9c3v5b6n0p2r4t",
"cancel": "https://api.doitong.com/v1/requests/req_8k2m4q7x1z9c3v5b6n0p2r4t/cancel"
}
}
Fields of output
- images
- array of object {url, content_type, file_name, file_size, width, height}URL pointing to the edited image.
- revised_prompt
- string | nullEnhanced prompt used for image generation.
Other Grok Imagine Image variants
More models: Image Editing
For AI agents: this page as Markdown is at https://doitong.com/developers/models/xai/grok-imagine-image/edit.md. All models and guides: https://doitong.com/developers/llms.txt






