> ## Documentation Index
> Fetch the complete documentation index at: https://lava.so/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# xAI

> xAI builds the Grok model family with real-time knowledge access (trained on X/Twitter data) and strong reasoning capabilities.

xAI offers 64 models through Lava's AI Gateway, supporting Chat Completions, Chat Completions (Native). Authentication uses `Authorization: Bearer`. See the [xAI API docs](https://docs.x.ai/api) for provider-specific parameters.

<Info>Supports both **managed** (Lava's API keys) and **unmanaged** (bring your own credentials) mode.</Info>

## Quick Start

```typescript theme={null}
const response = await fetch('https://api.lava.so/v1/forward?u=https%3A%2F%2Fapi.x.ai%2Fv1%2Fchat%2Fcompletions', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    Authorization: `Bearer ${forwardToken}`,
  },
  body: JSON.stringify({
    model: 'grok-4.3',
    messages: [{ role: "user", content: "Hello!" }],
  }),
});
```

## Chat Completions

**Target URL:** `https://api.x.ai/v1/chat/completions`

|                  |                                          |
| ---------------- | ---------------------------------------- |
| **Content Type** | `application/json`                       |
| **Streaming**    | Yes (set `stream: true` in request body) |

| Model                              | Input / 1M tokens | Output / 1M tokens |
| ---------------------------------- | ----------------- | ------------------ |
| grok-3-fast-beta                   | \$5.00            | \$25.00            |
| grok-3-fast                        | \$5.00            | \$25.00            |
| grok-3-fast-latest                 | \$5.00            | \$25.00            |
| grok-4-0709                        | \$3.00            | \$15.00            |
| grok-4-latest                      | \$3.00            | \$15.00            |
| grok-4                             | \$3.00            | \$15.00            |
| grok-3-beta                        | \$3.00            | \$15.00            |
| grok-3                             | \$3.00            | \$15.00            |
| grok-3-latest                      | \$3.00            | \$15.00            |
| grok-4.20-0309-reasoning           | \$2.00            | \$6.00             |
| grok-4.20-0309-non-reasoning       | \$2.00            | \$6.00             |
| grok-4.20-multi-agent-0309         | \$2.00            | \$6.00             |
| grok-4.3                           | \$1.25            | \$2.50             |
| grok-4.3-latest                    | \$1.25            | \$2.50             |
| grok-latest                        | \$1.25            | \$2.50             |
| grok-3-mini-fast-beta              | \$0.60            | \$4.00             |
| grok-3-mini-fast                   | \$0.60            | \$4.00             |
| grok-3-mini-fast-latest            | \$0.60            | \$4.00             |
| grok-3-mini-beta                   | \$0.30            | \$0.50             |
| grok-3-mini                        | \$0.30            | \$0.50             |
| grok-3-mini-latest                 | \$0.30            | \$0.50             |
| grok-4-1-fast-reasoning            | \$0.20            | \$0.50             |
| grok-4-1-fast-reasoning-latest     | \$0.20            | \$0.50             |
| grok-4-1-fast-non-reasoning        | \$0.20            | \$0.50             |
| grok-4-1-fast-non-reasoning-latest | \$0.20            | \$0.50             |
| grok-code-fast-1                   | \$0.20            | \$1.50             |
| grok-code-fast                     | \$0.20            | \$1.50             |
| grok-code-fast-1-0825              | \$0.20            | \$1.50             |
| grok-4-fast-non-reasoning          | \$0.20            | \$0.50             |
| grok-4-fast-non-reasoning-latest   | \$0.20            | \$0.50             |
| grok-4-fast-reasoning              | \$0.20            | \$0.50             |
| grok-4-fast-reasoning-latest       | \$0.20            | \$0.50             |

## Chat Completions (Native)

**Target URL:** `https://api.x.ai/v1/messages`

|                  |                                          |
| ---------------- | ---------------------------------------- |
| **Content Type** | `application/json`                       |
| **Streaming**    | Yes (set `stream: true` in request body) |

| Model                              | Input / 1M tokens | Output / 1M tokens |
| ---------------------------------- | ----------------- | ------------------ |
| grok-3-fast-beta                   | \$5.00            | \$25.00            |
| grok-3-fast                        | \$5.00            | \$25.00            |
| grok-3-fast-latest                 | \$5.00            | \$25.00            |
| grok-4-0709                        | \$3.00            | \$15.00            |
| grok-4-latest                      | \$3.00            | \$15.00            |
| grok-4                             | \$3.00            | \$15.00            |
| grok-3-beta                        | \$3.00            | \$15.00            |
| grok-3                             | \$3.00            | \$15.00            |
| grok-3-latest                      | \$3.00            | \$15.00            |
| grok-4.20-0309-reasoning           | \$2.00            | \$6.00             |
| grok-4.20-0309-non-reasoning       | \$2.00            | \$6.00             |
| grok-4.20-multi-agent-0309         | \$2.00            | \$6.00             |
| grok-4.3                           | \$1.25            | \$2.50             |
| grok-4.3-latest                    | \$1.25            | \$2.50             |
| grok-latest                        | \$1.25            | \$2.50             |
| grok-3-mini-fast-beta              | \$0.60            | \$4.00             |
| grok-3-mini-fast                   | \$0.60            | \$4.00             |
| grok-3-mini-fast-latest            | \$0.60            | \$4.00             |
| grok-3-mini-beta                   | \$0.30            | \$0.50             |
| grok-3-mini                        | \$0.30            | \$0.50             |
| grok-3-mini-latest                 | \$0.30            | \$0.50             |
| grok-4-1-fast-reasoning            | \$0.20            | \$0.50             |
| grok-4-1-fast-reasoning-latest     | \$0.20            | \$0.50             |
| grok-4-1-fast-non-reasoning        | \$0.20            | \$0.50             |
| grok-4-1-fast-non-reasoning-latest | \$0.20            | \$0.50             |
| grok-code-fast-1                   | \$0.20            | \$1.50             |
| grok-code-fast                     | \$0.20            | \$1.50             |
| grok-code-fast-1-0825              | \$0.20            | \$1.50             |
| grok-4-fast-non-reasoning          | \$0.20            | \$0.50             |
| grok-4-fast-non-reasoning-latest   | \$0.20            | \$0.50             |
| grok-4-fast-reasoning              | \$0.20            | \$0.50             |
| grok-4-fast-reasoning-latest       | \$0.20            | \$0.50             |

## Next Steps

<CardGroup cols={2}>
  <Card title="All Providers" icon="grid" href="/gateway/supported-providers">
    Browse all supported AI providers
  </Card>

  <Card title="Forward Proxy" icon="route" href="/gateway/forward-proxy">
    Learn how to construct proxy URLs and authenticate requests
  </Card>
</CardGroup>
