Overview
xAI provides Grok models with support for both OpenAI and Anthropic API formats, offering flexibility for different use cases. Key Features:- Dual API format support
- Grok model family
- Real-time information capabilities
- Flexible authentication
Authentication
xAI supports dual authentication:- Bearer token for OpenAI-compatible endpoints
- x-api-key for Anthropic-compatible endpoints
${TOKEN}.${YOUR_XAI_KEY}
Popular Models
| Model | Context | Description |
|---|---|---|
| grok-beta | 128K | Latest Grok model |
| grok-vision-beta | 128K | Multi-modal vision support |
OpenAI-Compatible Endpoint
Anthropic-Compatible Endpoint
Available Endpoints
| Endpoint | Format | Auth Header |
|---|---|---|
/v1/chat/completions | OpenAI | Authorization: Bearer |
/v1/messages | Anthropic | x-api-key |
- OpenAI endpoint:
data.usage(OpenAI format) - Anthropic endpoint:
data.usage(Anthropic format with input_tokens/output_tokens)