Create Grok Imagine Image Quality — Text To Image
curl --request POST \
--url https://api.apisale.ai/v1/run/xai/grok-imagine-image/quality/text-to-image \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"input": {
"prompt": "Cinematic aerial drone shot gliding over a neon-lit megacity at dusk, volumetric god rays cutting through low clouds, ultra-sharp anamorphic bokeh, IMAX film still, 16:9",
"num_images": 1,
"resolution": "1k",
"aspect_ratio": "16:9",
"output_format": "jpeg"
}
}
'import requests
url = "https://api.apisale.ai/v1/run/xai/grok-imagine-image/quality/text-to-image"
payload = { "input": {
"prompt": "Cinematic aerial drone shot gliding over a neon-lit megacity at dusk, volumetric god rays cutting through low clouds, ultra-sharp anamorphic bokeh, IMAX film still, 16:9",
"num_images": 1,
"resolution": "1k",
"aspect_ratio": "16:9",
"output_format": "jpeg"
} }
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
input: {
prompt: 'Cinematic aerial drone shot gliding over a neon-lit megacity at dusk, volumetric god rays cutting through low clouds, ultra-sharp anamorphic bokeh, IMAX film still, 16:9',
num_images: 1,
resolution: '1k',
aspect_ratio: '16:9',
output_format: 'jpeg'
}
})
};
fetch('https://api.apisale.ai/v1/run/xai/grok-imagine-image/quality/text-to-image', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"run_id": "<string>",
"endpoint": "<string>",
"model": "<string>",
"capability": "<string>",
"mode": "<string>",
"status": "queued",
"created_at": "2023-11-07T05:31:56Z",
"output": {},
"error": {
"type": "<string>",
"code": 123,
"message": "<string>"
},
"billing": {
"amount": "<string>",
"currency": "usd"
},
"started_at": "2023-11-07T05:31:56Z",
"completed_at": "2023-11-07T05:31:56Z",
"elapsed_ms": 123
}Xai
Grok Imagine Image Quality — Text To Image
xAI Grok Imagine image — grok-imagine-image-quality (1K/2K), text-to-image and edit. Optimized for text to image via apisale.
POST
/
v1
/
run
/
xai
/
grok-imagine-image
/
quality
/
text-to-image
Create Grok Imagine Image Quality — Text To Image
curl --request POST \
--url https://api.apisale.ai/v1/run/xai/grok-imagine-image/quality/text-to-image \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"input": {
"prompt": "Cinematic aerial drone shot gliding over a neon-lit megacity at dusk, volumetric god rays cutting through low clouds, ultra-sharp anamorphic bokeh, IMAX film still, 16:9",
"num_images": 1,
"resolution": "1k",
"aspect_ratio": "16:9",
"output_format": "jpeg"
}
}
'import requests
url = "https://api.apisale.ai/v1/run/xai/grok-imagine-image/quality/text-to-image"
payload = { "input": {
"prompt": "Cinematic aerial drone shot gliding over a neon-lit megacity at dusk, volumetric god rays cutting through low clouds, ultra-sharp anamorphic bokeh, IMAX film still, 16:9",
"num_images": 1,
"resolution": "1k",
"aspect_ratio": "16:9",
"output_format": "jpeg"
} }
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
input: {
prompt: 'Cinematic aerial drone shot gliding over a neon-lit megacity at dusk, volumetric god rays cutting through low clouds, ultra-sharp anamorphic bokeh, IMAX film still, 16:9',
num_images: 1,
resolution: '1k',
aspect_ratio: '16:9',
output_format: 'jpeg'
}
})
};
fetch('https://api.apisale.ai/v1/run/xai/grok-imagine-image/quality/text-to-image', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"run_id": "<string>",
"endpoint": "<string>",
"model": "<string>",
"capability": "<string>",
"mode": "<string>",
"status": "queued",
"created_at": "2023-11-07T05:31:56Z",
"output": {},
"error": {
"type": "<string>",
"code": 123,
"message": "<string>"
},
"billing": {
"amount": "<string>",
"currency": "usd"
},
"started_at": "2023-11-07T05:31:56Z",
"completed_at": "2023-11-07T05:31:56Z",
"elapsed_ms": 123
}Overview
xAI Grok Imagine image — grok-imagine-image-quality (1K/2K), text-to-image and edit. Optimized for text to image via apisale.Docs = API contract + Try it (snapshot). Explore = browser playground. Model page = product examples.
Endpoint
POST https://api.apisale.ai/v1/run/xai/grok-imagine-image/quality/text-to-image
| Model slug | xai/grok-imagine-image/quality/text-to-image |
| Category | Text to Image (text-to-image) |
| Lab | Xai |
| Tier | Quality |
| Mode | async |
Pricing
From $0.035/image apisale price is 30% below the vendor’s official list price.| Tier | Unit | Official price | apisale price |
|---|---|---|---|
| 1K | image | $0.050 | $0.035 |
| 2K | image | $0.070 | $0.049 |
Official price = vendor list price. apisale price = what you pay through apisale.
Request
{
"input": {
"prompt": "Cinematic aerial drone shot gliding over a neon-lit megacity at dusk, volumetric god rays cutting through low clouds, ultra-sharp anamorphic bokeh, IMAX film still, 16:9",
"num_images": 1,
"resolution": "1k",
"aspect_ratio": "16:9",
"output_format": "jpeg"
}
}
Parameters
Fields marked * are required. UseAuthorization: Key YOUR_API_KEY for REST.
string
required
Text prompt describing the image. Maximum 10000 characters.
number
Number of images to generate (1-4). Default:
1 Range: 1 – 4string
Default:
1k Values: 1k, 2kstring
Default:
1:1 Values: 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:2string
Default:
jpeg Values: jpeg, png, webpstring
Optional HTTPS webhook when the run reaches a terminal state.
boolean
Block until completion (same Run response shape).
Input schema
Input schema
{
"params": {
"prompt": {
"type": "string",
"required": true,
"max_length": 10000,
"description": "Text prompt describing the image. Maximum 10000 characters."
},
"num_images": {
"max": 4,
"min": 1,
"type": "int",
"default": 1,
"description": "Number of images to generate (1-4)."
},
"resolution": {
"type": "enum",
"values": [
"1k",
"2k"
],
"default": "1k"
},
"aspect_ratio": {
"type": "enum",
"values": [
"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"
],
"default": "1:1"
},
"output_format": {
"type": "enum",
"values": [
"jpeg",
"png",
"webp"
],
"default": "jpeg"
}
}
}
Submit response
Returns a Run withrun_id. Poll with GET /v1/runs/{run_id} or use Try it above.
string
required
Unique run ID — save for polling and webhooks.
string
required
queued (async) or terminal state for sync runs.object
Result when
status is succeeded — see Output schema below.Example (async submit)
{
"run_id": "run_550e8400-e29b-41d4-a716-446655440000",
"endpoint": "xai/grok-imagine-image/quality/text-to-image",
"model": "text-to-image",
"capability": "image",
"mode": "text-to-image",
"status": "queued",
"output": null,
"error": null,
"billing": null,
"created_at": "2026-06-27T12:00:00.000Z",
"started_at": null,
"completed_at": null,
"elapsed_ms": null
}
Output
Whenstatus is succeeded, output follows this schema:
Output schema
Output schema
{
"type": "object",
"example": {
"images": [
{
"url": "https://cdn.example.com/tasks/0.png",
"mime": "image/png"
}
]
},
"required": [
"images"
],
"properties": {
"images": {
"type": "array",
"items": {
"type": "object",
"properties": {
"b64": {
"type": "string"
},
"url": {
"type": "string",
"format": "uri"
},
"mime": {
"type": "string"
}
}
}
}
},
"description": "Succeeded task output: normalized images."
}
Example
curl -X POST "https://api.apisale.ai/v1/run/xai/grok-imagine-image/quality/text-to-image" \
-H "Authorization: Key YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"input": {
"prompt": "Cinematic aerial drone shot gliding over a neon-lit megacity at dusk, volumetric god rays cutting through low clouds, ultra-sharp anamorphic bokeh, IMAX film still, 16:9",
"sync_mode": false,
"num_images": 1,
"resolution": "1k",
"aspect_ratio": "16:9",
"output_format": "jpeg"
}
}'
Related
Authorizations
Key sk-... (native REST) or Bearer sk-... (vendor SDKs)
Body
application/json
Show child attributes
Show child attributes
Example:
{
"prompt": "Cinematic aerial drone shot gliding over a neon-lit megacity at dusk, volumetric god rays cutting through low clouds, ultra-sharp anamorphic bokeh, IMAX film still, 16:9",
"num_images": 1,
"resolution": "1k",
"aspect_ratio": "16:9",
"output_format": "jpeg"
}
Response
201 - application/json
Run accepted
Unique run identifier
Model slug
Available options:
queued, processing, succeeded, failed, timeout, cancelled Show child attributes
Show child attributes
Show child attributes
Show child attributes
