Skip to main content
Lesson 3 of 16 · Responses API: Primary Endpoint

Request Parameters

Lesson 3 of 16 Updated November 3, 2026 Developer
On this page
  1. Control model behavior
  2. Generation parameters
  3. Conversation parameters
  4. Tool parameters
  5. Parameter summary
  6. Key takeaways

Updated November 3, 2026. Based on the Responses API reference and xAI best practices: recommended temperature 0.7, capped at 1; top_p 0.95 by default; max_output_tokens limited 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 with previous_response_id
  • false: 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

ParameterTypeDefaultUsage
modelstringrequiredModel identifier
inputstring/arrayrequiredUser prompt
instructionsstringnullSystem prompt
temperaturenumber—0.7 recommended; capped at 1
top_pnumber0.95Nucleus sampling
max_output_tokensinteger128,000Visible response limit
reasoningobjectnullReasoning effort
storebooleannull30-day persistence
streambooleanfalseSSE streaming
userstringnullEnd user ID

Key takeaways

  • xAI recommends temperature at 0.7 and top_p at 0.95, set explicitly
  • max_output_tokens limits only the visible response, excluding reasoning
  • store: true persists the response for 30 days for conversation chaining
  • reasoning.effort lets you scale the model’s reflection based on task complexity
  • The user parameter helps with tracking and moderation on xAI’s side