imagesarray
List of URLs of the images to edit. A maximum of 3 images are supported.
xai/grok-imagine-image/2.0/editGrok Imagine Image 2.0 Edit is xAI's intelligent image editing model. Transform, retouch, and reimagine existing images using text prompts - from background replacement to artistic style conversion.
Modell testen
PNG, JPEG, WebP, or GIF · 20 MiB maximum each
Wählen Sie ein Beispiel aus, um seine Eingaben und das Ergebnis in den Playground zu laden.
{
"prompt": "Make this scene more realistic but still keep the game vibes"
}Menschliche Präferenz
Elo-Wertungen aus anonymen Direktvergleichen, verglichen mit anderen Bild- und Videomodellen.
Ranglisten aus Artificial Analysis Arena
Arena für Bildbearbeitung: Personen wählen aus zwei Bearbeitungen desselben Bildes und derselben Anweisung die bessere aus, ohne die Modellnamen zu sehen.
Grok Imagine Image 2.0 edit: change or combine images at two quality levels.
| Field | Type | Default | Notes |
|---|---|---|---|
prompt | string, required | — | Up to 8,000 characters. |
images | image URL[] | — | Images to edit or combine, Image 1, Image 2, … |
resolution | 1k / 2k | 1k | Sets the per-image rate. |
output_format | jpeg / png | jpeg | Output file format. |
quality | low / medium | medium | Sets the per-image rate. |
aspect_ratio | 21:9 / 16:9 / 3:2 / 4:3 / 5:4 / 1:1 / 4:5 / 3:4 / 2:3 / 9:16 | — | Output shape. |
Per output image: $0.04 (low) or $0.06 (medium) at 1K; $0.06 or $0.08 at 2K; plus $0.01 per input image.
| Request | 1k | 2k |
|---|---|---|
| low, 1 input | $0.05 | $0.07 |
| medium, 1 input | $0.07 | $0.09 |
Failed runs are not charged.
Other Grok Imagine Image endpoints: xai/grok-imagine-image/quality, xai/grok-imagine-image/quality/edit, xai/grok-imagine-image/edit, xai/grok-imagine-image/2.0/text-to-image.
Jetzt loslegen
Senden Sie dieses Modell über die SandBase Unified Run API.
# The quoted heredoc keeps Unicode and shell metacharacters unchanged.
result=$(curl --fail-with-body --silent \
-X POST "https://api.sandbase.ai/v1/run" \
-H "Authorization: Bearer $SANDBASE_API_KEY" \
-H "Content-Type: application/json" \
--data-binary @- <<'SANDBASE_JSON'
{
"model": "xai/grok-imagine-image/2.0/edit",
"prompt": "Make this scene more realistic but still keep the game vibes",
"quality": "medium",
"resolution": "1k",
"output_format": "jpeg"
}
SANDBASE_JSON
)
run_id=$(printf '%s' "$result" | jq -r .id)
for attempt in $(seq 1 120); do
status=$(printf '%s' "$result" | jq -r .status)
case "$status" in completed|failed|timeout) break ;; esac
sleep 2
result=$(curl --fail-with-body --silent \
-H "Authorization: Bearer $SANDBASE_API_KEY" \
"https://api.sandbase.ai/v1/run/$run_id")
done
status=$(printf '%s' "$result" | jq -r .status)
[ "$status" = completed ] || { echo "Generation ended: $status" >&2; exit 1; }
printf '%s\n' "$result"Erstellen Sie einen SandBase API-Schlüssel und legen Sie ihn in Ihrer Serverumgebung fest. Alle Anfragen verwenden Bearer-Authentifizierung.
export SANDBASE_API_KEY="YOUR_API_KEY"Bewahren Sie den Schlüssel auf dem Server auf. Geben Sie ihn nicht in Browser-Code preis und committen Sie ihn nicht in ein Repository.
POST an /v1/run mit dieser Modell-ID und ihren Eingaben. Das obige Anfragebeispiel umfasst Übermittlung und Polling.
Verwenden Sie die zurückgegebene Run-ID zum Polling, bis der Status completed, failed oder timeout ist. Lesen Sie die Ausgabe erst nach completed.
curl "https://api.sandbase.ai/v1/run/$RUN_ID" \
-H "Authorization: Bearer $SANDBASE_API_KEY"Übergeben Sie eine öffentlich zugängliche Date-URL im Bild-, Video- oder Audiofeld des Modells. Unterstützte Formate und Limits werden neben jedem Playground-Eingabefeld angezeigt.
Verwenden Sie im Playground bei unterstützten Bildfeldern die Steuerung zum Hochladen oder Ersetzen. Video-URL-Felder akzeptieren ein gehostetes Fahrvideo; sie implizieren keine Unterstützung für Video-Uploads.
imagesarrayList of URLs of the images to edit. A maximum of 3 images are supported.
promptstringerforderlichText description of the desired image.
qualitystringQuality level of the edited image.
Standard: "medium"
Mögliche Werte: "low", "medium"
resolutionstringResolution of the generated image. `1k` for standard resolution, `2k` for high resolution.
Standard: "1k"
Mögliche Werte: "1k", "2k"
aspect_ratiostringThe aspect ratio of the generated image.
Mögliche Werte: "21:9", "16:9", "3:2", "4:3", "5:4", "1:1", "4:5", "3:4", "2:3", "9:16"
output_formatstringThe format of the generated image.
Standard: "jpeg"
Mögliche Werte: "jpeg", "png"
{
"model": "xai/grok-imagine-image/2.0/edit",
"prompt": "Make this scene more realistic but still keep the game vibes",
"quality": "medium",
"resolution": "1k",
"output_format": "jpeg"
}Ein abgeschlossener Run stellt sein Ergebnis in der Ausgabe bereit. Das Folgende ist das gespeicherte Beispiel des Modells, keine neue Generierung.
[
{
"source": "xAI schema mirror",
"source_url": "https://docs.x.ai/",
"url": "https://static.sandbase.ai/examples/c73441b8-80d0-4d22-9ea7-33962ff210b9/output/4c051d8c-762c-4b5a-b14e-bf612672acc0.jpg"
}
]