xAI Grok Models
Access Grok 4.5 and Grok 4.6 through AI Gateway — xAI's models via one OpenAI-compatible API with per-token credit billing.
xAI's Grok 4 family offers large-context general-purpose models. Through AI Gateway you can call them with the same OpenAI-compatible format used for every other provider.
Available Models
| Model | Context | Best For |
|---|---|---|
grok-4.6 | 500K | Newest generation |
grok-4.5 | 500K | Stable general-purpose use |
Live per-model credit pricing is on the Models page.
Quick Start
Python (OpenAI SDK)
from openai import OpenAI
client = OpenAI(
api_key="YOUR_API_KEY",
base_url="https://your-domain.com/api/ai/v1"
)
response = client.chat.completions.create(
model="grok-4.6",
messages=[{"role": "user", "content": "Brainstorm launch ideas."}]
)
print(response.choices[0].message.content)
Replace
your-domain.comwith your AI Gateway site domain. Get your API key from the dashboard after sign-up.
Why through AI Gateway
- Grok without an xAI account — one Gateway key for all providers
- OpenAI-compatible requests
- Credit billing — pay per token
Related Pages
| Model | Context | Type |
|---|---|---|
grok-4.5 | 500K | chat |
grok-4.6 | 500K | chat |
| Model | Context | Type |
|---|---|---|
grok-4.5 | 500K | chat |
grok-4.6 | 500K | chat |
| Model | Context | Type |
|---|---|---|
grok-4.5 | 500K | chat |
grok-4.6 | 500K | chat |
| Model | Context | Type |
|---|---|---|
grok-4.5 | 500K | chat |
grok-4.6 | 500K | chat |
| Model | Context | Type |
|---|---|---|
grok-4.5 | 500K | chat |
grok-4.6 | 500K | chat |
Why through AI Gateway
- One unified interface: call every provider through a single OpenAI-compatible base URL
- One key: no per-vendor accounts; credits are shared and never expire
- Per-token billing: cache hits billed at steep discounts
- Flexible switching: change one string to move between models or vendors
About this data
Specs and prices come from the platform live catalog; performance figures from vendor or third-party publications. Updated 2026-10-13.
| Model | Context | Type |
|---|---|---|
grok-4.5 | 500K | chat |
grok-4.6 | 500K | chat |
Why through AI Gateway
- One unified interface: call every provider through a single OpenAI-compatible base URL
- One key: no per-vendor accounts; credits are shared and never expire
- Per-token billing: cache hits billed at steep discounts
- Flexible switching: change one string to move between models or vendors
Capabilities
2 shipping models, context windows from 500K to 500K tokens; tiers: previous generation ×1, balanced ×1.
Pricing & billing
Per-token credit billing; cache hits at steep discounts. Live rates on the Models pricing page — numbers intentionally not fixed here.
FAQ
How large is the context window of xAI Grok?
500,000 Token (500K)
How is it billed?
Per-token credit billing with cache-hit discounts. Live rates on the Models page.
Do I need a provider account?
No. One AI Gateway API key covers this model and every other model on the site.
About this data
Specs and prices come from the platform live catalog; performance figures from vendor or third-party publications. Updated 2026-10-13.
Ready to build with Xai?
One API Key, every model. Transparent pay-as-you-go pricing with credits that never expire.
Create free account