Search all guides

Reference · Tools

Grok Image Generation

Generate images from text prompts using xAI Grok Image Generation, returning either binary data or a URL for the generated image.

Action (binary) AI v1 Binary data

Grok Image Generation turns a text prompt into imagery using xAI's Grok Imagine models, producing up to four images per request as either decoded binary in the binary store or direct URLs. Use it when you want visuals generated inside a workflow — illustrating each post in a content pipeline without a manual design step.

Works as
Action (binary)
Tool name
grok_image_gen
Parameters
5
Outputs
Output, Error
Credentials
xAI
Official docs
xAI docs docs.x.ai

What you can build with Grok Image Generation

  • Generate an image from a text prompt using Grok Aurora.
  • Create multiple images from a single prompt.
  • Generate an image and get back a URL instead of binary data.
  • Create AI-generated artwork from a description.

Each of these runs as a step in a BusyBot workflow or inside an agent, so the result can be routed, filtered and sent on with the core nodes and any of the communication integrations.

Overview

Grok Image Generation creates images from text prompts using xAI’s Grok Imagine image models. When Response Format is “Binary Data”, the generated image is decoded and attached to the output item as binary data. When it is “Image URL”, the tool returns a temporary image URL in the JSON output instead. Generates 1-4 images per request.

Node Type

Action (Binary) — handles file/binary data operations

Input / Output

DirectionPort(s)
InputInput
OutputOutput, Error

Credentials

This tool requires xAI credentials. See the Credentials Guide for setup instructions.

Parameters

ParameterTypeRequiredDefaultDescription
ModeloptionsNoPlatform defaultThe xAI Grok Imagine image model to use for generation.
Options: the Grok Imagine image models currently available — the dropdown tracks the model catalog, so it changes as xAI’s line-up changes.
PromptstringYes—A text description of the desired image. Falls back to the input item’s “prompt” field when left empty. Supports expressions like {{ $json.description }}.
OptionscollectionNo{}Optional generation and output settings — add only the fields you want to override.
— Number of ImagesnumberNo1Number of images to generate (1-4).
— Response FormatoptionsNobinaryDataHow to return the generated image(s). Binary Data decodes and stores the image as binary. Image URL returns a temporary URL.
Options: binaryData, imageUrl
— Output Binary PropertystringNodataName of the binary property to write the output image(s) to. Names are case-sensitive — see the upstream node’s Binary Data panel for the exact names to use.
Include InputbooleanNofalseWhether to include the original input item fields in the output alongside the generated image.
Max ConcurrencynumberNo5Maximum number of items to process concurrently. Keep low to respect xAI rate limits.

Output Data

One output item per generated image — an input item asking for four images produces four output items, not one. The rest of the input JSON is carried over only when Include Input is on.

  • imageIndex — the position of this image within the request, starting at 0.
  • imageUrl — a temporary URL for the image. Present only in imageUrl mode.

In binaryData mode the image itself is attached to the output item as binary data under the name given by Output Binary Property (data by default), merged alongside any binary the input item already carried. In imageUrl mode no new binary is produced and the input item’s binary is forwarded unchanged.

Reference the result downstream by expression, e.g. {{ $json.imageUrl }}, or connect the output straight to a node that consumes binary data.

Example Configuration

Generate one image and pass it downstream as binary:

{
  "type": "grok_image_gen",
  "parameters": {
    "prompt": "A serene mountain landscape at sunrise, photorealistic"
  }
}

Generate four variations under a named binary property:

{
  "type": "grok_image_gen",
  "parameters": {
    "prompt": "{{ $json.description }}",
    "includeInput": true,
    "maxConcurrency": 2,
    "options": {
      "n": 4,
      "responseFormat": "binaryData",
      "binaryPropertyName": "artwork"
    }
  }
}

Return a temporary URL instead of binary data:

{
  "type": "grok_image_gen",
  "parameters": {
    "prompt": "A cozy coffee shop interior with warm lighting",
    "maxConcurrency": 1,
    "options": {
      "n": 1,
      "responseFormat": "imageUrl"
    }
  }
}

Error Handling

ModeBehavior
stopHalts workflow on first error
continueSkips failed items, passes successful ones through
errorPortRoutes failed items to Error output port

Tips

grok_image_gen generates images from text prompts using an xAI Grok Imagine model through the OpenAI-compatible images/generations API; pick the model from the dropdown, which is generated from the central model catalog. Use it when a workflow needs AI-synthesized visuals from descriptive text and requires either a returnable URL or stored binary data for downstream processing. It outputs up to 4 images per request as either a decoded binary image written to the binary store or a direct image URL in the JSON response.

Frequently asked questions

How many images does one request produce?

Up to four. Generating a set and picking from it is usually more efficient than repeatedly re-running a single prompt.

Should I take binary or a URL?

Binary when the image will be processed, attached or stored by later nodes, since it is already in the binary store. A URL is lighter when you only need to reference the image somewhere.

How does this differ from Grok Image Edit?

This creates an image from text alone. Image Edit takes an existing image plus an instruction and modifies it — different starting points, different nodes.

Which credential does it need?

An xAI credential with access to the Grok image models.

Build with the Grok Image Generation node

Drop it into a workflow, wire it to an agent, or call it on a schedule. You'll need xAI credentials first.

Open BusyBot

Last reviewed . Spotted something wrong? Tell us.