YepAPI
AI Models

Grok Imagine Image

xAI's Grok Imagine image model in quality mode. AI image generation and editing with 14 aspect ratios.

POST/v1/media/queue
from $0.15/image

Overview

xAI's Grok Imagine image model (quality mode) — image generation and editing across 14 aspect ratios. Async operation — submit a job, poll for completion.

PropertyValue
Model IDx-ai/grok-imagine-image-quality
ProviderxAI
Aspect Ratios1:1, 3:4, 4:3, 9:16, 16:9, 2:3, 3:2, 9:19.5, 19.5:9, 9:20, 20:9, 1:2, 2:1, auto
Reference ImagesSupported
BillingDynamic (actual cost per job)
Typical Cost~$0.15 per image

Usage

All media models use the async job queue. Submit a job, then poll for the result.

Step 1: Submit Job

Text-to-Image

const res = await fetch('https://api.yepapi.com/v1/media/queue', {
  method: 'POST',
  headers: {
    'x-api-key': 'YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    model: 'x-ai/grok-imagine-image-quality',
    prompt: 'A futuristic city skyline at sunset with flying vehicles',
    options: { aspectRatio: '1:1' },
  }),
});
const { data } = await res.json();
// data.jobId — use this to poll for results
curl -X POST https://api.yepapi.com/v1/media/queue \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "x-ai/grok-imagine-image-quality", "prompt": "A futuristic city skyline at sunset with flying vehicles", "options": {"aspectRatio": "1:1"}}'

Image-to-Image (Edit / Transform)

Pass a reference image via imageData alongside your prompt to edit or transform an existing image.

const res = await fetch('https://api.yepapi.com/v1/media/queue', {
  method: 'POST',
  headers: {
    'x-api-key': 'YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    model: 'x-ai/grok-imagine-image-quality',
    prompt: 'Make the sky purple and add northern lights',
    options: { aspectRatio: '1:1' },
    imageData: {
      mimeType: 'image/png',
      base64: '...', // Base64-encoded image
    },
  }),
});

Step 2: Poll for Result

const status = await fetch(`https://api.yepapi.com/v1/media/status/${data.jobId}`, {
  headers: { 'x-api-key': 'YOUR_API_KEY' },
});
const { data: job } = await status.json();
// job.status — "pending" | "processing" | "completed" | "failed"
// job.result.image — { mimeType, base64 } when completed
curl https://api.yepapi.com/v1/media/status/JOB_ID \
  -H "x-api-key: YOUR_API_KEY"

Request Body

ParameterTypeRequiredDescriptionDefault
modelstringYesx-ai/grok-imagine-image-quality or alias grok-image
promptstringYesText description of the image to generate or edit
options.aspectRatiostringNoOne of: 1:1, 3:4, 4:3, 9:16, 16:9, 2:3, 3:2, 9:19.5, 19.5:9, 9:20, 20:9, 1:2, 2:1, auto1:1
imageData.mimeTypestringNoMIME type of input image (image/png, image/jpeg, image/webp)
imageData.base64stringNoBase64-encoded input image for image-to-image editing

Pricing

Billing is dynamic — each job is billed from the actual cost of that generation.

MetricCost
Typical cost per image~$0.15
Info

Image jobs typically complete in 5–60 seconds. Results retained for 1 hour.

Under the Hood

Powered by xAI's Grok Imagine Image via our AI provider. 100% margin on upstream costs.

On this page