imagesarray
List of URLs of the images to edit. A maximum of 3 images are supported.
xai/grok-imagine-image/editGrok Imagine Image Edit is xAI's intelligent image editing model. Transform, retouch, and reimagine existing images using text prompts - from background replacement to artistic style conversion.
Testar o modelo
PNG, JPEG, WebP, or GIF · 20 MiB maximum each
Selecione um exemplo para carregar as entradas e o resultado no playground.
{
"prompt": "Make this scene more realistic but still keep the game vibes"
}Preferência humana
Classificações Elo de votos cegos lado a lado, comparadas com outros modelos de imagem e vídeo.
Classificações obtidas de Artificial Analysis Arena
Arena de edição de imagem: as pessoas escolhem a melhor de duas edições da mesma imagem e instrução, sem ver os nomes dos modelos.
Grok Imagine Image edit (standard): fast, low-cost image edits.
| 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. |
aspect_ratio | 21:9 / 16:9 / 3:2 / 4:3 / 5:4 / 1:1 / 4:5 / 3:4 / 2:3 / 9:16 | — | Output shape. |
output_format | jpeg / png | jpeg | Output file format. |
$0.02 per output image plus $0.002 per input image.
| Request | Price |
|---|---|
| 1 input image | $0.022 |
| 3 input images | $0.026 |
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/2.0/text-to-image, xai/grok-imagine-image/2.0/edit.
Comece a construir
Envie este modelo pela 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/edit",
"images": [
"https://static.sandbase.ai/examples/xai/grok-imagine-image/edit/input_images_0.png"
],
"prompt": "Make this scene more realistic but still keep the game vibes",
"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"Crie uma chave da API SandBase e defina-a no ambiente do seu servidor. Todas as requisições usam autenticação Bearer.
export SANDBASE_API_KEY="YOUR_API_KEY"Mantenha a chave no servidor. Não a exponha em código do navegador nem a comite em um repositório.
Faça POST para /v1/run com este ID de modelo e suas entradas. O exemplo de requisição acima inclui envio e polling.
Use o ID de execução retornado para fazer polling até que o status seja completed, failed ou timeout. Leia a saída somente após completed.
curl "https://api.sandbase.ai/v1/run/$RUN_ID" \
-H "Authorization: Bearer $SANDBASE_API_KEY"Passe uma URL de arquivo acessível publicamente no campo de imagem, vídeo ou áudio do modelo. Os formatos e limites suportados são mostrados ao lado de cada entrada do Playground.
Use o controle de upload ou substituição nos campos de imagem suportados no Playground. Campos de URL de vídeo aceitam um vídeo de condução hospedado; isso não implica suporte a upload de vídeo.
imagesarrayList of URLs of the images to edit. A maximum of 3 images are supported.
promptstringobrigatórioText description of the desired image.
resolutionstringResolution of the generated image. `1k` for standard resolution, `2k` for high resolution.
Padrão: "1k"
Valores possíveis: "1k", "2k"
aspect_ratiostringThe aspect ratio of the generated image.
Valores possíveis: "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.
Padrão: "jpeg"
Valores possíveis: "jpeg", "png"
{
"model": "xai/grok-imagine-image/edit",
"images": [
"https://static.sandbase.ai/examples/xai/grok-imagine-image/edit/input_images_0.png"
],
"prompt": "Make this scene more realistic but still keep the game vibes",
"resolution": "1k",
"output_format": "jpeg"
}Uma execução concluída expõe seu resultado em output. O texto a seguir é o exemplo salvo do modelo, não uma nova geração.
[
{
"source": "xAI schema mirror",
"source_url": "https://docs.x.ai/",
"url": "https://static.sandbase.ai/examples/fef66c03-8926-4e6f-962b-7c117da372e4/output/b2da9da9-9e53-44f9-86fd-2363ac37b163.jpg"
}
]