Unofficial guide · Grok / xAI API

Grok developer guide (unofficial)

By Ben (BenX) · Last checked against official sources

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 IDgrok-4.7 (xAI lists no alias for it)
Launched21 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 window500,000 tokens; no text output limit
Input and outputText and image in, text out
ReasoningEffort 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 cutoffMay 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
APIsResponses API; Chat Completions (legacy)
Where it runsxAI 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.

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-quality retires. After that, xAI serves those requests with grok-imagine-image-2.0 at quality: "low" and bills them at that rate.
  • 2 Oct 2026: grok-voice-transcribe-1.0 reached end of life; requests to it go to grok-voice-transcribe-2.0 at the same price.
  • 24 Sep 2026 (UTC): xai-sdk 1.20.0 published on PyPI and @ai-sdk/xai 5.0.8 published on npm.
  • 21 Sep 2026: Grok 4.7 launched as grok-4.7. OpenRouter listed it as x-ai/grok-4.7 the same day.
  • 18 Sep 2026: Grok Voice Transcribe 2.0 (grok-voice-transcribe-2.0) became available. It is now the default, and grok-voice-transcribe-1.0 reached 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-1 and grok-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.

Checked 8 October 2026