Grok parameter and protocol differences
Understand Grok parameter differences and usage across compatible protocols.
For Grok models, adjust thinking, sampling and caching using this page. See Chat Completions and Responses for full request and response structures.
Applicable models
| Model | Usage notes |
|---|---|
| grok-4.7 | Supports low/medium/high/xhigh, default high, with thinking always on; Responses returns encrypted thinking by default |
| grok-4.6 | Also supports four levels, default high, with thinking always on; request encrypted thinking through include |
| grok-4.5 | Supports low/medium/high, default high, with thinking always on; xhigh is treated as high |
xAI treats Chat as its legacy compatibility endpoint and Responses as the main API; historical Messages compatibility is officially deprecated. This page covers Chat and Responses, not platform discontinuation of other endpoints.
Chat Completions differences
| Field | Difference |
|---|---|
reasoning_effort | Select levels from the table above; none cannot disable thinking |
temperature | Requests allow 0~2, but actual sampling is capped at 1; valid values above 1 become 1. This is not field deprecation |
top_p | Valid request values go up to 1, but actual sampling cannot exceed the model default, currently 0.95; omission uses that default |
presence_penalty/frequency_penalty/stop | Unsupported on these reasoning models and returns an error; do not reuse these optional fields from the general Reference |
logprobs/top_logprobs | Unsupported on all three models and silently ignored, unlike the error-returning fields above |
tools[].function.strict | Tool arguments always follow the supported JSON Schema; strict is implicitly true. Setting false does not enable non-strict generation |
| Thinking history | Chat has no field carrying Responses-style encrypted thinking; use Responses for encrypted thinking across turns |
Responses differences
| Field | Difference |
|---|---|
reasoning.effort | Use the model's levels above, default high; thinking cannot be disabled |
temperature/top_p | The same sampling caps apply. Responses may echo original request values rather than actual capped sampling settings |
| Penalties and Logprobs | Same limits as Chat: penalties are unsupported; Logprobs parameters are ignored. Switching to Responses does not enable them |
max_output_tokens | Limits visible answers only, excluding thinking and function-call tokens; default 128000. Do not interpret it as OpenAI's combined budget |
include | grok-4.6 and grok-4.5 request encrypted thinking through reasoning.encrypted_content; grok-4.7 returns it even without the request |
store/previous_response_id | store defaults to true; vendor responses last 30 days and can be continued by ID. With store: false, manually replay complete history and all output items, not just final text; preserve encrypted thinking unchanged |
tools[].strict | Function tools also use implicit strict mode; function parameters and structured output use xAI's supported JSON Schema subset |
| JSON Schema | additionalProperties defaults to false; explicitly set true to allow extra properties. $ref/$defs supports noncircular references only, not recursive schemas |
| Server-side tools | xAI Responses uses types such as web_search, x_search and code_interpreter; the latter corresponds to native xAI SDK code_execution. Do not mix these names |
Cache differences
| Field | Difference |
|---|---|
| Automatic prefix caching | Identical input prefixes are reused automatically; put static instructions first, append later content, and do not edit or reorder history |
x-grok-conv-id | Stable conversation identifier in a Chat Header, helping route the conversation to servers holding its cache; not a model parameter |
prompt_cache_key | The corresponding identifier in the Responses body; keep it stable across turns and replay encrypted thinking unchanged. Do not add other vendors' TTL or explicit-breakpoint settings |
| Cache usage | Chat: inspect usage.prompt_tokens_details.cached_tokens; Responses: usage.input_tokens_details.cached_tokens. Cache may be evicted; a conversation identifier does not guarantee a hit |
Media input differences
| Input | Protocol content block | Difference |
|---|---|---|
| Image | image_url | Chat image_url.url accepts public URLs or Base64 Data URLs; JPEG / PNG, maximum 20 MiB per image |
| Image | input_image | Responses image_url directly contains a public URL or Base64 Data URL, with the same limits; not Chat's nested object |
All three output text. detail supports auto/low/high for image processing detail, not image generation.
Request examples
Replace MODEL_ID with the full platform model ID and set a stable identifier per conversation. Responses uses manual history management; replay full output and encrypted thinking in later turns.
curl 'https://api.agtcloud.cn/v1/chat/completions' \
-H 'Authorization: Bearer your-api-key' \
-H 'Content-Type: application/json' \
-H 'x-grok-conv-id: YOUR_CONVERSATION_ID' \
--data '{
"model": "MODEL_ID",
"messages": [{"role": "user", "content": "Explain how to troubleshoot an API timeout in three points"}],
"reasoning_effort": "high",
"max_tokens": 4096
}'Official references
- Grok 4.7 · Grok 4.6 · Grok 4.5 · Model parameter limits
- Thinking and encrypted content · Sampling and output budgets · Chat and Responses
- Chat compatibility endpoint · Responses Reference · Legacy compatibility APIs
- Structured output and tool Schema · Server-side tools · Code execution names
- Cache conversation identifiers · Cache usage rules · Image input