Generates a response based on text or image prompts. The response ID can be used to retrieve the response later or to continue the conversation without repeating prior context. New responses will be stored for 30 days and then permanently deleted.
Request
- Base URL: https://docs.x.ai (the document declares no server; this is the origin it was published from)
- URL: https://docs.x.ai/v1/responses
- Auth: HTTP bearer
Request body
(Unsupported) Whether to process the response asynchronously in the background.
What additional output data to include in the response. Supported values include reasoning.encrypted_content (encrypted reasoning tokens) and tool-output options. OpenAI's message.output_text.logprobs is accepted for compatibility but silently ignored.
An alternate way to specify the system prompt. Note that this cannot be used alongside previous_response_id, where the system prompt of the previous message will be used.
Whether to return log probabilities of the output tokens or not. If true, returns the log probabilities of each output token returned in the content of message. Not supported by models grok-4.20 and newer; the field will be silently ignored if set.
Max number of tokens that can be generated in a response. Only applies to visible output tokens (i.e. does not apply to tokens used for reasoning or function calls). Defaults to 128,000 when unset; set a larger value to allow longer generations.
Maximum number of agentic tool calling turns allowed for this request. If not set, defaults to the server's global cap. This parameter will be ignored for any non-agentic requests, and for agentic SLOP requests that have neither a server-side tool nor a file attachment.
Min-p sampling: tokens whose probability is below min_p times the probability of the most likely token are excluded from sampling. Disabled when unset.
Model name for the model to use. Obtainable from https://console.x.ai/team/default/models or https://docs.x.ai/docs/models.
Whether to allow the model to run parallel tool calls.
The ID of the previous response from the model.
Plumbed to x-grok-conv-id for Open Responses compatibility, used for routing.
Non-standard alternative to reasoning.effort that accepts the same values. We only look at this if the reasoning field is unset.
Supplied by the API client to identify the end user behind this request. A stable string that uniquely identifies each of your users; hash your internal user id or username rather than sending an email or name. Stored with the request metadata so a usage-policy violation can be attributed to that user rather than to the API key.
Processing tier for a request. Fast and Priority are interchangeable: the model's fast deployment and its rates where configured, else higher scheduling priority at a higher price.
Whether to store the input message(s) and model response for later retrieval.
If set, partial message deltas will be sent. Tokens will be sent as data-only server-sent events as they become available, with the stream terminated by a data: [DONE] message.
What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.
Top-k sampling: only the top_k most probable tokens are considered at each sampling step. Disabled when unset.
An integer between 0 and 8 specifying the number of most likely tokens to return at each token position, each with an associated log probability. logprobs must be set to true if this parameter is used. Not supported by models grok-4.20 and newer; the field will be silently ignored if set.
An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. It is generally recommended to alter this or temperature but not both.
Not supported. Only maintained for compatibility reasons.
A unique identifier representing your end-user, which can help xAI to monitor and detect abuse.
Response
Success
OpenResponses compatibility fields. Not used at the moment. Just for OpenResponses compatibility. Whether to process the response asynchronously in the background.
The Unix timestamp (in seconds) for the response completion time. Only set when the response is completed.
The Unix timestamp (in seconds) for the response creation time.
(NOT SUPPORTED in Responses API) Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim.
Unique ID of the response.
A system (or developer) message inserted into the model's context.
Max number of tokens that can be generated in a response. Only applies to visible output tokens (i.e. does not apply to tokens used for reasoning or function calls).
The maximum number of tool calls allowed for this response.
Model name used to generate the response.
The object type of this resource. Always set to response.
Whether to allow the model to run parallel tool calls.
(NOT SUPPORTED in Responses API) Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics.
The ID of the previous response from the model.
The cache key used for the prompt for routing to the correct engine.
A stable identifier used to help detect users of your application that may be violating xAI's usage policies.
Processing tier for a request. Fast and Priority are interchangeable: the model's fast deployment and its rates where configured, else higher scheduling priority at a higher price.
Status of the response. One of completed, in_progress or incomplete.
Whether to store the input message(s) and model response for later retrieval.
What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.
An integer between 0 and 8 specifying the number of most likely tokens to return at each token position.
An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass. So 0.1 means only the tokens comprising the top 10% probability mass are considered. It is generally recommended to alter this or temperature but not both.
The truncation strategy to use for the model response.
A unique identifier representing your end-user, which can help xAI to monitor and detect abuse.
Changes
No recorded changes to this operation across all 1 revision of this API.