Request Parameters
On this page
Updated November 3, 2026. Based on the Responses API reference and xAI best practices: recommended temperature 0.7, capped at 1;
top_p0.95 by default;max_output_tokenslimited to visible response (128,000 default, reasoning excluded); reasoning effort reserved for grok-4.5 to 4.7. Sources: Responses API · Best practices.
Control model behavior
Beyond model, input, and instructions, the Responses API offers numerous parameters to fine-tune Grok’s behavior. Understanding these parameters lets you get more relevant, shorter, or more creative responses depending on your needs.
Generation parameters
temperature
Controls the randomness of responses. The API accepts values from 0 to 2, but anything above 1 is sampled at 1.
{
"model": "grok-4.7",
"input": "Write a slogan for a bakery.",
"temperature": 0.7,
"top_p": 0.95
}
xAI’s best practices are clear: set temperature to 0.7 and don’t stray far from it, because Grok models react poorly to other sampling settings. For a more factual or creative tone, adjust the prompt rather than the temperature.
top_p
Nucleus sampling. Current text models default to 0.95, and any value higher than the model default is reduced to it.
{
"model": "grok-4.7",
"input": "Summarize this article.",
"top_p": 0.95
}
With top_p: 0.95, the model considers only tokens that account for 95% of the probability. The API reference repeats the classic advice to adjust only one of the two parameters; xAI best practices instead require explicitly setting both, to 0.7 and 0.95, on every request.
max_output_tokens
Limits the number of tokens in the visible response; reasoning and function calls do not count, and the default value is 128,000 tokens:
{
"model": "grok-4.20-0309-reasoning",
"input": "Explain general relativity.",
"max_output_tokens": 500
}
For reasoning models, reasoning effort, not this cap, governs internal reflection. A response cut off by the cap is signaled by an incomplete status.
reasoning
For models that support reasoning, you can adjust the effort:
{
"model": "grok-4.7",
"input": "Solve this logic problem.",
"reasoning": {"effort": "high"}
}
Possible values are low, medium, and high (default), plus xhigh on grok-4.6 and grok-4.7; the parameter applies to grok-4.5 to 4.7, and grok-4.20-0309-reasoning does not accept it. High effort consumes more tokens and suits complex problems.
Conversation parameters
store
Determines whether the response is stored server-side:
{
"model": "grok-4.20-0309-reasoning",
"input": "Analyze this contract.",
"store": false
}
true: response stored for 30 days, retrievable via GET, usable withprevious_response_idfalse: response not persisted (private mode)
previous_response_id
Chains a new request to an existing conversation (detailed in lesson 5).
user
End user identifier, useful for tracking and moderation:
{
"model": "grok-4.20-0309-reasoning",
"input": "Hello",
"user": "user-12345"
}
Tool parameters
tools, tool_choice, parallel_tool_calls, max_turns
These parameters control tool usage (web_search, code_interpreter, custom functions). They are covered in detail in the “Tools” section (lessons 9-12).
Parameter summary
| Parameter | Type | Default | Usage |
|---|---|---|---|
model | string | required | Model identifier |
input | string/array | required | User prompt |
instructions | string | null | System prompt |
temperature | number | — | 0.7 recommended; capped at 1 |
top_p | number | 0.95 | Nucleus sampling |
max_output_tokens | integer | 128,000 | Visible response limit |
reasoning | object | null | Reasoning effort |
store | boolean | null | 30-day persistence |
stream | boolean | false | SSE streaming |
user | string | null | End user ID |
Key takeaways
- xAI recommends
temperatureat 0.7 andtop_pat 0.95, set explicitly max_output_tokenslimits only the visible response, excluding reasoningstore: truepersists the response for 30 days for conversation chainingreasoning.effortlets you scale the model’s reflection based on task complexity- The
userparameter helps with tracking and moderation on xAI’s side