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.
Wypróbuj model
PNG, JPEG, WebP, or GIF · 20 MiB maximum each
Wybierz przykład, aby wczytać jego dane wejściowe i wynik do playgroundu.
{
"prompt": "Make this scene more realistic but still keep the game vibes"
}Preferencje użytkowników
Oceny Elo na podstawie ślepych głosowań porównawczych, zestawione z innymi modelami obrazu i wideo.
Rankingi pochodzą z Artificial Analysis Arena
Arena edycji obrazu: użytkownicy wybierają lepszą z dwóch edycji tego samego obrazu i instrukcji, bez znajomości nazw modeli.
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.
Zacznij tworzyć
Prześlij ten model przez 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"Utwórz klucz API SandBase i ustaw go w środowisku serwera. Wszystkie żądania używają uwierzytelniania Bearer.
export SANDBASE_API_KEY="YOUR_API_KEY"Przechowuj klucz na serwerze. Nie ujawniaj go w kodzie przeglądarkowym ani nie commituj do repozytorium.
Wyślij POST do /v1/run z tym identyfikatorem modelu i jego danymi wejściowymi. Powyższy przykład żądania obejmuje wysyłanie i odpytywanie statusu.
Użyj zwróconego ID uruchomienia, aby odpytywać status do momentu completion, failed lub timeout. Odczytaj wynik dopiero po completion.
curl "https://api.sandbase.ai/v1/run/$RUN_ID" \
-H "Authorization: Bearer $SANDBASE_API_KEY"Przekaż publicznie dostępny URL pliku w polu image, video lub audio modelu. Obsługiwane formaty i limity są pokazane obok każdego pola wejściowego w Playground.
Użyj kontrolki upload lub replace w obsługiwanych polach image w Playground. Pola URL wideo akceptują hostowany film źródłowy; nie oznacza to obsługi przesyłania wideo.
imagesarrayList of URLs of the images to edit. A maximum of 3 images are supported.
promptstringwymaganeText description of the desired image.
qualitystringQuality level of the edited image.
Domyślnie: "medium"
Możliwe wartości: "low", "medium"
resolutionstringResolution of the generated image. `1k` for standard resolution, `2k` for high resolution.
Domyślnie: "1k"
Możliwe wartości: "1k", "2k"
aspect_ratiostringThe aspect ratio of the generated image.
Możliwe wartości: "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.
Domyślnie: "jpeg"
Możliwe wartości: "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"
}Zakończone uruchomienie udostępnia swój wynik w output. Poniżej znajduje się zapisany przykład modelu, a nie nowa generacja.
[
{
"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"
}
]