Flexible parameters
Configure 9 documented parameters, including aspect_ratio, enable_pro, enable_safety_checker, image_url, mask_indices.
Text-to-image, segmentation maps, and targeted image editing
curl -X POST https://runapi.ai/api/v1/grok_imagine/segment_map \
-H "Authorization: Bearer $RUNAPI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "grok-imagine-image-2-0",
"prompt": "Generate a short video of a robot hand placing a chess piece on a board, dramatic lighting, slow motion."
}'
import { GrokImagineClient } from "@runapi.ai/grok-imagine";
const client = new GrokImagineClient();
const result = await client.segmentMap.run({
model: "grok-imagine-image-2-0",
prompt: "Generate a short video of a robot hand placing a chess piece on a board, dramatic lighting, slow motion.",
});
import os
import requests
response = requests.post(
"https://runapi.ai/api/v1/grok_imagine/segment_map",
headers={"Authorization": f"Bearer {os.environ['RUNAPI_API_KEY']}"},
json={"model":"grok-imagine-image-2-0","prompt":"Generate a short video of a robot hand placing a chess piece on a board, dramatic lighting, slow motion."}
)
response.raise_for_status()
<?php
$client = curl_init("https://runapi.ai/api/v1/grok_imagine/segment_map");
curl_setopt_array($client, [
CURLOPT_HTTPHEADER => ["Authorization: Bearer " . getenv("RUNAPI_API_KEY"), "Content-Type: application/json"],
CURLOPT_POSTFIELDS => json_encode([
'model' => 'grok-imagine-image-2-0',
'prompt' => 'Generate a short video of a robot hand placing a chess piece on a board, dramatic lighting, slow motion.',
])
]);
$response = curl_exec($client);
RunApi client = new RunApi(System.getenv("RUNAPI_API_KEY"));
Task task = client.segmentMap().run({"model":"grok-imagine-image-2-0","prompt":"Generate a short video of a robot hand placing a chess piece on a board, dramatic lighting, slow motion."});
task.waitForResult();
require "runapi/grok_imagine"
client = RunApi::GrokImagine::Client.new
result = client.segment_map.run(
model: "grok-imagine-image-2-0",
prompt: "Generate a short video of a robot hand placing a chess piece on a board, dramatic lighting, slow motion."
)
client := runapi.NewClient(os.Getenv("RUNAPI_API_KEY"))
task, err := client.segmentMap.Run({"model":"grok-imagine-image-2-0","prompt":"Generate a short video of a robot hand placing a chess piece on a board, dramatic lighting, slow motion."})
if err != nil { log.Fatal(err) }
task.Wait()
$ runapi generate \
--model grok-imagine-image-2-0 \
--endpoint segment_map \
--wait
7 versions available
Pick any model and generate in seconds.
| Provider | xAI |
| Model ID | grok-imagine-image-2-0 |
| Modality | Image |
| Task types | Asynchronous |
| API endpoint | /api/v1/grok_imagine/edit_image, /api/v1/grok_imagine/segment_map, /api/v1/grok_imagine/text_to_image |
| Billing unit | call |
| Input parameters | aspect_ratio, callback_url, enable_pro, enable_safety_checker, image_url, mask_indices, model, prompt, source_image_url, source_image_urls, source_task_id |
| Aspect ratios | 1:1, 2:3, 3:2, 16:9, 9:16, auto |
| Catalog status | Operational |
Sign up for free and create an API key for grok-imagine-image-2-0 from the dashboard.
POST to /api/v1/grok_imagine/segment_map with the grok-imagine-image-2-0 model slug and your parameters.
Poll the task or follow the callback to retrieve the completed grok-imagine-image-2-0 result.
Configure 9 documented parameters, including aspect_ratio, enable_pro, enable_safety_checker, image_url, mask_indices.
Exposes 3 public endpoint(s): edit_image, segment_map, text_to_image.
Asynchronous tasks accept a callback URL for completion notifications.
Metered by call with no subscription requirement.
image_urlPublic image URL that the service can fetch.
callback_urlWebhook URL for terminal Task delivery.
source_task_idCompleted Image 2.0 text-to-image Task ID owned by the same account. Compatibility input; use image_url instead.
Auto-generate lifestyle product photos for e-commerce catalogs that lack studio photography.
Rapidly concept environments and characters before committing to final art.
Generate unique cover art and illustrations for blog posts and articles at scale.
Verified customer feedback is not available for this model yet.
Pass the model ID shown in the quickstart.
Per-key rate limits scale with your usage tier. The pricing page shows current limits. If you need higher throughput, contact support to discuss tier upgrades.
Yes. Variant is a parameter in the request. Switch by changing the model ID — no code changes, no re-authentication, no separate billing setup. All variants share the same API key and request shape.
Where streaming is available, RunAPI streams end-to-end. LLM models support token-level streaming. Media models use async task polling or webhook callbacks for result delivery.
Open an issue on the public GitHub repo or email support at [email protected]. Include the task ID and model ID so the team can investigate the specific generation.
No. Your RunAPI API key is enough to access this variant and every other model in the catalog. You do not need accounts with the underlying provider.
We're here to help with enterprise setup, integrations, and technical questions.
Contact Us