ApiframeApiframe Docs
Image GenerationGrok Imagine

Grok Imagine Image

xAI's SOTA image model with fast generation, strong creative control, and precise text rendering.

Use in Apiframe Studio

POST /v2/images/generatemodel: "grok-imagine-image"

Grok Imagine Image generates images from text prompts with support for image editing. The model produces high-quality results across many visual styles (photorealistic, anime, oil painting, abstract) and is particularly strong at rendering readable text within images.

Omit the image parameter for text-to-image generation, or provide it to edit an existing image.

See Image Generation overview for common request fields, response format, and error codes.

Model-specific parameters

ParameterTypeDescription
grokImagineParams.imagestringInput image URL for editing (optional — omit for text-to-image)
grokImagineParams.aspect_ratiostringAspect ratio (ignored when editing). Values: "1:1" (default), "2:3", "3:2", "16:9", "9:16"

Credit cost

3 credits per generation.

Code examples

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 cinematic portrait with warm earthy tones and gentle film grain texture",
    "model": "grok-imagine-image",
    "grokImagineParams": {
      "aspect_ratio": "3:2"
    }
  }'
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 cinematic portrait with warm earthy tones and gentle film grain texture",
        "model": "grok-imagine-image",
        "grokImagineParams": {
            "aspect_ratio": "3:2",
        },
    },
)
print(response.json())
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 cinematic portrait with warm earthy tones and gentle film grain texture",
    model: "grok-imagine-image",
    grokImagineParams: { aspect_ratio: "3:2" },
  }),
});
console.log(await response.json());

Try it

POST/v2/images/generateTry it

On this page