Unofficial guide · Grok / xAI API
Grok developer guide (unofficial)
Grok is xAI's model family, and the xAI API is how developers call it. The latest model is grok-4.7, launched 21 Sep 2026. You call it at https://api.x.ai/v1 with the OpenAI SDK, xAI's Python SDK (xai-sdk) or the Vercel AI SDK provider (@ai-sdk/xai), or through OpenRouter, Vercel AI Gateway, Cloudflare and Cursor.
Independent guide. aiedu.guide is not affiliated with xAI (SpaceXAI), Grok, OpenRouter, Vercel, Cloudflare, Cursor or Google, and is not endorsed or sponsored by any of them. Product names belong to their owners, and the official pages we checked are listed at the end.
No affiliate links on this page. See our disclosure.
Everything here comes from xAI's documentation and each platform's own pages, checked on 8 Oct 2026. We haven't made test calls.
What is the Grok API?
Short answer: It's xAI's developer API for the Grok models, served at https://api.x.ai/v1. The current model is grok-4.7: text and image in, text out, with a 500,000-token context window and reasoning that is always on.
xAI documents two ways to send a request. The Responses API is the main one. Chat Completions is still available, but xAI calls it a legacy endpoint on its own page and labels it "Deprecated" in its API comparison table.
Is the Grok API OpenAI-compatible? Yes. xAI's docs use the OpenAI SDK with base_url="https://api.x.ai/v1" and your key from XAI_API_KEY. xAI also documents its own gRPC-based Python SDK, xai-sdk, and the AI SDK provider @ai-sdk/xai.
Grok 4.7 at a glance
Short answer: grok-4.7 costs $2 per million input tokens and $6 per million output tokens below 200K prompt tokens, has a 500,000-token context window, and starts at 150 requests per second on the lowest rate-limit tier.
Table: Grok 4.7 on the xAI API (last checked 8 Oct 2026)
| Grok 4.7 | |
|---|---|
| Model ID | grok-4.7 (xAI lists no alias for it) |
| Launched | 21 Sep 2026 |
| Price per 1M tokens, prompt below 200K | $2 input, $0.50 cached input, $6 output |
| Price per 1M tokens, prompt at or above 200K | $4 input, $1 cached input, $12 output, applied to every token in the request |
| Context window | 500,000 tokens; no text output limit |
| Input and output | Text and image in, text out |
| Reasoning | Effort low, medium, high (default) or xhigh, sent as reasoning: {"effort": ...} on the Responses API (reasoning_effort in xai-sdk). It can't be turned off. |
| Knowledge cutoff | May 2026 in xAI's docs; the model card gives a June 2026 pretraining-data cutoff |
| Rate limits (xAI rate-limits page) | 150 RPS and 50M TPM at Tier 0, up to 500 RPS and 100M TPM at Tier 4 |
| APIs | Responses API; Chat Completions (legacy) |
| Where it runs | xAI API, the US regional endpoint https://us.api.x.ai/v1, Grok Build, Cursor, OpenRouter, Vercel AI Gateway and Cloudflare |
What is Grok 4.7's knowledge cutoff? Sources differ. xAI's docs list a May 2026 knowledge cutoff; the Grok 4.7 model card gives a June 2026 pretraining-data cutoff. The two may measure different things, so we don't pick one.
Other models xAI still lists on the API include grok-4.6, grok-4.5, grok-4.3, grok-4.20-0309-reasoning, grok-4.20-0309-non-reasoning, grok-4.20-multi-agent-0309, grok-build-0.1, the Imagine image and video models, and the voice models. The full list, with context windows, is in Grok API models, pricing and rate limits.
Which Grok guide do you need?
Short answer: Start with the quickstart for your first call, the pricing page for costs and limits, and the channels page if you call Grok through a gateway. The tools pages cover function calling, JSON output and search.
- How do I make my first Grok API call? Grok API quickstart: your first
grok-4.7call with curl, Python and TypeScript - Why am I getting a 401, 422 or 429 error? What Grok API error codes mean
- What does Grok 4.7 cost? Grok 4.7 pricing, including the 200K long-context rule
- What are my Grok API rate limits? xAI rate-limit tiers, RPS and TPM explained
- Why is my old model name now answered by another model? What happened to retired Grok models
- What is Grok 4.7's model ID on OpenRouter, Vercel or Cloudflare? Grok 4.7 model IDs and prices by channel
- Why does my tool call arrive in one chunk, or my
stopparameter fail? Grok function calling and structured outputs: the quirks - What replaced Live Search and
search_parameters? Moving from Live Search to theweb_searchandx_searchtools - Using Grok as an app, not the API? See our Grok Bot guides for the desktop and mobile app.
What changed recently in the Grok API?
Short answer: Grok 4.7 launched on 21 Sep 2026, grok-voice-transcribe-1.0 reached end of life on 2 Oct 2026, a batch of older model names was retired on 15 May 2026, and grok-imagine-image-quality retires on 2 Nov 2026.
- 2 Nov 2026 (upcoming):
grok-imagine-image-qualityretires. After that, xAI serves those requests withgrok-imagine-image-2.0atquality: "low"and bills them at that rate. - 2 Oct 2026:
grok-voice-transcribe-1.0reached end of life; requests to it go togrok-voice-transcribe-2.0at the same price. - 24 Sep 2026 (UTC):
xai-sdk1.20.0 published on PyPI and@ai-sdk/xai5.0.8 published on npm. - 21 Sep 2026: Grok 4.7 launched as
grok-4.7. OpenRouter listed it asx-ai/grok-4.7the same day. - 18 Sep 2026: Grok Voice Transcribe 2.0 (
grok-voice-transcribe-2.0) became available. It is now the default, andgrok-voice-transcribe-1.0reached end of life on 2 Oct 2026. - 2 Sep 2026: xAI began its 60-day retirement notice for
grok-imagine-image-quality. - 15 May 2026, 12:00 PM PT: xAI retired older slugs, including
grok-4-fast-reasoning,grok-4-1-fast-reasoning,grok-4-0709,grok-code-fast-1andgrok-3. Requests to them are now redirected to newer models. - As of 8 Oct 2026: xAI's old Live Search guide URL redirects to its Web Search tool page.
Is Grok the same thing as Grok Bot?
Short answer: No. The Grok API is for developers who send requests from code. Grok Bot is a separate desktop and mobile app, and it has its own Grok Bot guides.
This hub covers the API only: model IDs, prices, limits, SDKs and tools.
FAQ
Is the Grok API OpenAI-compatible?
Yes. xAI's docs use the OpenAI SDK with base_url="https://api.x.ai/v1" and your key from XAI_API_KEY. xAI also documents its own gRPC-based Python SDK, xai-sdk, and the AI SDK provider @ai-sdk/xai.
What is the Grok API?
It's xAI's developer API for the Grok models, served at https://api.x.ai/v1. The current model is grok-4.7: text and image in, text out, with a 500,000-token context window and reasoning that is always on.
How much does Grok 4.7 cost?
grok-4.7 costs $2 per million input tokens and $6 per million output tokens below 200K prompt tokens, has a 500,000-token context window, and starts at 150 requests per second on the lowest rate-limit tier.
What is Grok 4.7's knowledge cutoff?
Sources differ. xAI's docs list a May 2026 knowledge cutoff; the Grok 4.7 model card gives a June 2026 pretraining-data cutoff. The two may measure different things, so we don't pick one.
Is Grok the same thing as Grok Bot?
No. The Grok API is for developers who send requests from code. Grok Bot is a separate desktop and mobile app, and it has its own Grok Bot guides.
Official sources
Facts on this page come from these pages. Grok 4.7 launched in September 2026 and prices, limits and model lists change often, so check the official page before you rely on a number.
- xAI docs: Grok 4.7
- xAI docs: Grok 4.7 model page
- xAI docs: Models
- xAI docs: Pricing
- xAI docs: Rate limits
- xAI docs: Quickstart
- xAI docs: Reasoning
- xAI docs: Chat Completions (legacy)
- xAI docs: API comparison
- xAI docs: Release notes
- xAI docs: 15 May 2026 model retirement
- xAI docs: grok-imagine-image-quality retirement (2 Nov 2026)
- xAI docs: Web Search tool
- xAI: Grok 4.7 announcement (21 Sep 2026)
- xAI: Grok 4.7 model card (PDF)
- GitHub: xai-org/xai-sdk-python
- PyPI: xai-sdk (JSON API)
- npm registry: @ai-sdk/xai
- OpenRouter: Grok 4.7 endpoints (API)
Checked 8 October 2026