> Documentation index for agents: https://docs.rocketride.ai/llms.txt

# llm_xai

A RocketRide LLM node that connects xAI Grok models to a pipeline.

## What it does

Provides xAI's Grok models as an `llm` invoke connection for agents and other nodes that need a language model. The node can also be used directly via lanes: send text on the `questions` lane and receive a generated completion on the `answers` lane.

Uses **langchain-xai** (`ChatXAI`) under the hood. The chat client is always initialized with `temperature=0`, and `max_tokens` is set from the selected profile's output-token limit.

When the node config is saved, a minimal validation probe (a single-word prompt) is sent to the xAI API to verify the API key and model. Provider and HTTP errors are parsed into a readable `Error <code>: <message>` warning instead of failing silently.

## Lanes

| Lane in     | Lane out  | Description                                          |
| ----------- | --------- | ---------------------------------------------------- |
| `questions` | `answers` | Send a question directly, receive a generated answer |

## Profiles

Default: **Grok 3** (`grok-3`).

| Profile | Model | Context | Output |
| ------- | ----- | ------- | ------ |
| `grok-3` **(default)** | `grok-3` | 131,072 | 131,072 |
| `grok-4-5` | `grok-4.5` | 500,000 | 450,000 |
| `grok-4-20` | `grok-4.20` | 2,000,000 | 1,800,000 |
| `grok-4-20-multi-agent` | `grok-4.20-multi-agent` | 2,000,000 | 1,800,000 |

<details>
<summary><strong>View 17 more models</strong></summary>

| Profile | Model | Context | Output |
| ------- | ----- | ------- | ------ |
| `custom` | _(user-specified)_ | 131,072 | editable |
| `grok-4-1-fast-reasoning` | `grok-4-1-fast-reasoning` | 2,000,000 | 4,096 |
| `grok-4-1-fast-non-reasoning` | `grok-4-1-fast-non-reasoning` | 2,000,000 | 4,096 |
| `grok-code-fast-1` | `grok-code-fast-1` | 256,000 | 10,000 |
| `grok-4-fast-reasoning` | `grok-4-fast-reasoning` | 2,000,000 | 4,096 |
| `grok-4-fast-non-reasoning` | `grok-4-fast-non-reasoning` | 2,000,000 | 4,096 |
| `grok-4` | `grok-4-0709` | 256,000 | 256,000 |
| `grok-3-mini` | `grok-3-mini` | 131,072 | 131,072 |
| `grok-3-beta` **(deprecated)** | `grok-3-beta` | 131,072 | 131,072 |
| `grok-3-mini-beta` **(deprecated)** | `grok-3-mini-beta` | 131,072 | 131,072 |
| `grok-4-1-fast` **(deprecated)** | `grok-4.1-fast` | 2,000,000 | 30,000 |
| `grok-4-fast` **(deprecated)** | `grok-4-fast` | 2,000,000 | 30,000 |
| `grok-4-3` | `grok-4.3` | 1,000,000 | 900,000 |
| `grok-build-0-1` | `grok-build-0.1` | 256,000 | 230,400 |
| `grok-latest` | `grok-latest` | 500,000 | 450,000 |
| `grok-4-3-batch` | `grok-4.3:batch` | 1,000,000 | 900,000 |
| `grok-4-6` | `grok-4.6` | 500,000 | 450,000 |

</details>

The `grok-3-beta`, `grok-3-mini-beta`, `grok-4-fast`, `grok-4-1-fast`,
`grok-4-20`, and `grok-4-20-multi-agent` profiles use OpenRouter-style model
IDs and expose the API key field for that source.

## Configuration

Choose a profile to set the model, context limit, and output limit. Built-in profiles keep those values fixed, while `custom` exposes the model ID, context limit and output limit for another xAI model.

### Custom models

For `custom`, enter an xAI model ID and a positive context limit. The initial context value is 131,072 tokens, and the output limit, left empty, is the default model's; set it to your model's limit, keeping in mind that reasoning models count their thinking against it.

## Authentication

For xAI-hosted profiles, provide an xAI API key in the `apikey` field. The key is validated at pipeline start: it must begin with the `xai-` prefix, otherwise the node raises `Invalid XAI API key format, please check your API key.` OpenRouter-sourced profiles use the key field exposed for that source instead.

The key is also checked at save time with a minimal probe request, so invalid keys, unknown models, or network problems surface as warnings in the UI before the pipeline runs.

---

## Upstream docs

- [xAI API documentation](https://docs.x.ai/docs/overview)

---

<!-- ROCKETRIDE:GENERATED:PARAMS START -->
<!-- Generated by nodes:docs-generate. Do not edit by hand. -->

## Schema

| Field | Type | Description | Default |
|---|---|---|---|
| `model` | `string` | **Model**<br/>xAI model |  |
| `modelOutputTokens` | `integer` | **Output Tokens**<br/>Most tokens the model may write in one reply (at least 1,024). Leave it empty to keep the node's default. Reasoning models count their thinking against this limit: set it well above the reply you expect, or they can spend it all thinking and return nothing. It cannot exceed Tokens; a larger value is lowered to it. |  |
| `modelTotalTokens` | `number` | **Tokens**<br/>Total Tokens |  |
| `xai.profile` | `string` | **Model**<br/>LLM model | `"grok-3"` |

## Dependencies

- `langchain-xai`
- `langchain-core`
- `langchain`

## Source

[<svg viewBox="0 0 16 16" width="15" height="15" fill="currentColor" aria-hidden="true" style="vertical-align:-0.15em;margin-right:0.35em"><path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.013 8.013 0 0016 8c0-4.42-3.58-8-8-8z"/></svg> View source](https://github.com/rocketride-org/rocketride-server/tree/develop/nodes/src/nodes/llm_xai)
<!-- ROCKETRIDE:GENERATED:PARAMS END -->
