Grok Imagine icon
Image by xAI

Grok Image Generator API

Generate AI images with xAI's Grok image model through one unified API. A single REST endpoint, async jobs, and webhooks, with no separate xAI account to manage.

Integrate Grok Imagine with a single API call — one key, one unified endpoint, and shared billing across every model on Apiframe.

model: "grok-imagine-image"
Grok Imagine candid lifestyle shot of friends laughing at an outdoor cafe in natural light with realistic skin

What's special about Grok Imagine

Built on xAI's Aurora engine

It runs on Aurora, an autoregressive mixture-of-experts model (now in its Aurora-2 generation) trained for photorealistic rendering and precise text-instruction following.

A natural, less synthetic look

It leans into realistic, "imperfect by design" imagery rather than the over-polished stock-photo feel, which reads as more authentic in brand and social content.

Strong text and instruction following

It renders readable text inside images and follows detailed prompts closely, which suits ads, posters, and labels.

A full editing workflow, not just generation

Beyond text-to-image, it edits existing images with natural language, combines multiple input images in one pass, applies style transfer, and refines across multiple turns.

A dedicated Quality Mode

A higher-fidelity mode aimed at business use, for photorealistic product renders, hero images, social assets, icons, and ad variations at scale.

Part of the wider Grok and Imagine pipeline

Image outputs flow into the broader Imagine toolset, and on Apiframe pricing is low and flat at 4 credits ($0.04) per image, for both generation and editing.

Made with Grok Imagine

A few outputs generated through the Grok Imagine API on Apiframe.

Grok Imagine photorealistic product render of a matte black water bottle on a concrete ledge in natural daylight

A photorealistic product render of a matte black water bottle on a concrete ledge, natural daylight.

Grok Imagine event ad with the headline 'LAUNCH NIGHT', the date and venue beneath, in a bold modern layout

An event ad with the headline 'LAUNCH NIGHT', the date and venue beneath, bold modern layout.

Grok Imagine branded hero image combining a logo and a product photo into a single composition for Apex Outdoor Gear

Combine this logo and this product photo into a single branded hero image.

Grok Imagine portrait restyled as a 1970s film photograph while keeping the subject’s face

Restyle this portrait as a 1970s film photograph, keeping the subject's face.

Grok Imagine candid lifestyle shot of friends laughing at an outdoor cafe in natural light with realistic skin

A candid lifestyle shot of friends laughing at an outdoor cafe, natural light, realistic skin.

Grok Imagine clean app icon of a paper plane on a blue gradient in a simple flat design

A clean app icon of a paper plane on a blue gradient, simple flat design.

Overview

Endpoint
POST /v2/images/generate
Model ID
grok-imagine-image
Params key
grokParams
Modality
Image
Provider
xAI
Avg. completion
~8s

Capabilities

Aspect ratios1:1, 2:3, 3:2, 16:9, 9:16
Image inputSupported
Avg. time~8s

Quick start

Send a single POST /v2/images/generate request with your API key to generate with Grok Imagine. The call returns a jobId you can poll or receive via webhook.

curl -X POST https://api.apiframe.ai/v2/images/generate \
  -H "X-API-Key: afk_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
        "prompt": "a sleek silver sports car on a coastal highway at sunset, hyper-realistic",
        "model": "grok-imagine-image",
        "grokParams": {
            "image": "https://example.com/input.jpg"
        }
    }'
import requests

response = requests.post(
    "https://api.apiframe.ai/v2/images/generate",
    headers={
        "X-API-Key": "afk_your_api_key_here",
        "Content-Type": "application/json",
    },
    json={
        "prompt": "a sleek silver sports car on a coastal highway at sunset, hyper-realistic",
        "model": "grok-imagine-image",
        "grokParams": {
            "image": "https://example.com/input.jpg"
        }
    },
)
print(response.json())  # { "jobId": "...", "status": "QUEUED" }
const response = await fetch("https://api.apiframe.ai/v2/images/generate", {
  method: "POST",
  headers: {
    "X-API-Key": "afk_your_api_key_here",
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "prompt": "a sleek silver sports car on a coastal highway at sunset, hyper-realistic",
    "model": "grok-imagine-image",
    "grokParams": {
      "image": "https://example.com/input.jpg"
    }
  }),
});
const { jobId } = await response.json();
console.log(jobId);

Response & job lifecycle

Generation is asynchronous. A successful submission returns 202 Accepted with a jobId. Poll GET /v2/jobs/{id} (or supply a webhook_url) until the status is COMPLETED; the result field then holds the output URL(s).

1. Submission response (202)

{
  "jobId": "b2c3d4e5-f6a7-8901-bcde-f23456789012",
  "status": "QUEUED"
}

2. Poll for the result

curl https://api.apiframe.ai/v2/jobs/JOB_ID \
  -H "X-API-Key: afk_your_api_key_here"
import requests, time

while True:
    job = requests.get(
        "https://api.apiframe.ai/v2/jobs/JOB_ID",
        headers={"X-API-Key": "afk_your_api_key_here"},
    ).json()
    if job["status"] in ("COMPLETED", "FAILED"):
        break
    time.sleep(2)
print(job["result"])
let job;
do {
  await new Promise((r) => setTimeout(r, 2000));
  job = await fetch("https://api.apiframe.ai/v2/jobs/JOB_ID", {
    headers: { "X-API-Key": "afk_your_api_key_here" },
  }).then((r) => r.json());
} while (job.status !== "COMPLETED" && job.status !== "FAILED");
console.log(job.result);

Input schema

Request parameters accepted by the Grok Imagine endpoint. Model-specific options are nested under the params object shown below.

Parameter Type Required Default Allowed / range Description
prompt string required Text description of what to generate.
model string required "grok-imagine-image" "grok-imagine-image" The model identifier for this endpoint.
grokParams.image string (URL) optional Reference image (URL)

Frequently Asked Questions

Common questions about the Grok Imagine API.

Can Grok generate images?

Yes. Grok Imagine creates images from text prompts and also edits existing ones with natural language.

What engine powers it?

xAI's Aurora model, an autoregressive mixture-of-experts system now in its Aurora-2 generation.

Can it edit images, not just generate them?

Yes. It supports natural-language edits, combining multiple reference images, style transfer, and multi-turn refinement.

What is Quality Mode?

A higher-fidelity setting built for production work like product renders, hero images, and ad variations.

How much does it cost?

On Apiframe, a flat 4 credits ($0.04) per image, whether you generate or edit.

Where can you access it?

Through Apiframe, as well as the Grok app and the xAI API.

Still have questions?

Start building with the Grok Imagine API

Get your API key and integrate Grok Imagine in minutes — Pay-as-you-go.

Free credits to start
One API for every model
Webhooks, SDKs & idempotency
No provider account required

Questions? Join our Discord or contact sales.