Skip to content

Grok model behaviour

xAI's API surface, its OpenAI-compatible edges and where that compatibility stops, version by documented version.

xAI describes its inference API as compatible with the OpenAI REST API, and for the first request that is true: change the base URL to https://api.x.ai/v1, change the key, change the model name, and an existing client works. The interesting part of Grok is everywhere that sentence stops being true. Reasoning models reject stop and the two penalty parameters. logprobs is accepted and silently ignored by the newest family. There is a second, non-OpenAI request shape — the Responses API, with input instead of messages and a flatter tool definition — and the newest server-side tools are documented only against that one. Pricing has a step in it at 200k prompt tokens.

These pages work through that surface one field at a time, taking every figure from a named xAI page and marking the ones expected to move. Where xAI publishes nothing — and on output ceilings and image token arithmetic it publishes nothing — the page says so and points at the response field that answers the question for your own account, rather than filling the hole with a number from somewhere else.

Grok's Context Window Across Versions

The documented context length of every current Grok model, and the 200k pricing step that sits inside those windows.

8 min read

Function Calling in the xAI API

The two tool-call shapes xAI documents — the flat Responses form and the nested OpenAI-compatible form — and the schema rule that rejects a request outright.

9 min read

Grok's Default System Prompt and Persona

What xAI actually publishes about Grok's system prompts, which of those apply to the API rather than to the chat products, and what a custom system message replaces.

8 min read

How Real-Time Data Reaches Grok: Fed Into Context, Not Fine-Tuned In

The server-side search tools that put fresh X posts and web pages into the context window at request time, and what that costs you in tokens and latency.

9 min read

The Streaming Response Shape of the xAI API

The SSE chunk shape xAI documents, where usage appears, and the two places the stream stops being OpenAI-compatible.

9 min read

Grok's Documented Content Policy Restrictions

What xAI's published acceptable use policy forbids for hosted API traffic, and which of those clauses are about your integration rather than about the prompt.

8 min read

Grok's Max Output Tokens per Model

xAI does not publish a per-model output ceiling; the limit comes from max_completion_tokens, its 128,000 default, and the context window the output shares.

8 min read

Vision Input in Grok: Image Support and Token Cost

The documented limits on image input to Grok — 20 MiB, JPEG and PNG only, no cap on image count — and the response field that reports what an image cost.

8 min read

Grok's Model Deprecation and Version History on the xAI API

The eight slugs xAI retired on 15 May 2026, what happens to requests that still use them, and why a redirect is a worse failure than a 404.

9 min read

Stop Sequences in the xAI API

How the stop parameter behaves on Grok — four sequences, trimmed from the output, and rejected outright by reasoning models.

8 min read

Pinning a Dated Grok Model Snapshot

Swap a moving Grok alias for a dated snapshot, verify which model actually served the request, and get an alert when the pin stops being valid.

9 min read

Grok's Reasoning Mode: How the “Think” Output Differs From the Final Answer

Where the reasoning trace lives in an xAI response, how reasoning_effort controls it, and why the trace is billed whether or not you see it.

9 min read

JSON Mode and Structured Output in Grok

The three documented response_format types on the xAI API, what the schema guarantee does and does not cover, and when a forced tool call is the better instrument.

9 min read

Grok's Tokenizer: Why Token Counts Differ From GPT's

Why a GPT tokenizer is the wrong instrument for a Grok token budget, and the two documented ways to get a number xAI will actually bill you for.

8 min read

Other topics