Image xAI

Grok Imagine API

Use the Grok Imagine API via RunAPI with a model skill, unified auth, and pay-as-you-go pricing.

runapi.ai
curl -X POST https://runapi.ai/api/v1/grok_imagine/edit_image \
  -H "Authorization: Bearer $RUNAPI_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "grok-imagine-edit-image",
  "image_url": "https://cdn.runapi.ai/public/samples/image.jpg",
  "prompt": "Generate a short video of a robot hand placing a chess piece on a board, dramatic lighting, slow motion."
}'
import { GrokImagineClient } from "@runapi.ai/grok-imagine";

const client = new GrokImagineClient();
const result = await client.editImage.run({
    model: "grok-imagine-edit-image",
    image_url: "https://cdn.runapi.ai/public/samples/image.jpg",
    prompt: "Generate a short video of a robot hand placing a chess piece on a board, dramatic lighting, slow motion.",
});
<?php

require __DIR__ . "/vendor/autoload.php";

use RunApi\GrokImagine\GrokImagineClient;

$client = new GrokImagineClient();
$result = $client->editImage->run([
        'model' => 'grok-imagine-edit-image',
        'image_url' => 'https://cdn.runapi.ai/public/samples/image.jpg',
        'prompt' => 'Generate a short video of a robot hand placing a chess piece on a board, dramatic lighting, slow motion.',
]);
require "runapi/grok_imagine"

client = RunApi::GrokImagine::Client.new
result = client.edit_image.run(
    model: "grok-imagine-edit-image",
    image_url: "https://cdn.runapi.ai/public/samples/image.jpg",
    prompt: "Generate a short video of a robot hand placing a chess piece on a board, dramatic lighting, slow motion."
)
npx skills add runapi-ai/grok-imagine -g
# Claude Code
claude mcp add runapi -s user -- npx -y @runapi.ai/mcp

# Codex
codex plugin install runapi-mcp@agents

# Cursor / Windsurf / VS Code
npx @runapi.ai/mcp init cursor
@runapi.ai/grok-imagine v1
OVERVIEW

About Grok Imagine

Grok Imagine is xAI's image and video generation suite covering text-to-image, image-to-image, text-to-video, and image-to-video. It integrates with xAI's Grok intelligence to interpret complex, nuanced prompts.

Provider
xAI
Modality
Image

Available Versions

Variant Billing Pricing
grok-imagine-edit-image call $0.040 View →
grok-imagine-image-2-0 call $0.0000 View →
grok-imagine-text-to-image call $0.040 View →
PRICING

Grok Imagine Pricing

Endpoint Resolution Duration Price
edit_image $0.04 / image

Prices shown for grok-imagine-edit-image. Other variants retain their own endpoint pricing.

PRICING

Utility endpoints

Shared endpoints for this model line, such as extension, enhancement, or conversion actions.

Upscale image
$0.10 / request
Agent integration

Run Grok Imagine From an Agent

HOW IT WORKS

Get Started with Grok Imagine

  1. Create an API key

    Sign up and generate an API key from the dashboard.

  2. Pick a version

    Choose the version that best matches your quality and cost requirements.

  3. Send a request

    Submit your prompt and parameters to the model's documented endpoint.

  4. Get your result

    Poll the task or set a webhook, then download the completed output.

CONTEXT

About Grok Imagine on RunAPI

Grok Imagine is xAI's creative AI suite built on Grok, covering image and video generation. Through RunAPI, all Grok Imagine endpoints share a single API key.

Provider
xAI
See all →
Modality
Image
Browse models →

Why Use Grok Imagine Through RunAPI

One auth, every provider

A single RunAPI API key unlocks the whole model catalog across all providers. No separate accounts to create, no API keys to rotate per integration, and no credential management overhead. Add a new model to your app by changing one parameter.

Unified pricing & billing

Per-call pricing in USD, billed monthly into a single invoice. No subscription tiers, no minimum spend, and failed generations are never charged. The pricing page and check_pricing API show exact costs before you commit to a model.

Schema-first SDK

Typed schemas, parameter constraints, and setup notes are packaged in the model skill so your implementation starts from the right contract. The skill loads into Claude Code, Codex, Gemini CLI, Cursor, and VS Code — your agent knows the correct request shape before you write a line of code.

Grok Imagine Questions

What creative modes does Grok Imagine support?

Text-to-image, image-to-image, text-to-video, and image-to-video — covering still images, prompt-guided image edits, and motion generation.

Does Grok Imagine generate audio with video?

Yes — text-to-video generates synchronized native audio including dialogue with lip-sync.

How many reference images can I provide?

The edit_image endpoint handles image-to-image tasks — it accepts one source image for prompt-guided style transfer and composition editing.

What image styles are available?

Realistic, artistic, and anime styles across 5 aspect ratios. Style is controlled via the prompt and style parameter.

How long are generated videos?

6 to 15 seconds per generation (up to 30 seconds on the fast variant) for both text-to-video and image-to-video endpoints.

Which variant should I start with?

Pick the cheapest variant that meets your quality bar. Most teams start on the fast variant and graduate to pro for production.

SIMILAR MODELS

Similar Image Models

Start generating with Grok Imagine