API docsModel reference

Grok Imagine Image 2.0 API

xAI Grok Imagine Image 2.0: bold, detailed images with low/medium quality tiers at 1K or 2K.

POST/api/v1/generationsBearer API key
grok-imagine-image-2.0Image · xAIModel details & pricing

Endpoints for this model

Select a provider to see its effective parameter limits. Automatic routing chooses a provider that supports your input. Examples include defaults and required inputs; replace example media URLs with accessible files.

Request

cURL
curl 'https://01router.com/api/v1/generations' \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "grok-imagine-image-2.0",
  "input": {
    "prompt": "A cinematic landscape at sunrise.",
    "aspect_ratio": "1:1",
    "resolution": "1K",
    "quality": "medium",
    "num_images": 1
  }
}'

Input parameters

JSON body

For /generations and /quote, put these parameters inside input. For /images/generations, put them at the top level. Chat parameters go at the top level of /chat/completions.

model
stringRequired

Model slug from the catalog. Project keys may use a project-specific model slug.

Allowed values:"grok-imagine-image-2.0"
input
objectRequired

Model-specific input object. See the selected model reference for required fields, defaults and limits.

provider
stringOptional

Optional provider slug. Omit for automatic routing; project settings may pin the provider.

project
stringOptional

Optional project ID. Use its published model catalog and routing configuration.

callback_url
string<uri>Optional

Public HTTPS URL, up to 1,000 characters. Receives the final generation object. Private network addresses are rejected.

input.prompt
stringRequired
input.image_urls
string<uri>[]Optional

Optional — switches to image editing

Maximum items:4
input.aspect_ratio
enumOptional
Default:"1:1"
Allowed values:"1:1""16:9""9:16""4:3""3:4""3:2""2:3"
input.resolution
enumOptional
Default:"1K"
Allowed values:"1K""2K"
input.quality
enumOptional
Default:"medium"
Allowed values:"low""medium"
input.num_images
integerOptional
Default:1
Minimum:1
Maximum:4

Response example

200 · application/json
{
  "id": "gen_example",
  "object": "generation",
  "model": "grok-imagine-image-2.0",
  "type": "image",
  "provider": "fal",
  "status": "processing",
  "input": {
    "prompt": "A cinematic landscape at sunrise.",
    "aspect_ratio": "1:1",
    "resolution": "1K",
    "quality": "medium",
    "num_images": 1
  },
  "outputs": [],
  "error": null,
  "credits": 100,
  "price_usd": 1,
  "created_at": "2026-10-25T08:00:00.000Z",
  "completed_at": null
}

Responses are illustrative. IDs, usage, prices and results depend on the actual request.

Response fields

id
string

Generation ID returned by the create request.

object
"generation"

generation

model
string

Model slug from the catalog. Project keys may use a project-specific model slug.

type
video | image | audio | chat
provider
string

Optional provider slug. Omit for automatic routing; project settings may pin the provider.

status
string

queued / processing / succeeded / failed. Stop polling on succeeded or failed.

input
object

Model-specific input object. See the selected model reference for required fields, defaults and limits.

outputs
string[]

Result file URLs. Empty until available; download promptly because URLs may expire.

error
string | null

Error message on failure; null otherwise.

credits
number

Credits charged for this generation; zero after a refund.

price_usd
number

Price of this generation in USD; zero after a refund.

created_at
string

Creation time in ISO 8601 format.

completed_at
string | null

Completion time in ISO 8601 format, or null while running.

Usage notes

  • Poll at intervals of at least 3 seconds. A 504 from the synchronous image endpoint means the task may still be running: poll its error.id instead of submitting it again.

Use with AI

Give your coding assistant the documentation index or the full API reference, including live model parameters.