---
title: xAI
---

<!-- THIS FILE IS AUTO-GENERATED BY website/scripts/generate-model-docs.js. DO NOT EDIT MANUALLY. -->

# xAI

Use `xai/<model>` with VoltAgent's model router.

## Quick start

```ts
import { Agent } from "@voltagent/core";

const agent = new Agent({
  name: "xai-agent",
  instructions: "You are a helpful assistant",
  model: "xai/grok-4",
});
```

## Environment variables

- `XAI_API_KEY`

## Provider package

`@ai-sdk/xai`

## Default base URL

Not listed.

You can override the base URL by setting `XAI_BASE_URL`.

## Provider docs

- https://docs.x.ai/docs/models

## Models

<details>
  <summary>Show models (22)</summary>

- grok-2
- grok-2-1212
- grok-2-latest
- grok-2-vision
- grok-2-vision-1212
- grok-2-vision-latest
- grok-3
- grok-3-fast
- grok-3-fast-latest
- grok-3-latest
- grok-3-mini
- grok-3-mini-fast
- grok-3-mini-fast-latest
- grok-3-mini-latest
- grok-4
- grok-4-1-fast
- grok-4-1-fast-non-reasoning
- grok-4-fast
- grok-4-fast-non-reasoning
- grok-beta
- grok-code-fast-1
- grok-vision-beta

</details>
