Skip to main content

xAI Grok Component

xAI Grok is an AI-powered component that provides advanced chat and image generation capabilities.

Component key: xai-grok ·
· Changelog ↓

Description

xAI Grok is an advanced AI model developed by xAI, offering powerful chat completions and image generation capabilities.

Use the component to generate AI-powered text responses and create images from text prompts.

API Documentation

This component was built using the xAI API.

Connections

xAI Grok

key: xaiGrokConnection

Navigate to xAI Grok API and generate an API key. Enter the key value into the connection configuration of the integration.

InputNotesExample
API Key

Your xAI Grok API key.

xai-XqaU...

Data Sources

Select Model

Select a model from the list of models | key: selectModel | type: picklist

InputNotesExample
Connection
Example Payload for Select Model
Loading…

Actions

Create Chat Completion

Create a chat completion using xAI Grok | key: createChatCompletion

InputNotesExample
Additional Fields

Additional fields that are not supported by the action inputs. See xAI API docs for possible values.

{
  "reasoning_effort": "low"
}
Connection
Messages

A list of messages that make up the the chat conversation. Different models support different message types, such as image and text.

[
  {
    "role": "system",
    "content": "You are a helpful assistant."
  },
  {
    "role": "user",
    "content": "Hello!"
  }
]
Model

Model name for the model to use. Obtainable here.

grok-2-latest
Stream

If set, partial message deltas will be sent.

false
Temperature

What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.

1
Top P

An alternative to sampling with Temperature, called nucleus sampling, where the model considers the results of the tokens with Top P probability mass. It is generally recommended to alter this or Temperature but not both.

1
Example Payload for Create Chat Completion
Loading…

Create Message

Create a message using the Anthropic-compatible messages API endpoint | key: createMessage

InputNotesExample
Additional Fields

Additional fields that are not supported by the action inputs. See xAI API docs for possible values.

{
  "stream": true
}
Connection
Max Tokens

The maximum number of tokens to generate before stopping. The model may stop before the max_tokens when it reaches the stop sequence.

100
Messages

Input messages. See xAI API docs for possible values.

[{"role":"user","content":"Hello, world"}]
Model

Model name for the model to use. Obtainable here.

grok-3-fast-latest
Example Payload for Create Message
Loading…

Generate Image

Generate an image using xAI's image generation API | key: generateImage

InputNotesExample
Additional Fields

Additional fields that are not supported by the action inputs. See xAI API docs for possible values.

{
  "user": "user-123"
}
Connection
Model

Model to be used.

grok-2-image
Number of Images

Number of images to generate.

1
Prompt

The text prompt to generate an image from.

A serene landscape with mountains and a lake at sunset
Example Payload for Generate Image
Loading…

Get Model

Get details about a specific model | key: getModel

InputNotesExample
Connection
Model ID

The ID of the model to retrieve.

grok-3-fast-beta
Example Payload for Get Model
Loading…

List Models

List all available models from xAI | key: listModels

InputNotesExample
Connection
Example Payload for List Models
Loading…

Raw Request

Send raw HTTP request to xAI | key: rawRequest

InputNotesExample
Connection
Data

The HTTP body payload to send to the URL.

{"exampleKey": "Example Data"}
File Data

File Data to be sent as a multipart form upload.

[{key: "example.txt", value: "My File Contents"}]
File Data File Names

File names to apply to the file data inputs. Keys must match the file data keys above.

Form Data

The Form Data to be sent as a multipart form upload.

[{"key": "Example Key", "value": new Buffer("Hello World")}]
Header

A list of headers to send with the request.

User-Agent: curl/7.64.1
Max Retry Count

The maximum number of retries to attempt. Specify 0 for no retries.

0
Method

The HTTP method to use.

Query Parameter

A list of query parameters to send with the request. This is the portion at the end of the URL similar to ?key1=value1&key2=value2.

Response Type

The type of data you expect in the response. You can request json, text, or binary data.

json
Retry On All Errors

If true, retries on all erroneous responses regardless of type. This is helpful when retrying after HTTP 429 or other 3xx or 4xx errors. Otherwise, only retries on HTTP 5xx and network errors.

false
Retry Delay (ms)

The delay in milliseconds between retries. This is used when 'Use Exponential Backoff' is disabled.

0
Timeout

The maximum time that a client will await a response to its request

2000
URL

Input the path only (/models), The base URL is already included (https://api.x.ai/v1). For example, to connect to https://api.x.ai/v1/models, only /models is entered in this field.

/models
Use Exponential Backoff

Specifies whether to use a pre-defined exponential backoff strategy for retries. When enabled, 'Retry Delay (ms)' is ignored.

false

Changelog

2026-04-30

Updated spectral version

2026-03-25

  • Updated documentation and various modernizations

2025-07-07

Initial release of xAI Grok component with AI chat completion, message creation, image generation, and model management capabilities