Grok Imagine Image 2.0 Edit
Changes or combines images by instruction.
| Model ID | grok-imagine-image-2.0-edit |
| Task | edit-image |
| Output | image |
| Family | Grok Imagine |
| Status | Active |
Prices are live, so this page does not show them. GET /v1/models/grok-imagine-image-2.0-edit returns the published price (price), and POST /v1/quotes returns the binding maximum for one request, with the processor that will run it. You are never charged more than the quoted maximum, and failed work is free. See Pricing and quotes.
Parameters
Section titled “Parameters”Send these in input. Omitted parameters take their default; unknown parameters are refused with 422 parameter_unknown. The same schema is input_schema in GET /v1/models/grok-imagine-image-2.0-edit.
| Name | Type | Default | Allowed | Required | Description |
|---|---|---|---|---|---|
prompt |
string | 1 to 4000 characters | Yes | Describe the edit. Up to five images can guide the result. | |
aspect_ratio |
string | auto |
14 values, listed below | No | Auto keeps the first image’s shape. |
size |
string | 1k |
1k, 2k |
No | 2K renders more detail and costs more on fal. |
quality |
string | medium |
low, medium |
No | Medium renders more detail and costs more on fal. |
format |
string | jpeg |
jpeg, png, webp |
No | File format of the generated image. |
count |
integer | 1 |
1 to 10 | No | How many images to make. Each one is charged. |
aspect_ratio values
Section titled “aspect_ratio values”auto, 2:1, 20:9, 19.5:9, 16:9, 4:3, 3:2, 1:1, 2:3, 3:4, 9:16, 9:19.5, 9:20, 1:2
Media inputs
Section titled “Media inputs”Each media input takes an asset ID (asset_…), a generation ID (gen_…, its first output), a public HTTPS URL or a small data: URI. URLs and data URIs are imported into the project first; see Uploading media.
| Name | Accepts | How many | Required | Notes |
|---|---|---|---|---|
references |
image | 1 to 5 | Yes |
Restrictions
Section titled “Restrictions”- xAI may revise the submitted image prompt. The requested prompt and host provenance remain on the result.
Example
Section titled “Example”Price the request first. A quote is free and starts nothing:
curl https://api.halationlab.ai/v1/quotes \ -H "Authorization: Bearer $HALATIONLAB_API_KEY" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Content-Type: application/json" \ -d @- <<'JSON'{ "model": "grok-imagine-image-2.0-edit", "input": { "prompt": "Make the background a sunny beach", "aspect_ratio": "auto", "references": [ "https://docs.halationlab.ai/media/sample-image.png" ] }}JSONThen start it, paying at most MAX_COST tokens. If the price is higher, nothing starts and the 402 max_cost_exceeded answer carries the quote:
MAX_COST=${MAX_COST:?Set MAX_COST to the most you will pay, in tokens}curl https://api.halationlab.ai/v1/generations \ -H "Authorization: Bearer $HALATIONLAB_API_KEY" \ -H "Idempotency-Key: $(uuidgen)" \ -H "Prefer: wait=60" \ -H "Content-Type: application/json" \ -d @- <<JSON{ "model": "grok-imagine-image-2.0-edit", "input": { "prompt": "Make the background a sunny beach", "aspect_ratio": "auto", "references": [ "https://docs.halationlab.ai/media/sample-image.png" ] }, "max_cost": $MAX_COST}JSONThe media URLs point at small sample files on this site. Replace them with your own asset IDs, generation IDs or URLs.