xAI Grok
xAI provides Grok models with real-time data access and an OpenAI-compatible API. Easy to set up if you're already familiar with OpenAI's API format.
Setup
# 1. Get your API key from https://console.x.ai/
export XAI_API_KEY=xai-...
# 2. Verify detection
arcana doctor
# 3. Run
arcana run "hello"
Available Models
| Model | Context | Best For |
|---|---|---|
grok-3 | 128K | General purpose, real-time data |
grok-3-mini | 128K | Fast, cost-effective |
Config File
{
"provider": "xai",
"model": "grok-3"
}
Environment Variables
| Variable | Description |
|---|---|
XAI_API_KEY | Your xAI API key (required) |
XAI_BASE_URL | Custom base URL (default: api.x.ai) |
OpenAI-Compatible API
xAI's API is OpenAI-compatible. You can also use it via OpenAI's client by setting the base URL:
export OPENAI_API_KEY=xai-...
export OPENAI_BASE_URL=https://api.x.ai/v1
export ARCANA_MODEL=grok-3
Tips
- Grok models have access to real-time X (Twitter) data
- The OpenAI-compatible API means most OpenAI tools and libraries work out of the box
grok-3-miniis a good budget option for everyday tasks