Skip to main content
Core.Today
|
xAIFastHigh

Grok Imagine Image 2.0 Edit

Dedicated edit endpoint for xAI's Grok Imagine Image 2.0. Precise, instruction-following edits on an existing image - ideal for ads, mockups, and asset touch-ups.

160 credits
per image
Precise instruction-following edits (2.0 family strengths)
Up to 10 edited variants per request (billed per image)
Aspect ratio control for the output
1k / 2k output resolution tiers (2k billed higher)

Run it right now

Test this model instantly in the Console Playground โ€” no code required

Sign in to try

Use with AI Assistant

Copy usage instructions for Claude, ChatGPT, or other AI

Quick Start

curl -X POST "https://api.core.today/v1/predictions" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: cdt_your_api_key" \
  -d '{
  "model": "xai/grok-imagine-image-2.0/edit",
  "input": {
    "prompt": "Replace the background with a clean studio gradient",
    "image": "https://example.com/product.jpg"
  }
}'

Parameters

ParameterTypeRequiredDefaultDescription
promptstringYes-Text prompt describing the edit.
imagestringYes-Source image URL to edit. Supports jpg, jpeg, png (max 20MiB).
nintegerNo1Number of edited variants to generate (1-10). Billed per image.
aspect_ratiostringNoautoAspect ratio of the output image.
auto1:116:99:164:33:43:22:32:11:219.5:99:19.520:99:20
resolutionstringNo-Output resolution tier. 2k is billed at a higher rate; omitted defaults to 1k.
1k2k

How to Provide File Input

There are 3 ways to provide files for the image parameter:

Recommended

Image URL

Pass a publicly accessible URL directly. With the Storage API (POST /v1/files/upload-url) the file uploads straight to S3 (50MB per file) and you pass the returned file_url.

{
  "model": "xai/grok-imagine-image-2.0/edit",
  "input": {
    "prompt": "your prompt here",
    "image": "https://example.com/image.jpg"
  }
}

Direct Upload (Multipart)

Attach files directly to POST /v1/predictions/upload. No separate upload step, but the bytes pass through the API server so the whole request is capped at 10MB.

curl -X POST "https://api.core.today/v1/predictions/upload" \
  -H "X-API-Key: cdt_your_api_key" \
  -F "model=xai/grok-imagine-image-2.0/edit" \
  -F 'input={"prompt":"your prompt here"}' \
  -F "file:image=@your_file.png"
See the File Upload docs for more upload methods including Presigned URLs.

Common Parameters

Common parameters used when calling POST /v1/predictions.

ParameterTypeRequiredDefaultDescription
modelstringYes-Model identifier
inputobjectYes-Object containing the model-specific parameters from the table above
output_folderstringNo-Folder path for output files (max 256 chars, '..' not allowed)
webhook_urlstringNo-Webhook URL to call on completion
is_publicbooleanNofalseIf true, output files are also available via permanent public URLs

Examples

Background Swap

Replace the background while keeping the subject

curl -X POST "https://api.core.today/v1/predictions" \
  -H "Content-Type: application/json" \
  -H "X-API-Key: cdt_your_api_key" \
  -d '{
  "model": "xai/grok-imagine-image-2.0/edit",
  "input": {
    "prompt": "Replace the background with a clean studio gradient",
    "image": "https://example.com/product.jpg"
  }
}'

Tips & Best Practices

1Best tier for edits that must follow instructions exactly (text, layout, brand elements)
2For pure generation, use xai/grok-imagine-image-2.0 instead
3Batch alternative edits with the n parameter

Use Cases

Ad creative and product image touch-ups with exact instructions
UI/UX mockup revisions
Game asset variations from a source render