# xAI

xAI serves 4 text models on LLM API, all from xAI.

Model ID prefix: `xai/` · 4 models · [xAI privacy policy](https://x.ai/legal/privacy-policy)
Updated: 2026-10-13
Canonical: https://llmapi.ai/providers/xai/

## Models and prices

Prices when xAI serves the request.

### Text (4)

Prices per 1M tokens.

| Model | Model ID | Input | Output | Cache read | Context |
| --- | --- | --- | --- | --- | --- |
| [Grok 4.7](https://llmapi.ai/models/xai-grok-4-7/) | `xai/grok-4.7` | $6 | $18 | $1.5 | 500K |
| [Grok 4.6](https://llmapi.ai/models/x-ai-grok-4-6/) | `xai/grok-4.6` | $2 | $6 | $0.5 | 500K |
| [Grok 4.5](https://llmapi.ai/models/x-ai-grok-4-5/) | `xai/grok-4.5` | $2 | $6 | $0.3 | 500K |
| [Grok 4.3](https://llmapi.ai/models/x-ai-grok-4-3/) | `xai/grok-4.3` | $1.25 | $2.5 | $0.2 | 1M |

**Volume pricing.** At higher monthly volume, models on xAI may cost less. Book a call and sales will quote a price for your usage. [Book a call with sales](https://meetings.hubspot.com/julia-andriienko/llmapi) or [Create an account first](https://app.llmapi.ai/signup).

## Send requests to xAI

Put `xai/` before a model ID and the request goes to xAI. If xAI’s uptime over the last 5 minutes is below 90%, it goes to another provider of the model, unless it sends `X-No-Fallback: true`. [Routing docs](https://docs.llmapi.ai/features/routing)

Example: Grok 4.7, Chat Completions (`POST /v1/chat/completions`). Set LLMAPI_KEY to your LLM API key.

```python
import os

from openai import OpenAI

client = OpenAI(
    base_url="https://api.llmapi.ai/v1",
    api_key=os.environ["LLMAPI_KEY"],
)

response = client.chat.completions.create(
    model="xai/grok-4.7",
    messages=[{"role": "user", "content": "Hello"}],
)
print(response.choices[0].message.content)
```

Prices synced 2026-11-13.

Next step: [Get API key](https://app.llmapi.ai/signup)
