Quick setup
Open the kRouter dashboard at http://localhost:20128
Go to Providers → click the xAI (Grok) tile
Click Connect and complete the OAuth flow in your browser
Test the connection — kRouter auto-refreshes tokens from here on
Use in your IDE
Point any OpenAI-compatible client at kRouter using your local API key.
# Endpoint
http://localhost:20128/v1
# API key (from Dashboard → API Keys)
sk-krouter-XXXX
# Model
xai/grok-4How xAI (Grok) billing works with kRouter
xAI (Grok) connects with your existing subscription — kRouter signs in with OAuth and reuses the plan you already pay for, so there is no per-token bill. kRouter authenticates it via oauth or apikey. 6 models are routable as xai/<model>.
Through kRouter, xAI (Grok) serves chat and code completion, image understanding (OCR / vision-to-text), web search, exposed on /v1/search so an agent can look things up mid-conversation, image generation, exposed on /v1/images/generations, video generation, exposed on /v1/videos. Requests reach it through the same local OpenAI-compatible endpoint as every other provider, so switching to or from xAI (Grok) is a one-line model change in your client rather than a rewrite.
xAI (Grok) models & pricing
Prices are USD per 1M tokens, cheapest first. You are not billed per token on this provider — the figures show what the same model costs elsewhere, which is what routing here saves you.
| Model | Route as | Input /1M | Output /1M |
|---|---|---|---|
| Grok 4 | xai/grok-4 | $0.50 | $2.00 |
| Grok 4 Fast Reasoning | xai/grok-4-fast-reasoning | $0.50 | $2.00 |
| Grok Code Fast | xai/grok-code-fast-1 | $0.50 | $2.00 |
| Grok 3 | xai/grok-3 | $0.50 | $2.00 |
| Grok 2 Image | xai/grok-2-image-1212 | $0.50 | $2.00 |
| Grok Imagine Video | xai/grok-imagine-video | $0.50 | $2.00 |
xAI (Grok) links
xAI (Grok) FAQ
Is xAI (Grok) free through kRouter?
xAI (Grok) does not bill per token here — kRouter uses your existing subscription via OAuth, so the only cost is whatever you already pay xAI (Grok) directly. kRouter itself is MIT-licensed and free.
How do I use xAI (Grok) with Claude Code or Cursor?
Connect xAI (Grok) in the kRouter dashboard, then point your tool at kRouter's local endpoint (http://localhost:20128/v1) with a kRouter API key. Any OpenAI-compatible client works, and models are addressed as xai/<model>.
Which xAI (Grok) models can kRouter route to?
6 models, including Grok 4, Grok 4 Fast Reasoning, Grok Code Fast. Every one is addressed as xai/<model> from any client.
What happens when xAI (Grok) is rate limited?
kRouter detects the limit, parks that account until its real reset time, and fails over to your next connected account or provider — so the request still completes instead of erroring.